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
838e4d
# Keep the version at zero and increment only release.
838e4d
# The release number indicates the feature set so only
838e4d
# increment it when syncing or rebasing from Fedora.
838e4d
# In other cases, such as backports, increment the point
838e4d
# release.
838e4d
Version:        0
838e4d
Release:        46%{?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
838e4d
838e4d
# Tests
838e4d
Source201:      test_pyproject_buildrequires.py
838e4d
Source202:      test_pyproject_save_files.py
838e4d
Source203:      test_pyproject_requirements_txt.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}
838e4d
BuildRequires: python3dist(pytest)
838e4d
BuildRequires: python3dist(pyyaml)
838e4d
BuildRequires: python3dist(packaging)
838e4d
BuildRequires: python3dist(pip)
838e4d
BuildRequires: python3dist(setuptools)
838e4d
BuildRequires: python3dist(toml)
838e4d
BuildRequires: python3dist(tox-current-env) >= 0.0.6
838e4d
BuildRequires: python3dist(wheel)
838e4d
%endif
838e4d
838e4d
# We build on top of those:
838e4d
Requires:      python-rpm-macros
838e4d
Requires:      python-srpm-macros
838e4d
Requires:      python3-rpm-macros
838e4d
838e4d
838e4d
%description
838e4d
These macros allow projects that follow the Python packaging specifications
838e4d
to be packaged as RPMs.
838e4d
838e4d
They are still provisional: we can make non-backwards-compatible changes to
838e4d
the API.
838e4d
Please subscribe to Fedora's python-devel list if you use the macros.
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
838e4d
install -m 644 macros.pyproject %{buildroot}%{_rpmmacrodir}/
838e4d
install -m 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/redhat/
838e4d
install -m 644 pyproject_convert.py %{buildroot}%{_rpmconfigdir}/redhat/
838e4d
install -m 644 pyproject_save_files.py  %{buildroot}%{_rpmconfigdir}/redhat/
838e4d
install -m 644 pyproject_preprocess_record.py %{buildroot}%{_rpmconfigdir}/redhat/
838e4d
install -m 644 pyproject_construct_toxenv.py %{buildroot}%{_rpmconfigdir}/redhat/
838e4d
install -m 644 pyproject_requirements_txt.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
838e4d
%{python3} -m pytest -vv --doctest-modules
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
838e4d
838e4d
%doc README.md
838e4d
%license LICENSE
838e4d
838e4d
%changelog
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