diff --git a/pyproject-rpm-macros.spec b/pyproject-rpm-macros.spec index 3590d4e..6997652 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: 11%{?dist} +Release: 12%{?dist} Source0: macros.pyproject Source1: pyproject_buildrequires.py @@ -87,6 +87,10 @@ install -m 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/redhat/ %license LICENSE %changelog +* Wed Feb 05 2020 Miro HronĨok - 0-12 +- Fallback to setuptools.build_meta:__legacy__ backend instead of setuptools.build_meta +- Properly handle backends with colon + * Thu Jan 30 2020 Fedora Release Engineering - 0-11 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/pyproject_buildrequires.py b/pyproject_buildrequires.py index fa6a8c4..aa87481 100644 --- a/pyproject_buildrequires.py +++ b/pyproject_buildrequires.py @@ -139,18 +139,29 @@ def get_backend(requirements): backend_name = buildsystem_data.get('build-backend') if not backend_name: + # https://www.python.org/dev/peps/pep-0517/: + # If the pyproject.toml file is absent, or the build-backend key is + # missing, the source tree is not using this specification, and tools + # should revert to the legacy behaviour of running setup.py + # (either directly, or by implicitly invoking the [following] backend). + backend_name = 'setuptools.build_meta:__legacy__' + requirements.add('setuptools >= 40.8', source='default build backend') requirements.add('wheel', source='default build backend') - backend_name = 'setuptools.build_meta' - requirements.check(source='build backend') backend_path = buildsystem_data.get('backend-path') if backend_path: sys.path.insert(0, backend_path) - return importlib.import_module(backend_name) + module_name, _, object_name = backend_name.partition(":") + backend_module = importlib.import_module(module_name) + + if object_name: + return getattr(backend_module, object_name) + + return backend_module def generate_build_requirements(backend, requirements):