Blame SPECS/pyproject-rpm-macros.spec

838e4d
Name:           pyproject-rpm-macros
838e4d
Summary:        RPM macros for PEP 517 Python packages
838e4d
License:        MIT
838e4d
838e4d
# Disable tests on RHEL9 as to not pull in the test dependencies
838e4d
# Specify --with tests to run the tests e.g. on EPEL
838e4d
%bcond_with tests
838e4d
98862f
# The idea is to follow the spirit of semver
98862f
# Given version X.Y.Z:
98862f
#   Increment X and reset Y.Z when there is a *major* incompatibility
98862f
#   Increment Y and reset Z when new macros or features are added
98862f
#   Increment Z when this is a bugfix or a cosmetic change
98862f
# Dropping support for EOL Fedoras is *not* considered a breaking change
557ab5
Version:        1.3.3
98862f
Release:        1%{?dist}
838e4d
838e4d
# Macro files
838e4d
Source001:      macros.pyproject
838e4d
838e4d
# Implementation files
838e4d
Source101:      pyproject_buildrequires.py
838e4d
Source102:      pyproject_save_files.py
838e4d
Source103:      pyproject_convert.py
838e4d
Source104:      pyproject_preprocess_record.py
838e4d
Source105:      pyproject_construct_toxenv.py
838e4d
Source106:      pyproject_requirements_txt.py
557ab5
Source107:      pyproject_wheel.py
838e4d
838e4d
# Tests
838e4d
Source201:      test_pyproject_buildrequires.py
838e4d
Source202:      test_pyproject_save_files.py
838e4d
Source203:      test_pyproject_requirements_txt.py
98862f
Source204:      compare_mandata.py
838e4d
838e4d
# Test data
838e4d
Source301:      pyproject_buildrequires_testcases.yaml
838e4d
Source302:      pyproject_save_files_test_data.yaml
838e4d
Source303:      test_RECORD
838e4d
838e4d
# Metadata
838e4d
Source901:      README.md
838e4d
Source902:      LICENSE
838e4d
838e4d
URL:            https://src.fedoraproject.org/rpms/pyproject-rpm-macros
838e4d
838e4d
BuildArch:      noarch
838e4d
838e4d
%if %{with tests}
557ab5
BuildRequires:  python3dist(pytest)
557ab5
BuildRequires:  python3dist(pyyaml)
557ab5
BuildRequires:  python3dist(packaging)
557ab5
BuildRequires:  python3dist(pip)
557ab5
BuildRequires:  python3dist(setuptools)
557ab5
BuildRequires:  python3dist(tox-current-env) >= 0.0.6
557ab5
BuildRequires:  python3dist(wheel)
557ab5
BuildRequires:  (python3dist(toml) if python3-devel < 3.11)
838e4d
%endif
838e4d
838e4d
# We build on top of those:
557ab5
BuildRequires:  python-rpm-macros
557ab5
BuildRequires:  python-srpm-macros
557ab5
BuildRequires:  python3-rpm-macros
557ab5
Requires:       python-rpm-macros
557ab5
Requires:       python-srpm-macros
557ab5
Requires:       python3-rpm-macros
838e4d
98862f
# We use the following tools outside of coreutils
557ab5
Requires:       /usr/bin/find
557ab5
Requires:       /usr/bin/sed
838e4d
838e4d
%description
838e4d
These macros allow projects that follow the Python packaging specifications
838e4d
to be packaged as RPMs.
838e4d
838e4d
They work for:
838e4d
838e4d
* traditional Setuptools-based projects that use the setup.py file,
838e4d
* newer Setuptools-based projects that have a setup.cfg file,
838e4d
* general Python projects that use the PEP 517 pyproject.toml file
838e4d
  (which allows using any build system, such as setuptools, flit or poetry).
