From 4c7ab1ff54974b3fe3ede5a24cdae74806f9373d Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Mon, 10 Jul 2023 23:43:45 -0400 Subject: [PATCH] Improve dependency generation, add extras metapackages, and finish fully porting to pyproject-rpm-macros --- python-pint.spec | 49 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/python-pint.spec b/python-pint.spec index 1b1c5ba..9d0df5e 100644 --- a/python-pint.spec +++ b/python-pint.spec @@ -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