[BUG] Unusually named license_files not included in dist-info
See original GitHub issuesetuptools version
setuptools===57.4.0
Python version
3.9.6
OS
Fedora Linux 33, x86_64
Additional environment information
wheel===0.36.2
Description
I’ve tried to test out https://github.com/pypa/setuptools/pull/2645 but including license files not named according to this pattern:
Are not included in dist info.
Expected behavior
I expected that files explicitly listed in license_files
will always be listed in METADATA
under License-File:
and will always be included in the dist-info directory regardless of their filename.
How to Reproduce
Consider this setup.py
:
from setuptools import setup
setup(
name='nested_dist',
version='666',
license_files=['LICENSE'],
)
And an empty LICENSE
file.
Run:
$ python -c 'import setuptools.build_meta; setuptools.build_meta.__legacy__.prepare_metadata_for_build_wheel(".")'
Or:
$ python setup.py bdist_wheel
Or:
$ pip wheel .
You’ll see something like:
running dist_info
...
adding license file 'LICENSE'
...
adding license file "LICENSE" (matched pattern "LICEN[CS]E*")
...
The LICENSE
file will be listed in METADATA
under License-File:
and it will be included in the dist-info directory.
Now rename LICENSE
to DIFFERENT
and adapt license_files
accordingly:
from setuptools import setup
setup(
name='nested_dist',
version='666',
license_files=['DIFFERENT'],
)
You’ll get:
...
adding license file 'DIFFERENT'
...
The DIFFERENT
file will be listed in METADATA
under License-File:
and it will not be included in the dist-info directory.
Output
See above.
Code of Conduct
- I agree to follow the PSF Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
Also, what happens if someone names the license file
RECORD
?Raise an error if an existing file in dist-info would be overwritten? That’d allow adding better solutions in the future.
If you’re referring to the
license_files
argument insetup()
, I agree this should be deprecated / removed.That is still a point that needs to be addressed. IMO
wheel
needs to update their implementation here. Although they do mention the behavior in their docs, it can cause name conflicts, e.g., if a file namedLICENSE
is present in a sub dir in addition to the main one.In that case
3rdparty/LICENSE
would overwrite the previous one.– I’m open to suggestions if you have an idea how to better resolve this conflict.