Skip to content

Commit 973f7f4

Browse files
committed
Improve logic operations on path handling
1 parent bfc84d3 commit 973f7f4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

setuptools/command/build_ext.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,11 @@ def _get_internal_depends(self) -> Iterator[str]:
271271
depends = (dep for ext in self.extensions for dep in ext.depends)
272272
for dep in depends:
273273
try:
274-
path = os.path.abspath(dep)
275-
rel_path = str(Path(path).relative_to(project_root))
276-
assert ".." not in rel_path # abspath should have taken care of that
277-
yield rel_path.replace(os.sep, "/") # POSIX-style relative paths
274+
path = os.path.abspath(os.path.join(project_root, dep))
275+
# if dep is absolute, os.path.join will ignore project_root
276+
rel_path = Path(path).relative_to(project_root)
277+
assert ".." not in rel_path.parts # abspath should take care of that
278+
yield rel_path.as_posix() # POSIX-style relative paths
278279
except ValueError:
279280
log.warn(f"ignoring {dep} for distribution: outside of project dir")
280281

0 commit comments

Comments
 (0)