python-setuptools_scm/python-setuptools_scm.spec

86 lines
2.3 KiB
RPMSpec
Raw Normal View History

%bcond tests 1
2017-08-15 16:29:32 +00:00
Name: python-setuptools_scm
2023-09-26 10:15:13 +00:00
Version: 8.0.3
Release: %autorelease
Summary: Blessed package to manage your versions by SCM tags
2015-10-21 15:13:26 +00:00
2023-05-24 08:35:36 +00:00
# SPDX
2015-10-21 15:13:26 +00:00
License: MIT
URL: https://github.com/pypa/setuptools_scm/
2023-09-26 12:41:36 +00:00
Source: %{pypi_source setuptools-scm}
2015-10-21 15:13:26 +00:00
BuildArch: noarch
2017-08-15 16:29:32 +00:00
BuildRequires: python%{python3_pkgversion}-devel
2017-08-15 16:29:32 +00:00
%if %{with tests}
2015-10-21 15:13:26 +00:00
BuildRequires: git-core
# Don't pull mercurial into RHEL just to test this work with it
%if %{undefined rhel}
2015-10-21 15:13:26 +00:00
BuildRequires: mercurial
2017-08-15 16:29:32 +00:00
%endif
2023-05-24 08:35:06 +00:00
# Manually listed test dependencies from tox.ini, to avoid pulling tox into RHEL
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(setuptools) >= 45
# virtualenv omitted, see https://github.com/pypa/setuptools_scm/pull/940
# rich omitted, pulled in only with the [rich] extra
%endif
2015-10-21 15:13:26 +00:00
%description
Setuptools_scm handles managing your Python package versions in SCM metadata.
It also handles file finders for the supported SCMs.
2015-10-21 15:13:26 +00:00
%package -n python%{python3_pkgversion}-setuptools_scm
Summary: %{summary}
2015-10-21 15:13:26 +00:00
%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.
2015-10-21 15:13:26 +00:00
# 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}
2020-07-10 15:14:23 +00:00
2015-10-21 15:13:26 +00:00
%prep
2023-09-21 09:48:29 +00:00
%autosetup -p1 -n setuptools-scm-%{version}
# Upstream bogusly declares rich as a build-system dependency,
# but the build works without it.
# We remove it here to simplify the bootstrap loop
# and to avoid the dependency in RHEL builds.
# Upstream issue: https://github.com/pypa/setuptools_scm/issues/941
# Upstream PR: https://github.com/pypa/setuptools_scm/pull/942
# The PR does not apply cleanly to 8.0.3, so we sed it out instead.
# The sed removes the first line with "rich" only:
sed -i '0,/"rich"/{/"rich"/d}' pyproject.toml
%generate_buildrequires
%pyproject_buildrequires %{?with_tests:%{!?rhel:-x rich}}
2015-10-21 15:13:26 +00:00
%build
%pyproject_wheel
2015-10-21 15:13:26 +00:00
%install
%pyproject_install
%pyproject_save_files setuptools_scm
2015-10-21 15:13:26 +00:00
2017-08-15 16:29:32 +00:00
%if %{with tests}
2015-10-21 15:13:26 +00:00
%check
# Skipped test tries to download from the internet
%pytest -v -k 'not test_pip_download'
2019-11-16 22:37:35 +00:00
%endif
2015-10-21 15:13:26 +00:00
%files -n python%{python3_pkgversion}-setuptools_scm -f %{pyproject_files}
2023-09-21 09:48:29 +00:00
%doc README.md
2017-04-10 15:35:04 +00:00
2015-10-21 15:13:26 +00:00
%changelog
%autochangelog