Modernize packaging

- use pyproject-rpm-macros
 - don't macronize the setuptools_scm name
 - use globs in .gitignore
This commit is contained in:
Miro Hrončok 2021-01-29 19:21:24 +01:00
parent c408a5e08a
commit 2e1f3f183d
2 changed files with 33 additions and 41 deletions

20
.gitignore vendored
View File

@ -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-*/

View File

@ -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 <mhroncok@redhat.com> - 5.0.1-1