| |
@@ -1,5 +1,14 @@
|
| |
+ # Not yet packaged: python-uncertainties
|
| |
+ %bcond uncertainties 0
|
| |
+ # Requires babel <= 2.8; F40 has 2.12.1, and current is 2.13.1
|
| |
+ %bcond babel 0
|
| |
+ # Not yet packaged: python-pint-pandas
|
| |
+ %bcond pandas 0
|
| |
+ # Not yet packaged: python-mip
|
| |
+ %bcond mip 0
|
| |
+
|
| |
Name: python-pint
|
| |
- Version: 0.19.2
|
| |
+ Version: 0.23
|
| |
Release: %autorelease
|
| |
Summary: Physical quantities module
|
| |
|
| |
@@ -7,41 +16,21 @@
|
| |
# - pint/_vendor/appdirs.py is MIT, but is unbundled in %%prep
|
| |
# - pint/_vendor/flexcache.py is also BSD-3-Clause, but is unbundled in
|
| |
# %%prep
|
| |
+ # - pint/_vendor/flexparser.py is also BSD-3-Clause, but is unbundled in
|
| |
+ # %%prep
|
| |
License: BSD-3-Clause
|
| |
URL: https://github.com/hgrecco/pint
|
| |
- Source0: %{pypi_source Pint}
|
| |
+ Source: %{pypi_source Pint}
|
| |
|
| |
- # Fix test as NumPy 1.25 changes the rules for equality operator
|
| |
- # https://github.com/hgrecco/pint/commit/b3b18277ecc682bff7ca1fa9e48992f7ec68e47f
|
| |
- #
|
| |
- # Fixes:
|
| |
- #
|
| |
- # test_equal_zero_nan_NP fails with numpy 1.25.1
|
| |
- # https://github.com/hgrecco/pint/issues/1825
|
| |
- Patch: %{url}/commit/b3b18277ecc682bff7ca1fa9e48992f7ec68e47f.patch
|
| |
+ # Downstream-only: adjust pyproject.toml for unbundling
|
| |
+ # Adds dependencies on external appdirs, flexcache, and flexparser
|
| |
+ Patch: 0001-Downstream-only-adjust-pyproject.toml-for-unbundling.patch
|
| |
|
| |
- # add min and max to the array function overrides
|
| |
- # https://github.com/hgrecco/pint/commit/1b2b0592f88a1c9fdf9b5649ebade19fa81adea4
|
| |
+ # fix: cache of decimal and float
|
| |
+ # https://github.com/hgrecco/pint/commit/88199175f5fba58cd3a82fa0fbc61d98745ec7ca
|
| |
#
|
| |
- # Fixes several failures in TestNumpyUnclassified
|
| |
- #
|
| |
- # Cherry-picked to 0.19.
|
| |
- Patch: 0001-add-min-and-max-to-the-array-function-overrides.patch
|
| |
-
|
| |
- # Downstream-only: Backport fix for importlib.resources.path removal
|
| |
- #
|
| |
- # Imitate current versions of flexparser, which was split out as a
|
| |
- # separate library in later releases of pint.
|
| |
- #
|
| |
- # This is resolved in current upstream releases of pint; see
|
| |
- # https://src.fedoraproject.org/rpms/python-pint/pull-request/10.
|
| |
- #
|
| |
- # Fixes:
|
| |
- #
|
| |
- # python-pint fails to build with Python 3.13: AttributeError: module
|
| |
- # 'importlib.resources' has no attribute 'path'
|
| |
- # https://bugzilla.redhat.com/show_bug.cgi?id=2256746
|
| |
- Patch: 0001-Downstream-only-Backport-fix-for-importlib.resources.patch
|
| |
+ # Fixes a test failure with flexcache 0.3.
|
| |
+ Patch: %{url}/commit/88199175f5fba58cd3a82fa0fbc61d98745ec7ca.patch
|
| |
|
| |
BuildArch: noarch
|
| |
|
| |
@@ -58,22 +47,41 @@
|
| |
%package -n python3-pint
|
| |
Summary: %{summary}
|
| |
|
| |
+ # Upstream bundles flexparser. We filed
|
| |
+ # https://github.com/hgrecco/flexparser/issues/5 to convince them to issue a
|
| |
+ # new release so we can unbundle without using a snapshot, but we need to wait
|
| |
+ # for pint 0.23 before pint will be compatible with the new flexparser 0.2
|
| |
+ # release.
|
| |
+ Provides: bundled(python3dist(flexparser)) = 0.1^20221026git66b1338
|
| |
+
|
| |
%description -n python3-pint %{_description}
|
| |
|
| |
- # We omit the “uncertainties” extra because python-uncertainties is not yet
|
| |
- # packaged.
|
| |
- %pyproject_extras_subpkg -n python3-pint numpy
|
| |
+ %pyproject_extras_subpkg -n python3-pint numpy xarray dask
|
| |
+ %if %{with uncertainties}
|
| |
+ %pyproject_extras_subpkg -n python3-pint uncertainties
|
| |
+ %endif
|
| |
+ %if %{with babel}
|
| |
+ %pyproject_extras_subpkg -n python3-pint babel
|
| |
+ %endif
|
| |
+ %if %{with pandas}
|
| |
+ %pyproject_extras_subpkg -n python3-pint pandas
|
| |
+ %endif
|
| |
+ %if %{with mip}
|
| |
+ %pyproject_extras_subpkg -n python3-pint mip
|
| |
+ %endif
|
| |
|
| |
%prep
|
| |
%autosetup -n Pint-%{version} -p1
|
| |
|
| |
- # We are not sure where this was bundled from, but we are pretty sure it was
|
| |
- # bundled from somewhere! We are not building HTML documentation, so we do not
|
| |
- # need it.
|
| |
- rm -rvf docs/_themes
|
| |
-
|
| |
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
|
| |
- sed -r -i '/pytest-cov/d' setup.cfg
|
| |
+ sed -r -i '/pytest-cov/d' pyproject.toml
|
| |
+
|
| |
+ # This module is executable in the source, and it might make sense for upstream
|
| |
+ # to run it directly as a script during development, but this package will
|
| |
+ # install it in site-packages without the executable bit set, so it doesn’t
|
| |
+ # make sense for it to have a shebang. Package users will run it via the
|
| |
+ # generated pint-convert entry point instead.
|
| |
+ sed -r -i '1{/^#!/d}' pint/pint_convert.py
|
| |
|
| |
# Unbundle python-appdirs
|
| |
# http://github.com/ActiveState/appdirs
|
| |
@@ -83,32 +91,51 @@
|
| |
# https://github.com/hgrecco/flexcache
|
| |
# Provides: bundled(python3dist(flexcache)) = 0.2
|
| |
rm -vf pint/_vendor/flexcache.py
|
| |
- # Add devendored dependencies back in as regular dependencies
|
| |
- sed -r -i 's/^setup_requires/install_requires = appdirs; flexcache\n&/' \
|
| |
- setup.cfg
|
| |
+ # Unbundle python-flexparser
|
| |
+ # https://github.com/hgrecco/flexparser
|
| |
+ # Provides: bundled(python3dist(flexparser)) = 0.1^20221026git66b1338
|
| |
+ rm -vf pint/_vendor/flexparser.py
|
| |
# The find-then-modify pattern keeps us from discarding mtimes on sources that
|
| |
# do not need modification.
|
| |
find pint -type f -exec \
|
| |
- gawk '/^from (\.*|pint)\._vendor import (appdirs|flexcache)/ {
|
| |
+ gawk '/^from (\.*|pint)\._vendor import (appdirs|flex(cache|parser))/ {
|
| |
print FILENAME; nextfile }' '{}' '+' |
|
| |
xargs -r -t sed -r -i \
|
| |
-e 's/^from (\.*|pint)\._vendor (import (appdirs))/\2/' \
|
| |
- -e 's/^(from )(\.*|pint)\._vendor( import (flexcache))/\1\4\3/'
|
| |
+ -e 's/^(from )(\.*|pint)\._vendor( import (flex(cache|parser)))/\1\4\3/'
|
| |
|
| |
%generate_buildrequires
|
| |
- # We omit the “uncertainties” extra because python-uncertainties is not yet
|
| |
- # packaged.
|
| |
- %pyproject_buildrequires -x numpy,test
|
| |
+ %{pyproject_buildrequires \
|
| |
+ -x numpy \
|
| |
+ %if %{with uncertainties}
|
| |
+ -x uncertainties \
|
| |
+ %endif
|
| |
+ %if %{with babel}
|
| |
+ -x babel \
|
| |
+ %endif
|
| |
+ %if %{with pandas}
|
| |
+ -x pandas \
|
| |
+ %endif
|
| |
+ -x xarray \
|
| |
+ -x dask \
|
| |
+ %if %{with mip}
|
| |
+ -x mip \
|
| |
+ %endif
|
| |
+ -x test}
|
| |
|
| |
%build
|
| |
%pyproject_wheel
|
| |
|
| |
%install
|
| |
%pyproject_install
|
| |
- %pyproject_save_files pint
|
| |
+ %pyproject_save_files -l pint
|
| |
|
| |
%check
|
| |
- %pytest
|
| |
+ # Two test failures in pint/testsuite/benchmarks/test_10_registry.py
|
| |
+ # https://github.com/hgrecco/pint/issues/1898
|
| |
+ k="${k-}${k+ and }not test_load_definitions_stage_2[None]"
|
| |
+ k="${k-}${k+ and }not test_load_definitions_stage_2[True]"
|
| |
+ %pytest -k "${k-}"
|
| |
|
| |
%files -n python3-pint -f %{pyproject_files}
|
| |
%{_bindir}/pint-convert
|
| |
I’m doing this incrementally since there is so much churn across versions.
All of this requires
python-flexparser
(review request).