From 2e1f3f183d9365a6a2e6943265f9a4cf767ffd0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Fri, 29 Jan 2021 19:21:24 +0100 Subject: [PATCH] Modernize packaging - use pyproject-rpm-macros - don't macronize the setuptools_scm name - use globs in .gitignore --- .gitignore | 20 ++------------ python-setuptools_scm.spec | 54 ++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index 2f767d9..fec6884 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,2 @@ -/setuptools_scm-1.8.0.tar.bz2 -/setuptools_scm-1.9.0.tar.gz -/setuptools_scm-1.10.1.tar.bz2 -/setuptools_scm-1.13.0.tar.gz -/setuptools_scm-1.15.0.tar.gz -/setuptools_scm-1.15.5.tar.gz -/setuptools_scm-1.15.6.tar.gz -/setuptools_scm-1.15.7.tar.gz -/setuptools_scm-2.1.0.tar.gz -/setuptools_scm-3.0.4.tar.gz -/setuptools_scm-3.1.0.tar.gz -/setuptools_scm-3.2.0.tar.gz -/setuptools_scm-3.3.0.tar.gz -/setuptools_scm-3.3.1.tar.gz -/setuptools_scm-3.3.3.tar.gz -/setuptools_scm-3.5.0.tar.gz -/setuptools_scm-4.1.2.tar.gz -/setuptools_scm-5.0.1.tar.gz +/setuptools_scm-*.tar.gz +/setuptools_scm-*/ diff --git a/python-setuptools_scm.spec b/python-setuptools_scm.spec index 76ede52..e49126b 100644 --- a/python-setuptools_scm.spec +++ b/python-setuptools_scm.spec @@ -1,62 +1,70 @@ %bcond_without tests -%global srcname setuptools_scm - -Name: python-%{srcname} +Name: python-setuptools_scm Version: 5.0.1 Release: 1%{?dist} Summary: Blessed package to manage your versions by SCM tags License: MIT URL: https://pypi.python.org/pypi/setuptools_scm -Source0: %pypi_source +Source0: %{pypi_source setuptools_scm} BuildArch: noarch +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: pyproject-rpm-macros %if %{with tests} BuildRequires: git-core BuildRequires: mercurial %endif %description -Setuptools_scm handles managing your python package versions in SCM metadata. +Setuptools_scm handles managing your Python package versions in SCM metadata. It also handles file finders for the supported SCMs. -%package -n python%{python3_pkgversion}-%{srcname} + +%package -n python%{python3_pkgversion}-setuptools_scm Summary: %{summary} -BuildRequires: python%{python3_pkgversion}-devel -BuildRequires: python%{python3_pkgversion}-setuptools -%if %{with tests} -BuildRequires: python%{python3_pkgversion}-pip -BuildRequires: python%{python3_pkgversion}-pytest -BuildRequires: python%{python3_pkgversion}-toml -%endif -%description -n python%{python3_pkgversion}-%{srcname} -Setuptools_scm handles managing your python package versions in SCM metadata. +%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. -%{?python_extras_subpkg:%{python_extras_subpkg -n python3-setuptools_scm -i %{python3_sitelib}/%{srcname}-*.egg-info toml}} + +%pyproject_extras_subpkg -n python%{python3_pkgversion}-setuptools_scm toml + %prep -%autosetup -n %{srcname}-%{version} +%autosetup -p1 -n setuptools_scm-%{version} +# In case of a bootstrap loop between toml and setuptools_scm, do: +# rm pyproject.toml +# That way, toml is not fetched to parse the file. +# That only works assuming the backend in the file remains the default backend. + + +%generate_buildrequires +%pyproject_buildrequires %{?with_tests:-e %{toxenv}-test} + %build -%py3_build +%pyproject_wheel + %install -%py3_install +%pyproject_install +%pyproject_save_files setuptools_scm + %if %{with tests} %check -PYTHONPATH=%{buildroot}%{python3_sitelib} pytest-3 -v -k 'not test_pip_download' +%tox -- -- -v -k 'not test_pip_download' %endif -%files -n python%{python3_pkgversion}-%{srcname} + +%files -n python%{python3_pkgversion}-setuptools_scm -f %{pyproject_files} %license LICENSE %doc README.rst -%{python3_sitelib}/%{srcname}/ -%{python3_sitelib}/%{srcname}-*.egg-info/ + %changelog * Fri Jan 29 2021 Miro HronĨok - 5.0.1-1