poetry icon indicating copy to clipboard operation
poetry copied to clipboard

Trace on excluded broken symlinks

Open amarao opened this issue 2 years ago • 0 comments

  • 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.

amarao avatar Jul 31 '23 14:07 amarao