2019-07-02 12:41:04 +02:00
|
|
|
Name: pyproject-rpm-macros
|
2019-07-02 16:53:05 +02:00
|
|
|
Summary: RPM macros for PEP 517 Python packages
|
2019-07-02 12:41:04 +02:00
|
|
|
License: MIT
|
2019-07-02 16:53:05 +02:00
|
|
|
|
2023-05-19 22:01:17 +02:00
|
|
|
%bcond tests 1
|
2023-05-23 11:04:33 +02:00
|
|
|
# pytest-xdist and tox are not desired in RHEL
|
2023-05-19 22:01:17 +02:00
|
|
|
%bcond pytest_xdist %{undefined rhel}
|
2023-05-23 11:04:33 +02:00
|
|
|
%bcond tox_tests %{undefined rhel}
|
2019-07-17 17:34:24 +02:00
|
|
|
|
2022-01-25 16:57:17 +01:00
|
|
|
# The idea is to follow the spirit of semver
|
|
|
|
# Given version X.Y.Z:
|
|
|
|
# Increment X and reset Y.Z when there is a *major* incompatibility
|
|
|
|
# Increment Y and reset Z when new macros or features are added
|
|
|
|
# Increment Z when this is a bugfix or a cosmetic change
|
|
|
|
# Dropping support for EOL Fedoras is *not* considered a breaking change
|
2024-01-25 17:08:50 +01:00
|
|
|
Version: 1.12.0
|
|
|
|
Release: 1%{?dist}
|
2019-07-02 16:53:05 +02:00
|
|
|
|
2020-04-15 16:44:04 +02:00
|
|
|
# Macro files
|
|
|
|
Source001: macros.pyproject
|
2023-01-06 13:41:07 +01:00
|
|
|
Source002: macros.aaa-pyproject-srpm
|
2019-07-02 16:53:05 +02:00
|
|
|
|
2020-04-15 16:44:04 +02:00
|
|
|
# Implementation files
|
|
|
|
Source101: pyproject_buildrequires.py
|
|
|
|
Source102: pyproject_save_files.py
|
2020-09-09 06:47:51 +02:00
|
|
|
Source103: pyproject_convert.py
|
2020-09-15 08:55:44 +02:00
|
|
|
Source104: pyproject_preprocess_record.py
|
2020-11-03 11:29:50 +01:00
|
|
|
Source105: pyproject_construct_toxenv.py
|
2021-07-22 12:01:48 +02:00
|
|
|
Source106: pyproject_requirements_txt.py
|
2022-04-22 16:48:09 +02:00
|
|
|
Source107: pyproject_wheel.py
|
2019-07-02 16:53:05 +02:00
|
|
|
|
2020-04-15 16:44:04 +02:00
|
|
|
# Tests
|
|
|
|
Source201: test_pyproject_buildrequires.py
|
|
|
|
Source202: test_pyproject_save_files.py
|
2021-07-22 12:01:48 +02:00
|
|
|
Source203: test_pyproject_requirements_txt.py
|
2022-01-17 17:20:54 +01:00
|
|
|
Source204: compare_mandata.py
|
2020-04-15 16:44:04 +02:00
|
|
|
|
|
|
|
# Test data
|
|
|
|
Source301: pyproject_buildrequires_testcases.yaml
|
|
|
|
Source302: pyproject_save_files_test_data.yaml
|
|
|
|
Source303: test_RECORD
|
|
|
|
|
|
|
|
# Metadata
|
|
|
|
Source901: README.md
|
|
|
|
Source902: LICENSE
|
2019-07-17 15:44:22 +02:00
|
|
|
|
2019-07-02 13:05:10 +02:00
|
|
|
URL: https://src.fedoraproject.org/rpms/pyproject-rpm-macros
|
2019-07-02 16:53:05 +02:00
|
|
|
|
2019-07-02 12:41:04 +02:00
|
|
|
BuildArch: noarch
|
|
|
|
|
2019-07-17 17:34:24 +02:00
|
|
|
%if %{with tests}
|
2024-05-21 13:03:30 +02:00
|
|
|
BuildRequires: %{python_module pytest}
|
2023-05-19 22:01:17 +02:00
|
|
|
%if %{with pytest_xdist}
|
2024-05-21 13:03:30 +02:00
|
|
|
BuildRequires: %{python_module pytest-xdist}
|
2023-05-19 22:01:17 +02:00
|
|
|
%endif
|
2024-05-21 13:03:30 +02:00
|
|
|
BuildRequires: %{python_module PyYAML}
|
|
|
|
BuildRequires: %{python_module packaging}
|
|
|
|
BuildRequires: %{python_module pip}
|
|
|
|
BuildRequires: %{python_module setuptools}
|
2023-05-23 11:04:33 +02:00
|
|
|
%if %{with tox_tests}
|
2024-05-21 13:03:30 +02:00
|
|
|
BuildRequires: %{python_module tox-current-env}
|
2023-05-23 11:04:33 +02:00
|
|
|
%endif
|
2024-05-21 13:03:30 +02:00
|
|
|
BuildRequires: %{python_module wheel}
|
|
|
|
BuildRequires: %{python_module tomli}
|
2019-07-17 17:34:24 +02:00
|
|
|
%endif
|
2019-07-17 15:44:22 +02:00
|
|
|
|
2021-07-17 15:05:33 +02:00
|
|
|
# We build on top of those:
|
2022-07-14 06:09:15 +02:00
|
|
|
BuildRequires: python-rpm-macros
|
|
|
|
BuildRequires: python3-rpm-macros
|
2022-07-14 06:07:47 +02:00
|
|
|
Requires: python-rpm-macros
|
|
|
|
Requires: python3-rpm-macros
|
2023-01-06 13:41:07 +01:00
|
|
|
Requires: (pyproject-srpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} if pyproject-srpm-macros)
|
2021-07-17 15:05:33 +02:00
|
|
|
|
2021-12-10 12:38:37 +01:00
|
|
|
# We use the following tools outside of coreutils
|
2022-07-14 06:07:47 +02:00
|
|
|
Requires: /usr/bin/find
|
|
|
|
Requires: /usr/bin/sed
|
2019-07-17 15:44:22 +02:00
|
|
|
|
2023-09-05 16:10:50 +02:00
|
|
|
# This package requires the %%generate_buildrequires functionality.
|
|
|
|
# It has been introduced in RPM 4.15 (4.14.90 is the alpha of 4.15).
|
|
|
|
# What we need is rpmlib(DynamicBuildRequires), but that is impossible to (Build)Require.
|
|
|
|
Requires: (rpm-build >= 4.14.90 if rpm-build)
|
|
|
|
BuildRequires: rpm-build >= 4.14.90
|
|
|
|
|
2019-07-02 12:41:04 +02:00
|
|
|
%description
|
2021-01-15 18:47:11 +01:00
|
|
|
These macros allow projects that follow the Python packaging specifications
|
|
|
|
to be packaged as RPMs.
|
|
|
|
|
|
|
|
They work for:
|
|
|
|
|
|
|
|
* traditional Setuptools-based projects that use the setup.py file,
|
|
|
|
* newer Setuptools-based projects that have a setup.cfg file,
|
|
|
|
* general Python projects that use the PEP 517 pyproject.toml file
|
|
|
|
(which allows using any build system, such as setuptools, flit or poetry).
|
|
|
|
|
|
|
|
These macros replace %%py3_build and %%py3_install,
|
|
|
|
which only work with setup.py.
|
2019-07-02 12:41:04 +02:00
|
|
|
|
2019-07-02 16:53:05 +02:00
|
|
|
|
2023-01-06 13:41:07 +01:00
|
|
|
%package -n pyproject-srpm-macros
|
|
|
|
Summary: Minimal implementation of %%pyproject_buildrequires
|
|
|
|
Requires: (pyproject-rpm-macros = %{?epoch:%{epoch}:}%{version}-%{release} if pyproject-rpm-macros)
|
2023-09-05 16:10:50 +02:00
|
|
|
Requires: (rpm-build >= 4.14.90 if rpm-build)
|
2023-01-06 13:41:07 +01:00
|
|
|
|
|
|
|
%description -n pyproject-srpm-macros
|
|
|
|
This package contains a minimal implementation of %%pyproject_buildrequires.
|
|
|
|
When used in %%generate_buildrequires, it will generate BuildRequires
|
|
|
|
for pyproject-rpm-macros. When both packages are installed, the full version
|
|
|
|
takes precedence.
|
|
|
|
|
|
|
|
|
2019-07-02 12:41:04 +02:00
|
|
|
%prep
|
2019-07-02 13:40:47 +02:00
|
|
|
# Not strictly necessary but allows working on file names instead
|
|
|
|
# of source numbers in install section
|
|
|
|
%setup -c -T
|
|
|
|
cp -p %{sources} .
|
2019-07-02 12:41:04 +02:00
|
|
|
|
2023-09-05 16:10:50 +02:00
|
|
|
%generate_buildrequires
|
|
|
|
# nothing to do, this is here just to assert we have that functionality
|
|
|
|
|
2019-07-02 12:41:04 +02:00
|
|
|
%build
|
|
|
|
# nothing to do, sources are not buildable
|
|
|
|
|
|
|
|
%install
|
2019-07-02 16:53:05 +02:00
|
|
|
mkdir -p %{buildroot}%{_rpmmacrodir}
|
2024-05-21 13:03:30 +02:00
|
|
|
mkdir -p %{buildroot}%{_rpmconfigdir}/suse
|
2022-07-14 06:10:35 +02:00
|
|
|
install -pm 644 macros.pyproject %{buildroot}%{_rpmmacrodir}/
|
2023-01-06 13:41:07 +01:00
|
|
|
install -pm 644 macros.aaa-pyproject-srpm %{buildroot}%{_rpmmacrodir}/
|
2024-05-21 13:03:30 +02:00
|
|
|
install -pm 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/suse/
|
|
|
|
install -pm 644 pyproject_convert.py %{buildroot}%{_rpmconfigdir}/suse/
|
|
|
|
install -pm 644 pyproject_save_files.py %{buildroot}%{_rpmconfigdir}/suse/
|
|
|
|
install -pm 644 pyproject_preprocess_record.py %{buildroot}%{_rpmconfigdir}/suse/
|
|
|
|
install -pm 644 pyproject_construct_toxenv.py %{buildroot}%{_rpmconfigdir}/suse/
|
|
|
|
install -pm 644 pyproject_requirements_txt.py %{buildroot}%{_rpmconfigdir}/suse/
|
|
|
|
install -pm 644 pyproject_wheel.py %{buildroot}%{_rpmconfigdir}/suse/
|
2019-07-02 12:41:04 +02:00
|
|
|
|
2019-07-17 15:44:22 +02:00
|
|
|
%check
|
2023-05-23 12:14:31 +02:00
|
|
|
# assert the two signatures of %%pyproject_buildrequires match exactly
|
|
|
|
signature1="$(grep '^%%pyproject_buildrequires' macros.pyproject | cut -d' ' -f1)"
|
|
|
|
signature2="$(grep '^%%pyproject_buildrequires' macros.aaa-pyproject-srpm | cut -d' ' -f1)"
|
|
|
|
test "$signature1" == "$signature2"
|
|
|
|
# but also assert we are not comparing empty strings
|
|
|
|
test "$signature1" != ""
|
|
|
|
|
|
|
|
%if %{with tests}
|
2020-07-15 12:15:19 +02:00
|
|
|
export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856356
|
2023-05-23 11:04:33 +02:00
|
|
|
%pytest -vv --doctest-modules %{?with_pytest_xdist:-n auto} %{!?with_tox_tests:-k "not tox"}
|
2022-01-17 17:20:54 +01:00
|
|
|
|
2024-05-21 13:16:26 +02:00
|
|
|
python3 compare_mandata.py -f %{_rpmconfigdir}/brp-compress
|
2019-07-17 17:34:24 +02:00
|
|
|
%endif
|
2019-07-17 15:44:22 +02:00
|
|
|
|
|
|
|
|
2019-07-02 12:41:04 +02:00
|
|
|
%files
|
|
|
|
%{_rpmmacrodir}/macros.pyproject
|
2024-05-21 13:03:30 +02:00
|
|
|
%{_rpmconfigdir}/suse/pyproject_buildrequires.py
|
|
|
|
%{_rpmconfigdir}/suse/pyproject_convert.py
|
|
|
|
%{_rpmconfigdir}/suse/pyproject_save_files.py
|
|
|
|
%{_rpmconfigdir}/suse/pyproject_preprocess_record.py
|
|
|
|
%{_rpmconfigdir}/suse/pyproject_construct_toxenv.py
|
|
|
|
%{_rpmconfigdir}/suse/pyproject_requirements_txt.py
|
|
|
|
%{_rpmconfigdir}/suse/pyproject_wheel.py
|
2019-07-02 12:41:04 +02:00
|
|
|
|
|
|
|
%doc README.md
|
|
|
|
%license LICENSE
|
|
|
|
|
2023-01-06 13:41:07 +01:00
|
|
|
%files -n pyproject-srpm-macros
|
|
|
|
%{_rpmmacrodir}/macros.aaa-pyproject-srpm
|
|
|
|
%license LICENSE
|
|
|
|
|
|
|
|
|
2024-05-21 13:03:30 +02:00
|
|
|
%changelog
|