Bug#1022469: python-pint: FTBFS: dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.10 returned exit code 13

2022-12-03 Thread Stuart Prescott

Hi Michael


On 04/12/2022 03:50, Michael Banck wrote:
[...]

Looks like they got a work-around here in (since closed) PR #1401:
https://github.com/hgrecco/pint/commit/eb4e13428a3ede09148b76c71bc5b8cddb169176.patch


I was somewhat concerned that upstream abandoned that work rather than 
merging it. I have a feeling all it does is fix the test failure without 
actually fixing the underlying problems.



If I stick this (also attached) patch in, the testsuite passes fine.


I don't think it's enough for users of pint like superqt, however. The 
superqt test suite's failures seem to need a newer pin to pick up other 
compatibility changes with babel.


 8<  8< 

_ ERROR collecting 
.pybuild/cpython3_3.11_superqt/build/tests/test_quantity.py _

/usr/lib/python3/dist-packages/pint/registry.py:575: in load_definitions
rbytes = importlib.resources.read_binary(__package__, file)
/usr/lib/python3.11/importlib/resources/_legacy.py:18: in wrapper
warnings.warn(
E   DeprecationWarning: read_binary is deprecated. Use files() instead. 
Refer to https://importlib-resource
s.readthedocs.io/en/latest/using.html#migrating-from-legacy for 
migration advice.


During handling of the above exception, another exception occurred:
tests/test_quantity.py:3: in 
from superqt import QQuantity
:1231: in _handle_fromlist
???
superqt/__init__.py:51: in __getattr__
from .spinbox._quantity import QQuantity
superqt/spinbox/_quantity.py:21: in 
UREG = UnitRegistry()
/usr/lib/python3/dist-packages/pint/registry.py:143: in __call__
obj._after_init()
/usr/lib/python3/dist-packages/pint/registry.py:1976: in _after_init
super()._after_init()
/usr/lib/python3/dist-packages/pint/registry.py:305: in _after_init
self.load_definitions("default_en.txt", True)
/usr/lib/python3/dist-packages/pint/registry.py:588: in load_definitions
raise ValueError("While opening {}\n{}".format(file, msg))
E   ValueError: While opening default_en.txt
E   read_binary is deprecated. Use files() instead. Refer to 
https://importlib-resources.readthedocs.io/en/

latest/using.html#migrating-from-legacy for migration advice.

 8<  8< 

cheers
Stuart

--
Stuart Prescott   http://www.nanonanonano.net/ stu...@nanonanonano.net
Debian Developer  http://www.debian.org/   stu...@debian.org
GPG fingerprint   90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7



Bug#1022469: python-pint: FTBFS: dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.10 returned exit code 13

2022-12-03 Thread Michael Banck
tags 1022469 +patch
thanks

Hi,

On Wed, Nov 23, 2022 at 07:48:47PM +1100, Stuart Prescott wrote:
> pint is incompatible with babel > 2.8; unfortunately, Debian now has babel
> 2.10.
> 
> So far, upstream has only noted the compatibility with version pinning.
> 
> https://github.com/hgrecco/pint/issues/1219
> 
> Upstream tests for newer releases of pint also now fail due to this same
> reason.

Looks like they got a work-around here in (since closed) PR #1401:
https://github.com/hgrecco/pint/commit/eb4e13428a3ede09148b76c71bc5b8cddb169176.patch
 
If I stick this (also attached) patch in, the testsuite passes fine.

> (and we should enable autopkgtest tests for pint and then this would have
> been caught as soon as babel > 2.8 was uploaded)

Yeah.


Michael
>From eb4e13428a3ede09148b76c71bc5b8cddb169176 Mon Sep 17 00:00:00 2001
From: Hernan 
Date: Wed, 27 Oct 2021 20:36:40 -0300
Subject: [PATCH] Support for babel > 2.8

Close #1400, #1219 and #1296.
---
 pint/formatting.py| 11 ---
 pint/testsuite/test_issues.py |  8 
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/pint/formatting.py b/pint/formatting.py
index a04205dd9..528f4e03e 100644
--- a/pint/formatting.py
+++ b/pint/formatting.py
@@ -333,9 +333,14 @@ def formatter(
 # Don't remove this positional! This is the format used in Babel
 key = pat.replace("{0}", "").strip()
 break
-division_fmt = compound_unit_patterns.get("per", {}).get(
-babel_length, division_fmt
-)
+
+tmp = compound_unit_patterns.get("per", {}).get(babel_length, division_fmt)
+
+try:
+division_fmt = tmp.get("compound", division_fmt)
+except AttributeError:
+division_fmt = tmp
+
 power_fmt = "{}{}"
 exp_call = _pretty_fmt_exponent
 if value == 1:
diff --git a/pint/testsuite/test_issues.py b/pint/testsuite/test_issues.py
index ed781b72f..9d4167c02 100644
--- a/pint/testsuite/test_issues.py
+++ b/pint/testsuite/test_issues.py
@@ -824,6 +824,14 @@ def test_issue_1300(self):
 m = ureg.Measurement(1, 0.1, "meter")
 assert m.default_format == "~P"
 
+def test_issue_1400(self, sess_registry):
+q1 = 3 * sess_registry.W
+q2 = 3 * sess_registry.W / sess_registry.cm
+assert q1.format_babel("~", locale="es_Ar") == "3 W"
+assert q1.format_babel("", locale="es_Ar") == "3 vatios"
+assert q2.format_babel("~", locale="es_Ar") == "3.0 W / cm"
+assert q2.format_babel("", locale="es_Ar") == "3.0 vatios por centímetros"
+
 
 if np is not None:
 


Bug#1022469: python-pint: FTBFS: dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.10 returned exit code 13

2022-11-23 Thread Stuart Prescott
pint is incompatible with babel > 2.8; unfortunately, Debian now has 
babel 2.10.


So far, upstream has only noted the compatibility with version pinning.

https://github.com/hgrecco/pint/issues/1219

Upstream tests for newer releases of pint also now fail due to this same 
reason.


(and we should enable autopkgtest tests for pint and then this would 
have been caught as soon as babel > 2.8 was uploaded)



--
Stuart Prescotthttp://www.nanonanonano.net/   stu...@nanonanonano.net
Debian Developer   http://www.debian.org/ stu...@debian.org
GPG fingerprint90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7



Bug#1022469: python-pint: FTBFS: dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.10 returned exit code 13

2022-10-23 Thread Lucas Nussbaum
Source: python-pint
Version: 0.18-1
Severity: serious
Justification: FTBFS
Tags: bookworm sid ftbfs
User: lu...@debian.org
Usertags: ftbfs-20221023 ftbfs-bookworm

Hi,

During a rebuild of all packages in sid, your package failed to build
on amd64.


Relevant part (hopefully):
>  debian/rules binary
> dh binary --with python3,sphinxdoc --buildsystem=pybuild
>dh_update_autotools_config -O--buildsystem=pybuild
>dh_autoreconf -O--buildsystem=pybuild
>dh_auto_configure -O--buildsystem=pybuild
> I: pybuild base:240: python3.10 setup.py config 
> running config
>dh_auto_build -O--buildsystem=pybuild
> I: pybuild base:240: /usr/bin/python3 setup.py build 
> running build
> running build_py
> creating /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/__init__.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/registry.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/matplotlib.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/formatting.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/converters.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/util.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/errors.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/quantity.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/registry_helpers.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/definitions.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/babel_names.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/compat.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/numpy_func.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/context.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/_typing.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/measurement.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/unit.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/pint_eval.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> copying pint/systems.py -> 
> /<>/.pybuild/cpython3_3.10_pint/build/pint
> running egg_info
> creating Pint.egg-info
> writing Pint.egg-info/PKG-INFO
> writing dependency_links to Pint.egg-info/dependency_links.txt
> writing requirements to Pint.egg-info/requires.txt
> writing top-level names to Pint.egg-info/top_level.txt
> writing manifest file 'Pint.egg-info/SOURCES.txt'
> reading manifest file 'Pint.egg-info/SOURCES.txt'
> reading manifest template 'MANIFEST.in'
> warning: no files found matching 'BADGES.rst'
> warning: no files found matching 'version.txt'
> warning: no files found matching '*' under directory 'bench'
> no previously-included directories found matching 'docs/_build'
> no previously-included directories found matching 'docs/_themes/.git'
> warning: no previously-included files found matching '.editorconfig'
> warning: no previously-included files found matching 'bors.toml'
> warning: no previously-included files found matching 
> 'pull_request_template.md'
> warning: no previously-included files found matching 'requirements_docs.txt'
> warning: no previously-included files found matching 'version.py'
> warning: no previously-included files matching '*.pyc' found anywhere in 
> distribution
> warning: no previously-included files matching '*~' found anywhere in 
> distribution
> warning: no previously-included files matching '.DS_Store' found anywhere in 
> distribution
> warning: no previously-included files matching '*__pycache__*' found anywhere 
> in distribution
> warning: no previously-included files matching '*.pyo' found anywhere in 
> distribution
> warning: no previously-included files matching '.travis-exclude.yml' found 
> anywhere in distribution
> adding license file 'LICENSE'
> adding license file 'AUTHORS'
> writing manifest file 'Pint.egg-info/SOURCES.txt'
> /usr/lib/python3/dist-packages/setuptools/command/build_py.py:202: 
> SetuptoolsDeprecationWarning: Installing 'pint.testsuite' as data is 
> deprecated, please list it in `packages`.
> !!
> 
> 
> 
> # Package would be ignored #
> 
> Python recognizes 'pint.testsuite' as an importable package,
> but it is not listed in the `packages` configuration of setuptools.
> 
> 'pint.testsuite' has been automatically added to the distribution only
> because it may contain data files, but this behavior is likely to change
> in future versions of setuptools (and therefore is considered deprecated).
> 
> Please make sure that 'pint.testsuite' is included as a package by using
> the `packages` configuration field or the proper discovery methods
> (for example by using `find_namespace_packages(...)`/`find_namespace:`
> instead of `find_packages(...)`/`find:`).
> 
> You can read more about "package discovery" and