838e4d
838e4d
These macros replace %%py3_build and %%py3_install,
838e4d
which only work with setup.py.
838e4d
838e4d
838e4d
%prep
838e4d
# Not strictly necessary but allows working on file names instead
838e4d
# of source numbers in install section
838e4d
%setup -c -T
838e4d
cp -p %{sources} .
838e4d
838e4d
%build
838e4d
# nothing to do, sources are not buildable
838e4d
838e4d
%install
838e4d
mkdir -p %{buildroot}%{_rpmmacrodir}
838e4d
mkdir -p %{buildroot}%{_rpmconfigdir}/redhat
557ab5
install -pm 644 macros.pyproject %{buildroot}%{_rpmmacrodir}/
557ab5
install -pm 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/redhat/
557ab5
install -pm 644 pyproject_convert.py %{buildroot}%{_rpmconfigdir}/redhat/
557ab5
install -pm 644 pyproject_save_files.py  %{buildroot}%{_rpmconfigdir}/redhat/
557ab5
install -pm 644 pyproject_preprocess_record.py %{buildroot}%{_rpmconfigdir}/redhat/
557ab5
install -pm 644 pyproject_construct_toxenv.py %{buildroot}%{_rpmconfigdir}/redhat/
557ab5
install -pm 644 pyproject_requirements_txt.py %{buildroot}%{_rpmconfigdir}/redhat/
557ab5
install -pm 644 pyproject_wheel.py %{buildroot}%{_rpmconfigdir}/redhat/
838e4d
838e4d
%if %{with tests}
838e4d
%check
838e4d
export HOSTNAME="rpmbuild"  # to speedup tox in network-less mock, see rhbz#1856356
557ab5
%pytest -vv --doctest-modules
98862f
98862f
# brp-compress is provided as an argument to get the right directory macro expansion
98862f
%{python3} compare_mandata.py -f %{_rpmconfigdir}/brp-compress
838e4d
%endif
838e4d
838e4d
838e4d
%files
838e4d
%{_rpmmacrodir}/macros.pyproject
838e4d
%{_rpmconfigdir}/redhat/pyproject_buildrequires.py
838e4d
%{_rpmconfigdir}/redhat/pyproject_convert.py
838e4d
%{_rpmconfigdir}/redhat/pyproject_save_files.py
838e4d
%{_rpmconfigdir}/redhat/pyproject_preprocess_record.py
838e4d
%{_rpmconfigdir}/redhat/pyproject_construct_toxenv.py
838e4d
%{_rpmconfigdir}/redhat/pyproject_requirements_txt.py
557ab5
%{_rpmconfigdir}/redhat/pyproject_wheel.py
838e4d
838e4d
%doc README.md
838e4d
%license LICENSE
838e4d
838e4d
%changelog
557ab5
* Tue Aug 09 2022 Karolina Surma <ksurma@redhat.com> - 1.3.3-1
557ab5
- Don't fail %%pyproject_save_files '*' if no modules are detected
557ab5
557ab5
* Wed Jun 15 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 1.3.2-1
557ab5
- Update %%pyproject_build_lib to support setuptools 62.1.0 and later
557ab5
- %%pyproject_buildrequires: When extension modules are built,
557ab5
  support https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects
557ab5
557ab5
* Fri May 27 2022 Owen Taylor <otaylor@redhat.com> - 1.3.1-1
557ab5
- %%pyproject_install: pass %%{_prefix} explicitly to pip install
557ab5
557ab5
* Thu May 12 2022 Miro Hrončok <mhroncok@redhat.com> - 1.3.0-1
557ab5
- Use tomllib from the standard library on Python 3.11+
557ab5
557ab5
* Wed Apr 27 2022 Miro Hrončok <mhroncok@redhat.com> - 1.2.0-1
557ab5
- %%pyproject_buildrequires: Add provisional -w flag for build backends without
557ab5
  prepare_metadata_for_build_wheel hook
557ab5
  When used, the wheel is built in %%pyproject_buildrequires
557ab5
  and information about runtime requires and extras is read from that wheel.
557ab5
557ab5
* Tue Apr 12 2022 Miro Hrončok <mhroncok@redhat.com> - 1.1.0-1
557ab5
- %%pyproject_save_files: Support nested directories in dist-info
557ab5
557ab5
* Tue Mar 22 2022 Miro Hrončok <mhroncok@redhat.com> - 1.0.1-1
557ab5
- Prefix paths of intermediate files (such as %%{pyproject_files}) with NVRA
557ab5
557ab5
* Tue Mar 01 2022 Miro Hrončok <mhroncok@redhat.com> - 1.0.0-1
557ab5
- Release final version 1.0.0
557ab5
557ab5
* Mon Feb 07 2022 Lumír Balhar <lbalhar@redhat.com> - 1.0.0~rc2-1
557ab5
- Updated compatibility with tox4
557ab5
98862f
* Tue Jan 25 2022 Miro Hrončok <mhroncok@redhat.com> - 1.0.0~rc1-1
98862f
- Release version 1.0.0, first release candidate
98862f
98862f
* Mon Jan 24 2022 Miro Hrončok <mhroncok@redhat.com> - 0-55
98862f
- %%pyproject_buildrequires: Generate BuildRequires for this package
98862f
  This package is already installed, but this way, the resulting SRPM explicitly BuildRequires it
