python3.14-setuptools_scm/python3.14-setuptools_scm.spec
Tomáš Hrnčiar 8c9fb85ae2 Convert from Fedora for the Python 3.14 stack in RHEL
Fedora contributions by:
    Charalampos Stratakis <cstratak@redhat.com>
    Elliott Sales de Andrade <quantum.analyst@gmail.com>
    Igor Gnatenko <ignatenkobrain@fedoraproject.org>
    Jan Pokorný <jpokorny@fedoraproject.org>
    Kevin Fenzi <kevin@scrye.com>
    Lukáš Zachar <lzachar@redhat.com>
    Lumír Balhar <lbalhar@redhat.com>
    Miro Hrončok <mhroncok@redhat.com>
    Orion Poplawski <orion@nwra.com>
    Parag Nemade <pnemade AT redhat DOT com>
    Peter Robinson <pbrobinson@fedoraproject.org>
    Phil Wyett <philwyett@kathenas.org>
    Tomas Orsava <torsava@redhat.com>
    Tomáš Hrnčiar <thrnciar@redhat.com>
    Yaakov Selkowitz <yselkowi@redhat.com>
2025-11-28 10:26:08 +01:00

76 lines
2.1 KiB
RPMSpec

%global python3_pkgversion 3.14
%bcond tests 0
Name: python%{python3_pkgversion}-setuptools_scm
Version: 8.3.1
Release: %autorelease
Summary: Blessed package to manage your versions by SCM tags
# SPDX
License: MIT
URL: https://github.com/pypa/setuptools_scm/
Source: %{pypi_source setuptools_scm}
BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
%if %{with tests}
BuildRequires: git-core
# Don't pull mercurial into RHEL just to test this work with it
%if %{undefined rhel}
BuildRequires: mercurial
%endif
%endif
%description -n python%{python3_pkgversion}-setuptools_scm
Setuptools_scm handles managing your Python package versions in SCM metadata.
It also handles file finders for the supported SCMs.
# We don't package the [rich] extra on RHELs, to avoid pulling rich into the buildroot
%pyproject_extras_subpkg -n python%{python3_pkgversion}-setuptools_scm toml%{!?rhel:,rich}
%prep
%autosetup -p1 -n setuptools_scm-%{version}
%if %{defined rhel}
# Remove unnecessary test dependencies:
# rich is listed in both [rich] and [test] extras, so we need to be more careful
sed -Ei '/^test = \[/,/^\]/ { /"(rich|build|wheel)",/d }' pyproject.toml
# Don't blow up all of the tests by failing to report the installed version of build
sed -Ei '0,/VERSION_PKGS/{s/, "(build|wheel)"//g}' testing/conftest.py
%endif
%generate_buildrequires
# Note: We only pull in the [rich] extra when running tests.
# This is to make the new Python version bootstrapping simpler
# as setuptools_scm is an early package and rich is a late one.
%pyproject_buildrequires %{?with_tests:-x test %{!?rhel:-x rich}}
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files setuptools_scm
%if %{with tests}
%check
# test_pip_download tries to download from the internet
# test_pyproject_missing_setup_hook_works requires build
%pytest -v -k 'not test_pip_download%{?rhel: and not test_pyproject_missing_setup_hook_works}'
%endif
%files -n python%{python3_pkgversion}-setuptools_scm -f %{pyproject_files}
%doc README.md
%changelog
%autochangelog