Only require toml for projects with pyproject.toml
Pros: - projects without pyproject.toml will have 1 less dependency - toml will be buildable with pyproject-rpm-macros out of the box - easier bootstrap sequence (in theory) Cons: - projects with pyproject.toml will have 1 more %generate_buildrequires round
This commit is contained in:
parent
1e199ca6f4
commit
b4fd1c2e74
@ -74,7 +74,6 @@ fi
|
||||
echo 'python%{python3_pkgversion}-devel'
|
||||
echo 'python%{python3_pkgversion}dist(pip) >= 19'
|
||||
echo 'python%{python3_pkgversion}dist(packaging)'
|
||||
echo 'python%{python3_pkgversion}dist(toml)'
|
||||
# The first part is for cases when %%{python3_version_nodots} is not yet available
|
||||
if [ ! -z "%{?python3_version_nodots}" ] && [ %{python3_version_nodots} -lt 38 ]; then
|
||||
echo 'python%{python3_pkgversion}dist(importlib-metadata)'
|
||||
|
@ -90,6 +90,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
|
||||
%changelog
|
||||
* Fri Sep 4 2020 Miro Hrončok <miro@hroncok.cz> - 0-27
|
||||
- Make code in $PWD importable from %%pyproject_buildrequires
|
||||
- Only require toml for projects with pyproject.toml
|
||||
|
||||
* Mon Aug 24 2020 Tomas Hrnciar <thrnciar@redhat.com> - 0-26
|
||||
- Implement automatic detection of %%lang files in %%pyproject_save_files
|
||||
|
@ -23,7 +23,6 @@ class EndPass(Exception):
|
||||
|
||||
|
||||
try:
|
||||
import toml
|
||||
from packaging.requirements import Requirement, InvalidRequirement
|
||||
from packaging.utils import canonicalize_name, canonicalize_version
|
||||
try:
|
||||
@ -154,6 +153,10 @@ def get_backend(requirements):
|
||||
except FileNotFoundError:
|
||||
pyproject_data = {}
|
||||
else:
|
||||
# lazy import toml here, not needed without pyproject.toml
|
||||
requirements.add('toml', source='parsing pyproject.toml')
|
||||
requirements.check(source='parsing pyproject.toml')
|
||||
import toml
|
||||
with f:
|
||||
pyproject_data = toml.load(f)
|
||||
|
||||
|
@ -12,22 +12,23 @@ Nothing installed yet:
|
||||
pyproject.toml: |
|
||||
# empty
|
||||
expected: |
|
||||
python3dist(setuptools) >= 40.8
|
||||
python3dist(wheel)
|
||||
python3dist(toml)
|
||||
result: 0
|
||||
|
||||
Insufficient version of setuptools:
|
||||
installed:
|
||||
setuptools: 5
|
||||
wheel: 1
|
||||
toml: 1
|
||||
pyproject.toml: |
|
||||
# empty
|
||||
expected: |
|
||||
python3dist(toml)
|
||||
python3dist(setuptools) >= 40.8
|
||||
python3dist(wheel)
|
||||
result: 0
|
||||
|
||||
Empty pyproject.toml, empty setup.py:
|
||||
No pyproject.toml, empty setup.py:
|
||||
installed:
|
||||
setuptools: 50
|
||||
wheel: 1
|
||||
@ -42,10 +43,12 @@ Default build system, empty setup.py:
|
||||
installed:
|
||||
setuptools: 50
|
||||
wheel: 1
|
||||
toml: 1
|
||||
pyproject.toml: |
|
||||
# empty
|
||||
setup.py: |
|
||||
expected: |
|
||||
python3dist(toml)
|
||||
python3dist(setuptools) >= 40.8
|
||||
python3dist(wheel)
|
||||
python3dist(wheel)
|
||||
@ -60,7 +63,8 @@ Erroring setup.py:
|
||||
result: 77
|
||||
|
||||
Bad character in version:
|
||||
installed: {}
|
||||
installed:
|
||||
toml: 1
|
||||
pyproject.toml: |
|
||||
[build-system]
|
||||
requires = ["pkg == 0.$.^.*"]
|
||||
@ -71,6 +75,7 @@ Build system dependencies in pyproject.toml with extras:
|
||||
installed:
|
||||
setuptools: 50
|
||||
wheel: 1
|
||||
toml: 1
|
||||
pyproject.toml: |
|
||||
[build-system]
|
||||
requires = [
|
||||
@ -88,6 +93,7 @@ Build system dependencies in pyproject.toml with extras:
|
||||
"py3 ; python_version > '3.0'",
|
||||
]
|
||||
expected: |
|
||||
python3dist(toml)
|
||||
python3dist(foo)
|
||||
python3dist(bar) > 5
|
||||
python3dist(bar[baz]) > 5
|
||||
@ -110,6 +116,7 @@ Build system dependencies in pyproject.toml without extras:
|
||||
installed:
|
||||
setuptools: 50
|
||||
wheel: 1
|
||||
toml: 1
|
||||
pyproject.toml: |
|
||||
[build-system]
|
||||
requires = [
|
||||
@ -117,6 +124,7 @@ Build system dependencies in pyproject.toml without extras:
|
||||
"multi[extras1,extras2] == 6.0",
|
||||
]
|
||||
expected: |
|
||||
python3dist(toml)
|
||||
python3dist(bar) > 5
|
||||
python3dist(multi) == 6
|
||||
python3dist(setuptools) >= 40.8
|
||||
|
Loading…
Reference in New Issue
Block a user