98862f
98862f
* Wed Jan 19 2022 Karolina Surma <ksurma@redhat.com> - 0-54
98862f
- Include compressed manpages to the package if flag '+auto' is provided to %%pyproject_save_files
98862f
98862f
* Fri Jan 14 2022 Miro Hrončok <mhroncok@redhat.com> - 0-53
98862f
- %%pyproject_buildrequires: Make -r (include runtime) the default, use -R to opt-out
98862f
98862f
* Sun Dec 19 2021 Gordon Messmer <gordon.messmer@gmail.com> - 0-52
98862f
- Handle legacy version specifiers that would previously raise exceptions.
98862f
98862f
* Wed Dec 08 2021 Miro Hrončok <mhroncok@redhat.com> - 0-51
98862f
- Define provisional %%pyproject_build_lib
98862f
98862f
* Mon Nov 1 2021 Gordon Messmer <gordon.messmer@gmail.com> - 0-50
98862f
- Improve handling of > operator, preventing post-release from satisfying most rpm requirements
98862f
- Improve handling of < operator, preventing pre-release from satisfying rpm requirement
98862f
- Improve handling of != operator with prefix matching, preventing pre-release from satisfying rpm requirements
98862f
98862f
* Tue Oct 19 2021 Karolina Surma <ksurma@redhat.com> - 0-49
98862f
- %%pyproject_save_files: Save %%_pyproject_modules file with importable module names
98862f
- Introduce %%pyproject_check_import which passes %%_pyproject_modules to %%py3_check_import
98862f
- Introduce -t, -e filtering options to %%pyproject_check_import
98862f
98862f
* Sat Oct 16 2021 Miro Hrončok <mhroncok@redhat.com> - 0-48
98862f
- %%pyproject_buildrequires: Accept installed pre-releases for all requirements
98862f
98862f
* Thu Sep 09 2021 Miro Hrončok <mhroncok@redhat.com> - 0-47
98862f
- %%pyproject_save_files: Expand the namespace error message, also display it with /
98862f
- %%pyproject_save_files: Add a workaround error for spaces and [brackets]
98862f
838e4d
* Fri Jul 23 2021 Miro Hrončok <miro@hroncok.cz> - 0-46
838e4d
- %%pyproject_buildrequires now fails when it encounters an invalid requirement
838e4d
- Rename %%_pyproject_ghost_distinfo and %%_pyproject_record to indicate they are private
838e4d
- Automatically detect LICENSE files and mark them with %%license macro
838e4d
838e4d
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0-45
838e4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
838e4d
838e4d
* Fri Jul 09 2021 Python Maint <python-maint@redhat.com> - 0-44
838e4d
- Escape weird paths generated by %%pyproject_save_files
838e4d
- Support x.* versions in %%pyproject_buildrequires
838e4d
- %%pyproject_buildrequires fallbacks to setuptools only if setup.py exists
838e4d
- Explicitly require the "basic" Python RPM macros
838e4d
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
838e4d
  Related: rhbz#1991688
