Skip to content

Commit

Permalink
Fix usage on non-windows systems
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 7, 2024
1 parent a643b68 commit b45bf5a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions a00_qpip/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ def __init__(self, iface):
"python",
"dependencies",
)
self.site_packages_path = os.path.join(self.prefix_path, "Lib", "site-packages")
self.bin_path = os.path.join(self.prefix_path, "Scripts")
self.site_packages_path = os.path.join(self.prefix_path)
self.bin_path = os.path.join(self.prefix_path, "bin")

if self.site_packages_path not in sys.path:
log(f"Adding {self.site_packages_path} to PYTHONPATH")
sys.path.insert(0, self.site_packages_path)
os.environ["PYTHONPATH"] = (
self.site_packages_path + ";" + os.environ.get("PYTHONPATH", "")
self.site_packages_path + os.pathsep + os.environ.get("PYTHONPATH", "")
)

if self.bin_path not in os.environ["PATH"]:
log(f"Adding {self.bin_path} to PATH")
os.environ["PATH"] = self.bin_path + ";" + os.environ["PATH"]
os.environ["PATH"] = self.bin_path + os.pathsep + os.environ["PATH"]

sys.path_importer_cache.clear()

Expand Down Expand Up @@ -89,9 +89,9 @@ def unload(self):
if self.site_packages_path in sys.path:
sys.path.remove(self.site_packages_path)
os.environ["PYTHONPATH"] = os.environ["PYTHONPATH"].replace(
self.bin_path + ";", ""
self.bin_path + os.pathsep, ""
)
os.environ["PATH"] = os.environ["PATH"].replace(self.bin_path + ";", "")
os.environ["PATH"] = os.environ["PATH"].replace(self.bin_path + os.pathsep, "")

def patched_load_plugin(self, packageName):
"""
Expand Down Expand Up @@ -242,7 +242,7 @@ def pip_install_reqs(self, reqs_to_install):
"pip",
"install",
*reqs_to_install,
"--prefix",
"--target",
self.prefix_path,
],
f"installing {len(reqs_to_install)} requirements",
Expand Down

0 comments on commit b45bf5a

Please sign in to comment.