Skip to content

Commit

Permalink
venv.py: Use os.pathsep
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb committed Oct 23, 2019
1 parent 6b88e7e commit 0f31cae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions vpip/venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def iter_global_packages():
def get_path_without_venv(path, venv_dir):
if not venv_dir:
return path
return ";".join(p for p in re.split("\s*;\s*", path)
if not p.startswith(venv_dir))
return os.pathsep.join(
p for p in re.split("\s*{}\s*".format(os.pathsep), path)
if not p.startswith(venv_dir))

def get_current_venv():
"""Get the :class:`Venv` instance pointing to ``./.venv``.
Expand Down Expand Up @@ -93,8 +94,9 @@ def __init__(self, env_dir):
self.env_dir = os.path.abspath(env_dir)
self.old_env_dir = os.environ.get("VIRTUAL_ENV")

self.path = "{};{}".format(
self.path = "{}{}{}".format(
get_script_folder(self.env_dir),
os.pathsep,
get_path_without_venv(os.environ["PATH"], self.old_env_dir)
)
self.old_path = os.environ["PATH"]
Expand Down Expand Up @@ -144,4 +146,3 @@ def create(self):
def destroy(self):
"""Destroy the venv. Remove the venv folder."""
shutil.rmtree(self.env_dir)

0 comments on commit 0f31cae

Please sign in to comment.