python3.14-packaging/python3.14-packaging.spec
Tomáš Hrnčiar 5fd0263339 Convert from Fedora for the Python 3.14 stack in RHEL
Fedora contributors by:
    Charalampos Stratakis <cstratak@redhat.com>
    Iryna Shcherbina <ishcherb@redhat.com>
    Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>
    Karolina Surma <ksurma@redhat.com>
    Lukáš Zachar <lzachar@redhat.com>
    Lumír Balhar <lbalhar@redhat.com>
    Miro Hrončok <mhroncok@redhat.com>
    Tomáš Hrnčiar <thrnciar@redhat.com>
    Yaakov Selkowitz <yselkowi@redhat.com>
    Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
2025-11-26 00:16:38 +01:00

101 lines
2.6 KiB
RPMSpec

%global python3_pkgversion 3.14
%global pypi_name packaging
# Specify --with bootstrap to build in bootstrap mode
# This mode is needed, because python3-rpm-generators need packaging
%bcond_with bootstrap
# When bootstrapping, the tests and docs are disabled because the dependencies are not yet available.
# We don't want python-pretend in future RHEL, so we disable tests on RHEL as well.
# No reason to ship the documentation in RHEL either, so it is also disabled by default.
%if %{without bootstrap} && %{undefined rhel}
# Specify --without tests to prevent the dependency loop on python-pytest
%bcond_without tests
%else
%bcond_with tests
%endif
Name: python%{python3_pkgversion}-%{pypi_name}
Version: 25.0
Release: %autorelease
Summary: Core utilities for Python packages
License: BSD-2-Clause OR Apache-2.0
URL: https://github.com/pypa/packaging
Source0: %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: pyproject-rpm-macros
BuildRequires: unzip
%if %{with bootstrap}
BuildRequires: python%{python3_pkgversion}-flit-core
%endif
# Upstream uses nox for testing, we specify the test deps manually as well.
%if %{with tests}
BuildRequires: python%{python3_pkgversion}-pytest
BuildRequires: python%{python3_pkgversion}-pretend
%endif
%global _description %{expand:
python-packaging provides core utilities for Python packages like utilities for
dealing with versions, specifiers, markers etc.}
%description %_description
%if %{with bootstrap}
Provides: python%{python3_pkgversion}dist(packaging) = %{version}
Provides: python%{python3_version}dist(packaging) = %{version}
Requires: python(abi) = %{python3_version}
%endif
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
%if %{without bootstrap}
%generate_buildrequires
%pyproject_buildrequires -r
%endif
%build
%if %{with bootstrap}
%{python3} -m flit_core.wheel
%else
%pyproject_wheel
%endif
%install
%if %{with bootstrap}
mkdir -p %{buildroot}%{python3_sitelib}
unzip dist/packaging-%{version}-py3-none-any.whl -d %{buildroot}%{python3_sitelib} -x packaging-%{version}.dist-info/RECORD
echo '%{python3_sitelib}/packaging*' > %{pyproject_files}
%else
%pyproject_install
%pyproject_save_files %{pypi_name}
%endif
%check
%{!?with_bootstrap:%pyproject_check_import}
%if %{with tests}
%pytest
%endif
%files -n python%{python3_pkgversion}-%{pypi_name} -f %{pyproject_files}
%license LICENSE LICENSE.APACHE LICENSE.BSD
%doc README.rst CHANGELOG.rst CONTRIBUTING.rst
%changelog
%autochangelog