Support for setuptools 70+

- wheel is no longer generated as a dependency of the default build system
- test cases are adapted to support both old and new setuptools version
This commit is contained in:
Miro Hrončok 2024-09-20 13:14:34 +02:00
parent 8baa94160c
commit 20b7ac63f3
4 changed files with 378 additions and 203 deletions

View File

@ -205,7 +205,6 @@ if [ -f pyproject.toml ]; then
elif [ -f setup.py ]; then
# Note: If the default requirements change, also change them in the script!
echo 'python%{python3_pkgversion}dist(setuptools) >= 40.8'
echo 'python%{python3_pkgversion}dist(wheel)'
else
echo 'ERROR: Neither pyproject.toml nor setup.py found, consider using %%%%pyproject_buildrequires -N <requirements-file> if this is not a Python package.' >&2
exit 1

View File

@ -15,7 +15,7 @@ License: MIT
# Increment Z when this is a bugfix or a cosmetic change
# Dropping support for EOL Fedoras is *not* considered a breaking change
Version: 1.16.0
Release: 1%{?dist}
Release: 2%{?dist}
# Macro files
Source001: macros.pyproject
@ -173,6 +173,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%changelog
* Thu Nov 07 2024 Miro Hrončok <miro@hroncok.cz> - 1.16.0-2
- Support for setuptools 70+
- wheel is no longer generated as a dependency of the default build system
* Mon Nov 04 2024 Miro Hrončok <mhroncok@redhat.com> - 1.16.0-1
- %%pyproject_buildrequires: Add support for dependency groups (PEP 735), via the -g flag
- This is implied when used tox testenvs depend on dependency groups (requires tox 4.22+)

View File

@ -268,15 +268,6 @@ def get_backend(requirements):
# with pyproject.toml without a specified build backend.
# If the default requirements change, also change them in the macro!
requirements.add('setuptools >= 40.8', source='default build backend')
# PEP 517 doesn't mandate depending on wheel when the default backend is used.
# Historically, it used to be assumed as necessary, but later it turned out to be wrong.
# See the removal in pip and build:
# https://github.com/pypa/pip/pull/12449
# https://github.com/pypa/build/pull/716
# However, the requirement *will* be generated by setuptools anyway
# as part of get_requires_for_build_wheel().
# So we might as well keep it to skip one redundant step.
requirements.add('wheel', source='default build backend')
requirements.check(source='build backend')

View File