838e4d
838e4d
* Thu Jul 01 2021 Tomas Hrnciar <thrnciar@redhat.com> - 0-43
838e4d
- Generate BuildRequires from file
838e4d
838e4d
* Tue Jun 29 2021 Miro Hrončok <mhroncok@redhat.com> - 0-42
838e4d
- Don't accidentally treat "~= X.0" requirement as "~= X"
838e4d
- Fixes rhzb#1977060
838e4d
838e4d
* Mon Jun 28 2021 Miro Hrončok <mhroncok@redhat.com> - 0-41
838e4d
- Don't leak %%{_pyproject_builddir} to pytest collection
838e4d
838e4d
* Thu May 27 2021 Miro Hrončok <mhroncok@redhat.com> - 0-40
838e4d
- Don't leak $TMPDIR outside of pyproject macros
838e4d
- Set %%_pyproject_wheeldir and %%_pyproject_builddir relative to the source tree, not $PWD
838e4d
838e4d
* Thu Apr 22 2021 Miro Hrončok <mhroncok@redhat.com> - 0-39.2
838e4d
- Handle tox provision (tox.requires / tox.minversion)
838e4d
- Generate BuildRequires on extras in lower case
838e4d
- Fixes: rhbz#1947074
838e4d
838e4d
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0-39.1
838e4d
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
838e4d
838e4d
* Mon Mar 08 2021 Charalampos Stratakis <cstratak@redhat.com> - 0-38.1
838e4d
- Disable tests on RHEL9 to remove tox dependency
838e4d
838e4d
* Sun Feb 07 2021 Miro Hrončok <mhroncok@redhat.com> - 0-38
838e4d
- Include nested __pycache__ directories in %%pyproject_save_files
838e4d
- Fixes: rhbz#1925963
838e4d
838e4d
* Tue Feb 02 2021 Miro Hrončok <mhroncok@redhat.com> - 0-37
838e4d
- Remove support for Python 3.7 from %%pyproject_buildrequires
838e4d
- Generate python3dist(toml) BR with pyproject.toml earlier to avoid extra install round
838e4d
- Generate python3dist(setutpools/wheel) BR without pyproject.toml earlier as well
838e4d
838e4d
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0-36
838e4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
838e4d
838e4d
* Fri Jan 15 2021 Miro Hrončok <mhroncok@redhat.com> - 0-35
838e4d
- Update the description of the package to match the new README content
838e4d
838e4d
* Fri Dec 04 2020 Miro Hrončok <miro@hroncok.cz> - 0-34
838e4d
- List all files in %%pyproject_files explicitly to avoid duplicate %%lang entries
838e4d
- If you amend the installed files after %%pyproject_install, %%pyproject_files might break
838e4d
838e4d
* Fri Nov 27 2020 Miro Hrončok <mhroncok@redhat.com> - 0-33
838e4d
- Pass PYTHONDONTWRITEBYTECODE=1 to %%tox to avoid packaged PYTEST bytecode
838e4d
838e4d
* Tue Nov 03 2020 Miro Hrončok <mhroncok@redhat.com> - 0-32
838e4d
- Allow multiple -e in %%pyproject_buildrequires
838e4d
- Fixes: rhbz#1886509
838e4d
838e4d
* Mon Oct 05 2020 Miro Hrončok <mhroncok@redhat.com> - 0-31
838e4d
- Support PEP 517 list based backend-path
838e4d
838e4d
* Tue Sep 29 2020 Lumír Balhar <lbalhar@redhat.com> - 0-30
838e4d
- Process RECORD files in %%pyproject_install and remove them
838e4d
- Support the extras configuration option of tox in %%pyproject_buildrequires -t
838e4d
- Support multiple -x options for %%pyproject_buildrequires
838e4d
- Fixes: rhbz#1877977
838e4d
- Fixes: rhbz#1877978
838e4d
838e4d
* Wed Sep 23 2020 Miro Hrončok <mhroncok@redhat.com> - 0-29
838e4d
- Check the requirements after installing "requires_for_build_wheel"
838e4d
- If not checked, installing runtime requirements might fail
838e4d
838e4d
* Tue Sep 08 2020 Gordon Messmer <gordon.messmer@gmail.com> - 0-28
838e4d
- Support more Python version specifiers in generated BuildRequires
838e4d
- This adds support for the '~=' operator and wildcards
838e4d
838e4d
* Fri Sep 04 2020 Miro Hrončok <miro@hroncok.cz> - 0-27
838e4d
- Make code in $PWD importable from %%pyproject_buildrequires
838e4d
- Only require toml for projects with pyproject.toml
838e4d
- Remove a no longer useful warning for unrecognized files in %%pyproject_save_files
838e4d
838e4d
* Mon Aug 24 2020 Tomas Hrnciar <thrnciar@redhat.com> - 0-26
838e4d
- Implement automatic detection of %%lang files in %%pyproject_save_files
838e4d
  and mark them with %%lang in filelist
838e4d
838e4d
* Fri Aug 14 2020 Miro Hrončok <mhroncok@redhat.com> - 0-25
838e4d
- Handle Python Extras in %%pyproject_buildrequires on Fedora 33+
838e4d
838e4d
* Tue Aug 11 2020 Miro Hrončok <mhroncok@redhat.com> - 0-24
838e4d
- Allow multiple, comma-separated extras in %%pyproject_buildrequires -x
838e4d
838e4d
* Mon Aug 10 2020 Lumír Balhar <lbalhar@redhat.com> - 0-23
838e4d
- Make macros more universal for alternative Python stacks
838e4d
838e4d
* Thu Aug 06 2020 Tomas Hrnciar <thrnciar@redhat.com> - 0-22
838e4d
- Change %%pyproject_save_files +bindir argument to +auto
838e4d
  to list all unclassified files in filelist
