diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index f6617f1..1c9e5fa 100644 --- a/pyproject-rpm-macros.spec +++ b/pyproject-rpm-macros.spec @@ -6,7 +6,7 @@ License: MIT # Keep the version at zero and increment only release Version: 0 -Release: 30%{?dist} +Release: 31%{?dist} # Macro files Source001: macros.pyproject @@ -94,6 +94,9 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856 %license LICENSE %changelog +* Mon Oct 05 2020 Miro Hrončok - 0-31 +- Support PEP 517 list based backend-path + * Tue Sep 29 2020 Lumír Balhar - 0-30 - Process RECORD files in %%pyproject_install and remove them - Support the extras configuration option of tox in %%pyproject_buildrequires -t diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index a34c9e2..4946240 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -185,7 +185,10 @@ def get_backend(requirements): backend_path = buildsystem_data.get('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(":") backend_module = importlib.import_module(module_name) diff --git a/tests/python-flit-core.spec b/tests/python-flit-core.spec new file mode 100644 index 0000000..45df12b --- /dev/null +++ b/tests/python-flit-core.spec @@ -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} diff --git a/tests/python-poetry-core.spec b/tests/python-poetry-core.spec new file mode 100644 index 0000000..5a5af4d --- /dev/null +++ b/tests/python-poetry-core.spec @@ -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 diff --git a/tests/tests.yml b/tests/tests.yml index 65ed9fc..5441de8 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -67,6 +67,12 @@ - dns_lexicon: dir: . 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: - mock - rpmdevtools