Improve dependency generation, add extras metapackages, and finish fully porting to pyproject-rpm-macros

This commit is contained in:
Benjamin A. Beasley
2023-10-29 22:23:20 -04:00
parent e9b556312f
commit 4c7ab1ff54
+20 -29
View File
@@ -1,5 +1,3 @@
%global pypi_name Pint
Name: python-pint
Version: 0.17
Release: %autorelease
@@ -7,38 +5,31 @@ Summary: Physical quantities module
License: BSD
URL: https://github.com/hgrecco/pint
Source0: %pypi_source
Source0: %{pypi_source Pint}
BuildArch: noarch
BuildRequires: pyproject-rpm-macros
%description
Pint is Python module/package to define, operate and manipulate physical
quantities: the product of a numerical value and a unit of measurement.
It allows arithmetic operations between them and conversions from and
to different units.
%global _description %{expand:
Pint is a Python package to define, operate and manipulate physical quantities:
the product of a numerical value and a unit of measurement. It allows
arithmetic operations between them and conversions from and to different units.
It is distributed with a comprehensive list of physical units, prefixes
and constants.
It is distributed with a comprehensive list of physical units, prefixes and
constants.}
%description %{_description}
%package -n python3-pint
Summary: Physical quantities module
%{?python_provide:%python_provide python3-pint}
Summary: %{summary}
BuildRequires: python3-numpy
BuildRequires: python3-pytest
%description -n python3-pint %{_description}
%description -n python3-pint
Pint is Python module/package to define, operate and manipulate physical
quantities: the product of a numerical value and a unit of measurement.
It allows arithmetic operations between them and conversions from and
to different units.
It is distributed with a comprehensive list of physical units, prefixes
and constants.
# We omit the “uncertainties” extra because python-uncertainties is not yet
# packaged.
%pyproject_extras_subpkg -n python3-pint numpy
%prep
%setup -q -n %{pypi_name}-%{version}
%autosetup -n Pint-%{version}
# numpy 1.24.x removes np.float np.alen and so on
# These are already fixed upstream
@@ -60,22 +51,22 @@ sed -i pint/testsuite/test_contexts.py -e 's|self.assertEquals|self.assertEqual|
sed -i '/@helpers.requires_numpy_at_least("1.16")/d' pint/testsuite/test_quantity.py
%generate_buildrequires
%pyproject_buildrequires -x test
# We omit the “uncertainties” extra because python-uncertainties is not yet
# packaged.
%pyproject_buildrequires -x numpy,test
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files pint
%check
%pytest
%files -n python3-pint
%license LICENSE
%files -n python3-pint -f %{pyproject_files}
%{_bindir}/pint-convert
%{python3_sitelib}/pint
%{python3_sitelib}/Pint-%{version}.*
%changelog
%autochangelog