Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf44524a

Browse files
committed
Avoid spurious "location may have moved" on Windows
The main case where this happens is when tempfile.gettempdir() hasa component in it that uses an 8.3-encoded path, e.g.,C:\Users\Administrator\... -> C:\Users\ADMINI~1\...This is a workaround forpython/cpython#90329. I call realpath onlyonce, when the venv is created, and not on any paths inside thevenv, to make it less likely this masks the problems the warning ismeant for. (For example, if Scripts, or python.exe in it, producedthis even with the venv created as it is now, then that may indictean actual problem.)Note that copying python.exe from Scripts to one level up in thevenv, and changing its name to bash.exe to use it to simulate thebash.exe impostor, as is done in test_hook_uses_shell_not_from_cwd,should not (and does not) produce this warning. If that ever startsto do so, then that should be examined as a sign of brittleness.
1 parenta42ea0a commitf44524a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎test/lib/helper.py

Lines changed: 6 additions & 2 deletions
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+
ifos.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
defenv_dir(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp