Avoid spurious "location may have moved" on Windows · gitpython-developers/GitPython@f44524a

Original file line numberDiff line numberDiff line change

@@ -400,8 +400,12 @@ class VirtualEnvironment:

400400

__slots__ = ("_env_dir",)

401401
402402

def __init__(self, env_dir, *, with_pip):

403-

self._env_dir = env_dir

404-

venv.create(env_dir, symlinks=(os.name != "nt"), with_pip=with_pip)

403+

if os.name == "nt":

404+

self._env_dir = osp.realpath(env_dir)

405+

venv.create(self.env_dir, symlinks=False, with_pip=with_pip)

406+

else:

407+

self._env_dir = env_dir

408+

venv.create(self.env_dir, symlinks=True, with_pip=with_pip)

405409
406410

@property

407411

def env_dir(self):