Skip to content

[Request for Reverting Intentional Breaking Change] New license file validation breaks projects with non-standard layout #4892

@tiran

Description

@tiran

setuptools version

77.0.1

Python version

any

OS

any

Additional environment information

No response

Description

The new license file validation logic from #4838 breaks projects that have a non-standard layout. Projects like Apache Arrow or Triton don't have their Python code in the root directory of the sources. Instead it is in a subdirectory, typically called python. For example Apache Arrow has a python/setup.cfg with

[metadata]
license_files =
  ../LICENSE.txt
  ../NOTICE.txt

Expected behavior

setuptools does not break software that uses a non-standard layout and reference license files from a parent directory.

How to Reproduce

  1. download and unpack https://github.com/apache/arrow/archive/refs/tags/apache-arrow-19.0.1.tar.gz
  2. cd arrow-apache-arrow-19.0.1/python
  3. python3 -m venv venv
  4. . venv/bin/activate
  5. pip install -U setuptools cython
  6. python3 setup.py

Output

Traceback (most recent call last):
  File "/home/cheimes/tmp/arrow-apache-arrow-19.0.1/python/setup.py", line 399, in <module>
    setup(
  File "/home/cheimes/tmp/arrow-apache-arrow-19.0.1/python/venv/lib64/python3.9/site-packages/setuptools/__init__.py", line 116, in setup
    _install_setup_requires(attrs)
  File "/home/cheimes/tmp/arrow-apache-arrow-19.0.1/python/venv/lib64/python3.9/site-packages/setuptools/__init__.py", line 87, in _install_setup_requires
    dist.parse_config_files(ignore_option_errors=True)
  File "/home/cheimes/tmp/arrow-apache-arrow-19.0.1/python/venv/lib64/python3.9/site-packages/setuptools/dist.py", line 752, in parse_config_files
    self._finalize_license_files()
  File "/home/cheimes/tmp/arrow-apache-arrow-19.0.1/python/venv/lib64/python3.9/site-packages/setuptools/dist.py", line 466, in _finalize_license_files
    self.metadata.license_files = list(unique_everseen(files))
  File "/home/cheimes/tmp/arrow-apache-arrow-19.0.1/python/venv/lib64/python3.9/site-packages/setuptools/_vendor/more_itertools/recipes.py", line 511, in unique_everseen
    for element in iterable:
  File "/home/cheimes/tmp/arrow-apache-arrow-19.0.1/python/venv/lib64/python3.9/site-packages/setuptools/dist.py", line 483, in <genexpr>
    for path in sorted(cls._find_pattern(pattern, enforce_match))
  File "/home/cheimes/tmp/arrow-apache-arrow-19.0.1/python/venv/lib64/python3.9/site-packages/setuptools/dist.py", line 506, in _find_pattern
    raise InvalidConfigError(f"Pattern {pattern!r} cannot contain '..'")
setuptools.errors.InvalidConfigError: Pattern '../LICENSE.txt' cannot contain '..'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs DiscussionIssues where the implementation still needs to be discussed.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions