Avoid modifying path placeholders created by editable installs

The setuptools implementation of editable installs will insert a
placeholder entry into sys.path as part of its magic to register its
custom import mechanism.

These are not real filesystem paths and as such should not be
rewritten to absolute paths.
This commit is contained in:
Jeremy Hiatt
2024-02-27 20:31:00 -08:00
parent f57c65839b
commit 51ef94439c
2 changed files with 3 additions and 1 deletions

1
changelog/1028.bugfix Normal file
View File

@@ -0,0 +1 @@
Fix compatiblity issue between `looponfail` and editable installs.

View File

@@ -160,7 +160,8 @@ def init_worker_session(channel, args, option_dict):
newpaths = [] newpaths = []
for p in sys.path: for p in sys.path:
if p: if p:
if not os.path.isabs(p): # Ignore path placeholders created for editable installs
if not os.path.isabs(p) and not p.endswith(".__path_hook__"):
p = os.path.abspath(p) p = os.path.abspath(p)
newpaths.append(p) newpaths.append(p)
sys.path[:] = newpaths sys.path[:] = newpaths