-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] license_files
not showing up on wheel if not set on setup.cfg
(setup.py
& pyproject.toml
).
#3599
Comments
I've done a tiny bit of debugging, and after |
Hi @ashb it would seem that configurations in mkdir /tmp/test-licenses
cd /tmp/test-licenses
mkdir -p licenses
date > licenses/license-A.txt
cat > pyproject.toml << EOF
[build-system]
requires = ['setuptools==65.2.0']
build-backend = "setuptools.build_meta"
EOF
cat > setup.py <<EOF
from setuptools import setup
setup(
name="repro-case",
version='2.5.0dev0',
python_requires="~=3.7",
license="Apache License 2.0",
author="Ash <[email protected]>",
license_files=[
'LICENSE',
'licenses/license-A.txt',
],
)
EOF
rm -r repro_case.egg-info/ dist
pipx run build
unzip -l dist/*.whl which results in the following:
Of course, this is equally undesirable... I think what is happening is the following:
I have to think a little bit more about this (if there is something reasonable that we can do in the setuptools side, without requiring changes in |
license_files
not showing up on wheel if not set on setup.cfg
(setup.py
& pyproject.toml
).
Probably the same underlying problem as #2739. |
Oh right. Interesting! I guess we had setup.cfg in our project before we added license_files |
An option would be to put that specific thing in the command-options metadata section. It's not even against the documented purpose of
(I agree that it's not a great option overall though) Forgive me ex-BDFL, for I have sinned: from wheel.bdist_wheel import bdist_wheel
class Wheel(bdist_wheel):
def finalize_options(self):
super().finalize_options()
metadata_opt = self.distribution.get_option_dict('metadata')
metadata_opt['license_files'] = ('pyproject.toml', '\n'.join(self.distribution.metadata.license_files)) (And then add that to cmdclass) |
The original problem seems to be already solved with the latest versions of setuptools and wheel: > docker run --rm -it python:3.11 /bin/bash
mkdir /tmp/test-licenses
cd /tmp/test-licenses
mkdir -p licenses
touch LICENSE
date > licenses/license-A.txt
cat > pyproject.toml << EOF
[build-system]
requires = ['setuptools==66.0.0', 'wheel==0.38.4']
build-backend = "setuptools.build_meta"
EOF
cat > setup.py <<EOF
from setuptools import setup
setup(
name="repro-case",
version='2.5.0dev0',
python_requires="~=3.7",
license="Apache License 2.0",
author="Ash <[email protected]>",
license_files=[
'LICENSE',
'licenses/license-A.txt',
],
)
EOF
rm -rf repro_case.egg-info/ dist
python -m pip install build
python -m build
unzip -l dist/*.whl
# Archive: dist/repro_case-2.5.0.dev0-py3-none-any.whl
# Length Date Time Name
# --------- ---------- ----- ----
# 0 2023-01-20 10:59 repro_case-2.5.0.dev0.dist-info/LICENSE
# 198 2023-01-20 10:59 repro_case-2.5.0.dev0.dist-info/METADATA
# 92 2023-01-20 10:59 repro_case-2.5.0.dev0.dist-info/WHEEL
# 29 2023-01-20 10:59 repro_case-2.5.0.dev0.dist-info/license-A.txt
# 9 2023-01-20 10:59 repro_case-2.5.0.dev0.dist-info/top_level.txt
# 521 2023-01-20 10:59 repro_case-2.5.0.dev0.dist-info/RECORD
# --------- -------
# 849 6 files Details about the exact placement of the license files inside |
setuptools version
setuptools==65.2.0
Python version
Python 3.10.7
OS
Arch Linux
Additional environment information
No response
Description
A setuptools based distribtuion does not include the files specified in
license-files
under thetool.setuptools
table in the wheel files dist-info (by a setup.py/setup.cfg) based project does).Expected behavior
It works for sdist, and I see appropriate lines about "adding license-A.txt" but it doesn't show up in the wheel when pyproject.toml is present
How to Reproduce
With pyproject.toml
With out pyproject.toml:
Output
Expected output (and this is what I get with setup.cfg includes
repro_case-2.5.0.dev0.dist-info/license-A.txt
Output with pyproject.toml does not include extra file
The text was updated successfully, but these errors were encountered: