python-poetry / python-poetry/poetry
Trace on excluded broken symlinks
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- Poetry version: 1.3.2
- Python version: 3.11.2
- OS version and name: Debian Bookworm
- pyproject.toml: https://gist.github.com/amarao/c154b68ee63672e844e3bcd3247ab000
Issue
The problem: our tool has tests with broken symlinks in 'output' (which is fine, and is a part of the normal test). Those symlinks are in outputs/some/levels/here and in , foo/tests/some/levels/here. Both are excluded from build:
exclude = ["outputs/**", "foo/tests/**"]
Example of the broken symlink:
./foo/tests/by-path/pci-0000:05:00.0-ata-1 -> /dev/sdb
When poetry is run as poetry build or poetry install it fails:
Traceback (most recent call last):
File "/home/amarao/git/foo/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/home/amarao/git/foo/venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/amarao/git/foo/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return _build_backend().build_wheel(wheel_directory, config_settings,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-q88jekkt/overlay/lib/python3.11/site-packages/poetry/core/masonry/api.py", line 57, in build_wheel
return WheelBuilder.make_in(
^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-q88jekkt/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 88, in make_in
wb.build(target_dir=directory)
File "/tmp/pip-build-env-q88jekkt/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 124, in build
self._copy_module(zip_file)
File "/tmp/pip-build-env-q88jekkt/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/wheel.py", line 235, in _copy_module
to_add = self.find_files_to_add()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-build-env-q88jekkt/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/builder.py", line 201, in find_files_to_add
include_file.relative_to_project_root()
File "/tmp/pip-build-env-q88jekkt/overlay/lib/python3.11/site-packages/poetry/core/masonry/builders/builder.py", line 397, in relative_to_project_root
return self.path.relative_to(self.project_root)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/pathlib.py", line 731, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/dev/sdb' is not in the subpath of '/home/amarao/git/foo' OR one path is relative and the other is absolute.
Expected behavior: ignore everything in exclude
Actual behavior: trace from poetry for both install and build commands.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the failing path in poetry/core/masonry/builders/builder.py, especially relative_to_project_root(), and the caller in poetry/core/masonry/builders/wheel.py. Reproduce with poetry build or poetry install using an excluded broken symlink; done means excluded symlinks are ignored without a traceback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100