Skip to content

Commit

Permalink
Update plugin.py
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored Sep 19, 2024
1 parent 2d6665e commit 809cbfc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions a00_qpip/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def pip_uninstall_reqs(self, reqs_to_uninstall, extra_args=[]):

run_cmd(
[
sys.executable,
self.python_command(),
"-um",
"pip",
"uninstall",
Expand All @@ -251,13 +251,9 @@ def pip_install_reqs(self, reqs_to_install):
os.makedirs(self.prefix_path, exist_ok=True)
log(f"Will pip install {reqs_to_install}")

# python is normally found at sys.executable, but there is a bug on windows qgis so use 'python' instead
# https://github.com/qgis/QGIS/issues/45646
python_command = 'python' if os.name == 'nt' else sys.executable

run_cmd(
[
python_command,
self.python_command(),
"-um",
"pip",
"install",
Expand All @@ -268,6 +264,11 @@ def pip_install_reqs(self, reqs_to_install):
f"installing {len(reqs_to_install)} requirements",
)

def python_command(self):
# python is normally found at sys.executable, but there is an issue on windows qgis so use 'python' instead
# https://github.com/qgis/QGIS/issues/45646
return "python" if os.name == "nt" else sys.executable

def check(self):
dialog, _ = self.check_deps()
self.promt_install(dialog)
Expand Down

0 comments on commit 809cbfc

Please sign in to comment.