838e4d
838e4d
* Tue Aug 04 2020 Miro Hrončok <mhroncok@redhat.com> - 0-21
838e4d
- Actually implement %%pyproject_extras_subpkg
838e4d
838e4d
* Wed Jul 29 2020 Miro Hrončok <mhroncok@redhat.com> - 0-20
838e4d
- Implement %%pyproject_extras_subpkg
838e4d
838e4d
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0-19
838e4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
838e4d
838e4d
* Thu Jul 16 2020 Miro Hrončok <mhroncok@redhat.com> - 0-18
838e4d
- %%pyproject_buildrequires -x (extras requires for tests) now implies -r
838e4d
  (runtime requires) instead of erroring without it for better UX.
838e4d
838e4d
* Wed Jul 15 2020 Miro Hrončok <mhroncok@redhat.com> - 0-17
838e4d
- Set HOSTNAME to prevent tox 3.17+ from a DNS query
838e4d
- Fixes rhbz#1856356
838e4d
838e4d
* Fri Jun 19 2020 Miro Hrončok <mhroncok@redhat.com> - 0-16
838e4d
- Switch from upstream deprecated pytoml to toml
838e4d
838e4d
* Thu May 07 2020 Tomas Hrnciar <thrnciar@redhat.com> - 0-15
838e4d
- Adapt %%pyproject_install not to create a PEP 610 direct_url.json file
838e4d
838e4d
* Wed Apr 15 2020 Patrik Kopkan <pkopkan@redhat.com> - 0-14
838e4d
- Add %%pyproject_save_file macro for generating file section
838e4d
- Handle extracting debuginfo from extension modules (#1806625)
838e4d
838e4d
* Mon Mar 02 2020 Miro Hrončok <mhroncok@redhat.com> - 0-13
838e4d
- Tox dependency generator: Handle deps read in from a text file (#1808601)
838e4d
838e4d
* Wed Feb 05 2020 Miro Hrončok <mhroncok@redhat.com> - 0-12
838e4d
- Fallback to setuptools.build_meta:__legacy__ backend instead of setuptools.build_meta
838e4d
- Properly handle backends with colon
838e4d
- Preserve existing flags in shebangs of Python files in /usr/bin
838e4d
838e4d
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0-11
838e4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
838e4d
838e4d
* Fri Nov 15 2019 Patrik Kopkan <pkopkan@redhat.com> - 0-10
838e4d
- Install wheel in '$PWD/pyproject-macros-wheeldir' to have more explicit path from which we install.
838e4d
- The path can be changed by redefining %%_pyproject_wheeldir.
838e4d
838e4d
* Wed Nov 13 2019 Anna Khaitovich <akhaitov@redhat.com> - 0-9
838e4d
- Remove stray __pycache__ directory from /usr/bin when running %%pyproject_install
838e4d
838e4d
* Fri Oct 25 2019 Miro Hrončok <mhroncok@redhat.com> - 0-8
838e4d
- When tox fails, print tox output before failing
838e4d
838e4d
* Tue Oct 08 2019 Miro Hrončok <mhroncok@redhat.com> - 0-7
838e4d
- Move a verbose line of %%pyproject_buildrequires from stdout to stderr
838e4d
838e4d
* Fri Jul 26 2019 Petr Viktorin <pviktori@redhat.com> - 0-6
838e4d
- Use importlib_metadata rather than pip freeze
838e4d
838e4d
* Fri Jul 26 2019 Miro Hrončok <mhroncok@redhat.com> - 0-5
838e4d
- Allow to fetch test dependencies from tox
838e4d
- Add %%tox macro to invoke tests
838e4d
838e4d
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-4
838e4d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
838e4d
838e4d
* Tue Jul 02 2019 Miro Hrončok <mhroncok@redhat.com> - 0-3
838e4d
- Add %%pyproject_buildrequires
838e4d
838e4d
* Tue Jul 02 2019 Miro Hrončok <mhroncok@redhat.com> - 0-2
838e4d
- Fix shell syntax errors in %%pyproject_install
838e4d
- Drop PATH warning in %%pyproject_install
838e4d
838e4d
* Fri Jun 28 2019 Patrik Kopkan <pkopkan@redhat.com> - 0-1
838e4d
- created package