@ -23,7 +23,6 @@ Insufficient version of setuptools:
setup.py: |
expected: |
python3dist(setuptools) >= 40.8
python3dist(wheel)
result: 0
No pyproject.toml, empty setup.py:
@ -32,9 +31,11 @@ No pyproject.toml, empty setup.py:
wheel: 1
include_runtime: false
setup.py: |
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools) >= 40.8
- | # setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
result: 0
@ -47,9 +48,11 @@ Default build system, empty setup.py:
pyproject.toml: |
# empty
setup.py: |
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools) >= 40.8
- | # setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
result: 0
@ -212,9 +215,14 @@ Default build system, build dependencies in setup.py:
setup_requires=['foo', 'bar!=2', 'baz~=1.1.1'],
install_requires=['inst'],
)
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(foo)
(python3dist(bar) < 2 or python3dist(bar) > 2)
(python3dist(baz) >= 1.1.1 with python3dist(baz) < 1.2)
- | # setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(foo)
(python3dist(bar) < 2 or python3dist(bar) > 2)
@ -234,9 +242,14 @@ Default build system, run dependencies in setup.py:
setup_requires=['pyyaml'], # nb. setuptools will try to install this
install_requires=['inst > 1', 'inst2 < 3'],
)
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(pyyaml)
python3dist(inst) > 1.0
python3dist(inst2) < 3~~
- | # setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(pyyaml)
python3dist(inst) > 1.0
@ -287,9 +300,19 @@ Run dependencies with extras (not selected):
if __name__ == "__main__":
main()
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(setuptools) >= 40
python3dist(py) >= 1.5
python3dist(six) >= 1.10
python3dist(setuptools)
python3dist(attrs) >= 17.4
python3dist(atomicwrites) >= 1
python3dist(pluggy) >= 0.11
python3dist(more-itertools) >= 4
- | # setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(setuptools) >= 40
python3dist(py) >= 1.5
@ -310,9 +333,23 @@ Run dependencies with extras (selected):
extras:
- testing
setup.py: *pytest_setup_py
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(setuptools) >= 40
python3dist(py) >= 1.5
python3dist(six) >= 1.10
python3dist(setuptools)
python3dist(attrs) >= 17.4
python3dist(atomicwrites) >= 1
python3dist(pluggy) >= 0.11
python3dist(more-itertools) >= 4
python3dist(argcomplete)
python3dist(hypothesis) >= 3.56
python3dist(nose)
python3dist(requests)
- | # setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(setuptools) >= 40
python3dist(py) >= 1.5
@ -348,9 +385,17 @@ Run dependencies with multiple extras:
'cool-feature': ['dep4[FOO,BAR]'],
},
)
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(dep4)
python3dist(dep4[bar])
python3dist(dep4[foo])
python3dist(dep3)
python3dist(dep2)
python3dist(dep1)
- | # setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(dep4)
python3dist(dep4[bar])
@ -371,9 +416,24 @@ Run dependencies with extras and build wheel option:
extras:
- testing
setup.py: *pytest_setup_py
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(setuptools) >= 40
python3dist(pip) >= 19
python3dist(py) >= 1.5
python3dist(six) >= 1.10
python3dist(setuptools)
python3dist(attrs) >= 17.4
python3dist(atomicwrites) >= 1
python3dist(pluggy) >= 0.11
python3dist(more-itertools) >= 4
python3dist(argcomplete)
python3dist(hypothesis) >= 3.56
python3dist(nose)
python3dist(requests)
- | # setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(setuptools) >= 40
python3dist(pip) >= 19
@ -416,17 +476,22 @@ tox dependencies:
commands =
true
expected:
- | # tox 3
- | # tox 3 with setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(toxdep1)
python3dist(toxdep2)
python3dist(inst)
- | # tox 4
- | # tox 4 with setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(tox-current-env) >= 0.0.6
python3dist(tox)
python3dist(toxdep1)
python3dist(toxdep2)
python3dist(inst)
- | # tox 4 with setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(tox)
@ -468,10 +533,9 @@ tox extras:
commands =
true
expected:
- | # tox 3
- | # tox 3 with setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(toxdep)
python3dist(inst)
@ -482,9 +546,21 @@ tox extras:
python3dist(dep23)
python3dist(extra-dep)
python3dist(extra-dep[extra_dep])
- | # tox 4
- | # tox 4 with setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(tox-current-env) >= 0.0.6
python3dist(tox)
python3dist(toxdep)
python3dist(inst)
python3dist(dep11) > 11.0
python3dist(dep12)
python3dist(dep21)
python3dist(dep22)
python3dist(dep23)
python3dist(extra-dep)
python3dist(extra-dep[extra_dep])
- | # tox 4 with setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(tox)
@ -525,17 +601,22 @@ tox provision unsatisfied:
toxdep1
toxdep2
expected:
- | # tox 3
- | # tox 3 with setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(tox) >= 3.999
python3dist(setuptools) > 40.0
python3dist(wheel) > 2.0
- | # tox 4
- | # tox 4 with setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(tox-current-env) >= 0.0.6
python3dist(tox) >= 3.999
python3dist(setuptools) > 40.0
python3dist(wheel) > 2.0
python3dist(tox) >= 3.999
- | # tox 4 with setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(tox) >= 3.999
@ -569,19 +650,25 @@ tox provision satisfied:
toxdep1
toxdep2
expected:
- | # tox 3
- | # tox 3 with setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(tox) >= 3.5
python3dist(setuptools) > 40.0
python3dist(toxdep1)
python3dist(toxdep2)
python3dist(inst)
- | # tox 4
- | # tox 4 with setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(tox-current-env) >= 0.0.6
python3dist(setuptools) > 40.0
python3dist(tox) >= 3.5
python3dist(toxdep1)
python3dist(toxdep2)
python3dist(inst)
- | # tox 4 with setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(setuptools) > 40.0
@ -611,16 +698,20 @@ tox provision no minversion:
setuptools > 40
wheel > 2
expected:
- | # tox 3
- | # tox 3 with setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(setuptools) > 40.0
python3dist(wheel) > 2.0
- | # tox 4
- | # tox 4 with setuptools 70+
python3dist(setuptools) >= 40.8
python3dist(tox-current-env) >= 0.0.6
python3dist(setuptools) > 40.0
python3dist(wheel) > 2.0
python3dist(tox)
- | # tox 4 with setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
python3dist(tox-current-env) >= 0.0.6
python3dist(setuptools) > 40.0
@ -677,14 +768,21 @@ Default build system, met deps in requirements file:
SQLAlchemy>=1.0.10,<1.1.0 # Zebra protocol service
requirement_files:
- requirements.txt
expected: |
expected:
- | # setuptools 70+
((python3dist(lxml) < 3.7 or python3dist(lxml) > 3.7) with python3dist(lxml) >= 2.3)
python3dist(ncclient)
(python3dist(cryptography) < 1.5.2 or python3dist(cryptography) > 1.5.2)
python3dist(paramiko)
(python3dist(sqlalchemy) < 1.1~~ with python3dist(sqlalchemy) >= 1.0.10)
python3dist(setuptools) >= 40.8
- | # setuptools < 70
((python3dist(lxml) < 3.7 or python3dist(lxml) > 3.7) with python3dist(lxml) >= 2.3)
python3dist(ncclient)
(python3dist(cryptography) < 1.5.2 or python3dist(cryptography) > 1.5.2)
python3dist(paramiko)
(python3dist(sqlalchemy) < 1.1~~ with python3dist(sqlalchemy) >= 1.0.10)
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
result: 0
@ -850,7 +948,12 @@ Pre-releases are accepted:
"cffi",
]
build-backend = "setuptools.build_meta"
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(wheel)
python3dist(cffi)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(cffi)
@ -869,9 +972,11 @@ Stdout from wrapped subprocess does not appear in output:
os.system('echo LEAK?')
from setuptools import setup
setup(name='test', version='0.1')
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools) >= 40.8
- | # setuptools < 70
python3dist(setuptools) >= 40.8
python3dist(wheel)
python3dist(wheel)
result: 0
@ -892,7 +997,11 @@ pyproject.toml with runtime dependencies:
"foo",
'importlib-metadata; python_version<"3.8"',
]
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(foo)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(foo)
@ -920,7 +1029,13 @@ pyproject.toml with runtime dependencies and partially selected extras:
[project.optional-dependencies]
tests = ["pytest>=5", "pytest-mock"]
docs = ["sphinx", "python-docs-theme"]
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(foo)
python3dist(pytest) >= 5
python3dist(pytest-mock)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(foo)
@ -951,7 +1066,15 @@ Self-referencing extras (sooner):
tests = pytest>=5; pytest-mock
docs = sphinx; python-docs-theme
dev = my_package[docs,tests]
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(foo)
python3dist(sphinx)
python3dist(python-docs-theme)
python3dist(pytest) >= 5
python3dist(pytest-mock)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(foo)
@ -984,7 +1107,15 @@ Self-referencing extras (later):
tests = pytest>=5; pytest-mock
docs = sphinx; python-docs-theme
xdev = my_package[docs,tests]
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(foo)
python3dist(sphinx)
python3dist(python-docs-theme)
python3dist(pytest) >= 5
python3dist(pytest-mock)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(foo)
@ -1016,7 +1147,15 @@ Self-referencing extras (maze):
forward = my_package[backward]; forwarddep
backward = my_package[left,right]; backwarddep
never = my_package[forward]; neverdep
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(backwarddep)
python3dist(forwarddep)
python3dist(leftdep)
python3dist(rightdep)
python3dist(startdep)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(backwarddep)
@ -1081,7 +1220,11 @@ pyproject.toml with runtime dependencies read from it:
"foo",
'importlib-metadata; python_version<"3.8"',
]
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(foo)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(foo)
@ -1095,7 +1238,11 @@ pyproject.toml with extras - only runtime dependencies read from it:
wheel: 1
tomli: 1
pyproject.toml: *pyproject_with_extras
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(foo)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(foo)
@ -1111,7 +1258,13 @@ pyproject.toml with runtime dependencies and partially selected extras read from
extras:
- tests
pyproject.toml: *pyproject_with_extras
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(foo)
python3dist(pytest) >= 5
python3dist(pytest-mock)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(foo)
@ -1130,7 +1283,15 @@ pyproject.toml with runtime dependencies and all extras read from it:
- tests
- docs
pyproject.toml: *pyproject_with_extras
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(foo)
python3dist(pytest) >= 5
python3dist(pytest-mock)
python3dist(sphinx)
python3dist(python-docs-theme)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(foo)
@ -1154,7 +1315,10 @@ pyproject.toml without dependencies:
[project]
name = "my_package"
version = "0.1"
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
result: 0
@ -1242,7 +1406,10 @@ pyproject.toml with dynamic table and no deps:
readme = { file = ["readme.txt"] }
readme.txt: |
nothing interesting here
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
result: 0
@ -1268,7 +1435,16 @@ pyproject.toml with self-referencing extras:
bokeh = ["bokeh", "selenium"]
test = ["contourpy[test-no-images]", "matplotlib", "Pillow"]
test-no-images = ["pytest", "pytest-rerunfailures", "wurlitzer"]
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(numpy) >= 1.23
python3dist(matplotlib)
python3dist(pillow)
python3dist(pytest)
python3dist(pytest-rerunfailures)
python3dist(wurlitzer)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(numpy) >= 1.23
@ -1307,7 +1483,12 @@ pyproject.toml with dependency-groups and build system:
[dependency-groups]
tests = ["pytest>=5", "pytest-mock"]
docs = ["sphinx", "python-docs-theme"]
expected: |
expected:
- | # setuptools 70+
python3dist(setuptools)
python3dist(pytest) >= 5
python3dist(pytest-mock)
- | # setuptools < 70
python3dist(setuptools)
python3dist(wheel)
python3dist(pytest) >= 5