%global python3_pkgversion 3.15 %bcond tests 0 Name: python%{python3_pkgversion}-setuptools_scm Version: 10.2.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 %py_provides python%{python3_pkgversion}-setuptools-scm %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 simple,toml%{!?rhel:,rich} %prep %autosetup -p1 -n setuptools_scm-%{version} # Remove flake8, mypy, ruff, … from the test dependencies %pyproject_patch_dependency griffe:ignore %pyproject_patch_dependency griffe-public-wildcard-imports:ignore %pyproject_patch_dependency griffecli:ignore %pyproject_patch_dependency mypy:ignore %pyproject_patch_dependency ruff:ignore %pyproject_patch_dependency flake8:ignore %if %{defined rhel} # Remove unnecessary test dependencies: %pyproject_patch_dependency rich:ignore %pyproject_patch_dependency pytest-timeout:ignore %pyproject_patch_dependency pytest-xdist:ignore sed -Ei '/^\[tool.pytest.ini_options\]/,/^\[/ { /^timeout/d }' pyproject.toml %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:-g test %{!?rhel:-x rich}} -x simple,toml %build %pyproject_wheel %install %pyproject_install %pyproject_save_files setuptools_scm # Allow parallel-installable executable for alternate Python stacks (e.g. in RHEL) mv %{buildroot}%{_bindir}/setuptools-scm %{buildroot}%{_bindir}/setuptools-scm-%{python3_version} %if "%{python3_pkgversion}" == "3" ln -s ./setuptools-scm-%{python3_version} %{buildroot}%{_bindir}/setuptools-scm %endif %if %{with tests} %check # test_pip_download, test_xmlsec_download_regression try to download from the internet # test_get_version_blank_tag_regex, test_setuptools_version_keyword_ensures_regex fail because # vcs-versioning 2.x added DeprecationWarnings for tag_regex that the tests don't expect; # fixed upstream: https://github.com/pypa/setuptools-scm/commit/ba215a70a88bbd35ecf0961c8b1a1301c940629e %pytest -v %{!?rhel:-n auto} -k 'not test_pip_download and not test_xmlsec_download_regression and not test_get_version_blank_tag_regex and not test_setuptools_version_keyword_ensures_regex' %endif %files -n python%{python3_pkgversion}-setuptools_scm -f %{pyproject_files} %doc README.md %{_bindir}/setuptools-scm-%{python3_version} %if "%{python3_pkgversion}" == "3" %{_bindir}/setuptools-scm %endif %changelog %autochangelog