Support PEP 517 list based backend-path
The PEP 517 shows an example backend-path like this: [build-system] # Defined by PEP 518: requires = ["flit"] # Defined by this PEP: build-backend = "local_backend" backend-path = ["backend"] https://www.python.org/dev/peps/pep-0517/#source-trees See that backend-path is a list. Our code previously only supported string path. Obviously a string path is wrong, but we keep it to support projects that have made the mistake, such as flit-core. Add a small integration test for both cases. Note that the new spec files deliberately don't do much, to save CI time.
This commit is contained in:
parent
d719a00b93
commit
290941c5f3
@ -6,7 +6,7 @@ License: MIT
|
|||||||
|
|
||||||
# Keep the version at zero and increment only release
|
# Keep the version at zero and increment only release
|
||||||
Version: 0
|
Version: 0
|
||||||
Release: 30%{?dist}
|
Release: 31%{?dist}
|
||||||
|
|
||||||
# Macro files
|
# Macro files
|
||||||
Source001: macros.pyproject
|
Source001: macros.pyproject
|
||||||
@ -94,6 +94,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
|
|||||||
%license LICENSE
|
%license LICENSE
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Oct 05 2020 Miro Hrončok <mhroncok@redhat.com> - 0-31
|
||||||
|
- Support PEP 517 list based backend-path
|
||||||
|
|
||||||
* Tue Sep 29 2020 Lumír Balhar <lbalhar@redhat.com> - 0-30
|
* Tue Sep 29 2020 Lumír Balhar <lbalhar@redhat.com> - 0-30
|
||||||
- Process RECORD files in %%pyproject_install and remove them
|
- Process RECORD files in %%pyproject_install and remove them
|
||||||
- Support the extras configuration option of tox in %%pyproject_buildrequires -t
|
- Support the extras configuration option of tox in %%pyproject_buildrequires -t
|
||||||
|
@ -185,7 +185,10 @@ def get_backend(requirements):
|
|||||||
|
|
||||||
backend_path = buildsystem_data.get('backend-path')
|
backend_path = buildsystem_data.get('backend-path')
|
||||||
if backend_path:
|
if backend_path:
|
||||||
sys.path.insert(0, backend_path)
|
# PEP 517 example shows the path as a list, but some projects don't follow that
|
||||||
|
if isinstance(backend_path, str):
|
||||||
|
backend_path = [backend_path]
|
||||||
|
sys.path = backend_path + sys.path
|
||||||
|
|
||||||
module_name, _, object_name = backend_name.partition(":")
|
module_name, _, object_name = backend_name.partition(":")
|
||||||
backend_module = importlib.import_module(module_name)
|
backend_module = importlib.import_module(module_name)
|
||||||
|
43
tests/python-flit-core.spec
Normal file
43
tests/python-flit-core.spec
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
Name: python-flit-core
|
||||||
|
Version: 3.0.0
|
||||||
|
Release: 0%{?dist}
|
||||||
|
Summary: Distribution-building parts of Flit
|
||||||
|
|
||||||
|
License: BSD
|
||||||
|
URL: https://pypi.org/project/flit-core/
|
||||||
|
Source0: %{pypi_source flit_core}
|
||||||
|
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: pyproject-rpm-macros
|
||||||
|
|
||||||
|
%description
|
||||||
|
Test a build with pyproject.toml backend-path = .
|
||||||
|
flit-core builds with flit-core.
|
||||||
|
|
||||||
|
|
||||||
|
%package -n python3-flit-core
|
||||||
|
Summary: %{summary}
|
||||||
|
|
||||||
|
%description -n python3-flit-core
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1 -n flit_core-%{version}
|
||||||
|
|
||||||
|
|
||||||
|
%generate_buildrequires
|
||||||
|
%pyproject_buildrequires
|
||||||
|
|
||||||
|
|
||||||
|
%build
|
||||||
|
%pyproject_wheel
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
%pyproject_install
|
||||||
|
%pyproject_save_files flit_core
|
||||||
|
|
||||||
|
|
||||||
|
%files -n python3-flit-core -f %{pyproject_files}
|
45
tests/python-poetry-core.spec
Normal file
45
tests/python-poetry-core.spec
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
Name: python-poetry-core
|
||||||
|
Version: 1.0.0
|
||||||
|
Release: 0%{?dist}
|
||||||
|
Summary: Poetry PEP 517 Build Backend
|
||||||
|
|
||||||
|
License: MIT
|
||||||
|
URL: https://pypi.org/project/poetry-core/
|
||||||
|
Source0: %{pypi_source poetry-core}
|
||||||
|
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRequires: python3-devel
|
||||||
|
BuildRequires: pyproject-rpm-macros
|
||||||
|
|
||||||
|
%description
|
||||||
|
Test a build with pyproject.toml backend-path = [.]
|
||||||
|
poetry-core builds with poetry-core.
|
||||||
|
|
||||||
|
|
||||||
|
%package -n python3-poetry-core
|
||||||
|
Summary: %{summary}
|
||||||
|
|
||||||
|
%description -n python3-poetry-core
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -p1 -n poetry-core-%{version}
|
||||||
|
|
||||||
|
|
||||||
|
%generate_buildrequires
|
||||||
|
%pyproject_buildrequires
|
||||||
|
|
||||||
|
|
||||||
|
%build
|
||||||
|
%pyproject_wheel
|
||||||
|
|
||||||
|
|
||||||
|
%install
|
||||||
|
%pyproject_install
|
||||||
|
%pyproject_save_files poetry
|
||||||
|
|
||||||
|
|
||||||
|
%files -n python3-poetry-core -f %{pyproject_files}
|
||||||
|
%doc README.md
|
||||||
|
%license LICENSE
|
@ -67,6 +67,12 @@
|
|||||||
- dns_lexicon:
|
- dns_lexicon:
|
||||||
dir: .
|
dir: .
|
||||||
run: ./mocktest.sh python-dns-lexicon
|
run: ./mocktest.sh python-dns-lexicon
|
||||||
|
- flit_core:
|
||||||
|
dir: .
|
||||||
|
run: ./mocktest.sh python-flit-core
|
||||||
|
- poetry_core:
|
||||||
|
dir: .
|
||||||
|
run: ./mocktest.sh python-poetry-core
|
||||||
required_packages:
|
required_packages:
|
||||||
- mock
|
- mock
|
||||||
- rpmdevtools
|
- rpmdevtools
|
||||||
|
Loading…
Reference in New Issue
Block a user