[BE] use pathlib.Path instead of os.path.* in setup.py#156742
[BE] use pathlib.Path instead of os.path.* in setup.py#156742XuehaiPan wants to merge 28 commits intogh/XuehaiPan/333/basefrom
pathlib.Path instead of os.path.* in setup.py#156742Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/156742
Note: Links to docs will display an error until the docs builds have been completed. ⏳ No Failures, 1 PendingAs of commit e456a3e with merge base 3df6360 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ghstack-source-id: 9bb12c6 Pull-Request: pytorch#156742
ghstack-source-id: b3766a3 Pull-Request: pytorch#156742
| # XXX: Why not use wildcards ["lib/aotriton.images/*", "lib/aotriton.images/**/*"] here? | ||
| aotriton_image_path = TORCH_DIR / "lib" / "aotriton.images" | ||
| aks2_files = [ | ||
| file.relative_to(TORCH_DIR).as_posix() | ||
| for file in aotriton_image_path.rglob("*") | ||
| if file.is_file() | ||
| ] |
There was a problem hiding this comment.
The previous code gets aks2_files = [] and breaks the ROCm build on trunk. I'm not sure why.
I think the following code seems equivalent.
aotriton_image_path = TORCH_DIR / "lib" / "aotriton.images"
- aks2_files: list[str] = []
- for file in filter(lambda p: p.is_file(), aotriton_image_path.glob("**")):
- subpath = file.relative_to(aotriton_image_path)
- aks2_files.append(os.path.join("lib/aotriton.images", subpath))
+ aks2_files = [
+ file.relative_to(TORCH_DIR).as_posix()
+ for file in aotriton_image_path.rglob("*")
+ if file.is_file()
+ ]PS: path.rglob("*") is equivalent to path.glob("**/*"). path.glob("**") will yield path while path.glob("**/*") will not. But we are looking for files only, so they are the same.
ghstack-source-id: 0a78781 Pull-Request: pytorch#156742
|
@pytorchbot merge -f "All relevant tests are green" |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Resolves:
setuptools.build_meta:__legacy__->setuptools.build_meta#155998 (comment)Stack from ghstack (oldest at bottom):
setuptools<80.0#156049python setup.py develop/install->[uv ]pip install --no-build-isolation [-e ].#156027pyproject.tomlconsistency #156017setuptools.build_meta:__legacy__->setuptools.build_meta#155998pathlib.Pathinstead ofos.path.*insetup.py#156742