Use pyproject-rpm-macros

This commit is contained in:
Benjamin A. Beasley 2022-05-16 09:43:24 -04:00
parent 4f808d6578
commit 227cd6eec9

View File

@ -1,10 +1,8 @@
%global pypi_name fasteners
%bcond_without tests
# The python-diskcache package, used in some of the tests, has been retired.
%bcond_with diskcache
Name: python-%{pypi_name}
Name: python-fasteners
Version: 0.17
Release: %autorelease
Summary: A python package that provides useful locks
@ -22,16 +20,6 @@ Patch: %{url}/commit/49d8f5bb56157a82ff3e6128b506638a214e6d43.patch
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
%if %{with tests}
# requirements-test.txt
%if %{with diskcache}
BuildRequires: python3dist(diskcache)
%endif
BuildRequires: python3dist(more-itertools)
BuildRequires: python3dist(pytest)
%endif
%global common_description %{expand: \
Cross platform locks for threads and processes}
@ -40,39 +28,46 @@ Cross platform locks for threads and processes}
%{common_description}
%package -n python3-%{pypi_name}
%package -n python3-fasteners
Summary: A python package that provides useful locks
%description -n python3-%{pypi_name}
%description -n python3-fasteners
%{common_description}
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
%autosetup -p1 -n fasteners-%{version}
%if %{without diskcache}
sed -r -i '/\b(diskcache)\b/d' requirements-test.txt
%endif
%generate_buildrequires
%pyproject_buildrequires %{?with_tests:requirements-test.txt}
%build
%py3_build
%pyproject_wheel
%install
%py3_install
%pyproject_install
%pyproject_save_files fasteners
%check
%if %{with tests}
%pytest %{?!with_diskcache:--ignore=tests/test_reader_writer_lock.py}
%else
%pyproject_check_import -e 'fasteners.pywin32*'
%endif
%files -n python3-%{pypi_name}
%license LICENSE
%files -n python3-fasteners -f %{pyproject_files}
# pyproject_files handles LICENSE; verify with “rpm -qL -p …”
%doc ChangeLog
%doc README.md
%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info/
%changelog
%autochangelog