[Git][debian-gis-team/metpy][master] New 0003-Fix-compatibility-with-Python-3.12.patch
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Sat Nov 25 16:09:16 GMT 2023
Antonio Valentino pushed to branch master at Debian GIS Project / metpy
Commits:
5428cc07 by Antonio Valentino at 2023-11-25T16:08:45+00:00
New 0003-Fix-compatibility-with-Python-3.12.patch
- - - - -
4 changed files:
- debian/changelog
- debian/patches/arm64.patch → debian/patches/0002-arm64.patch
- + debian/patches/0003-Fix-compatibility-with-Python-3.12.patch
- debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -2,6 +2,9 @@ metpy (1.5.1+ds-4) UNRELEASED; urgency=medium
[ Antonio Valentino ]
* Improve lintian overrides.
+ * debian/patches:
+ - Rename arm64.patch into 0002-arm64.patch.
+ - New 0003-Fix-compatibility-with-Python-3.12.patch (Closes: #1056424).
[ Bas Couwenberg ]
* Switch to dh-sequence-*.
=====================================
debian/patches/arm64.patch → debian/patches/0002-arm64.patch
=====================================
@@ -1,8 +1,14 @@
-Description: Use xfail for test that doesn't fail on arm64.
-Author: Bas Couwenberg <sebastic at debian.org>
+From: Bas Couwenberg <sebastic at debian.org>
+Date: Sat, 25 Nov 2023 15:24:10 +0000
+Subject: Use xfail for test that doesn't fail on arm64.
Forwarded: https://github.com/Unidata/MetPy/pull/3150
+---
+ tests/calc/test_thermo.py | 3 +++
+ 1 file changed, 3 insertions(+)
+diff --git a/tests/calc/test_thermo.py b/tests/calc/test_thermo.py
+index 3119ed1..dc1e7a7 100644
--- a/tests/calc/test_thermo.py
+++ b/tests/calc/test_thermo.py
@@ -3,6 +3,7 @@
@@ -13,7 +19,7 @@ Forwarded: https://github.com/Unidata/MetPy/pull/3150
import sys
import warnings
-@@ -197,6 +198,8 @@ def test_moist_lapse_starting_points(sta
+@@ -197,6 +198,8 @@ def test_moist_lapse_starting_points(start, direction):
assert_almost_equal(temp, truth, 4)
=====================================
debian/patches/0003-Fix-compatibility-with-Python-3.12.patch
=====================================
@@ -0,0 +1,110 @@
+From: Antonio Valentino <antonio.valentino at tiscali.it>
+Date: Sat, 25 Nov 2023 15:53:51 +0000
+Subject: Fix compatibility with Python 3.12
+
+Origin: https://github.com/Unidata/MetPy
+forwarded: not-needed
+---
+ src/metpy/io/_tools.py | 28 +++++++++++++++++++---------
+ tests/calc/test_thermo.py | 4 ++--
+ 2 files changed, 21 insertions(+), 11 deletions(-)
+
+diff --git a/src/metpy/io/_tools.py b/src/metpy/io/_tools.py
+index ef2e5ee..174566c 100644
+--- a/src/metpy/io/_tools.py
++++ b/src/metpy/io/_tools.py
+@@ -57,7 +57,7 @@ def open_as_needed(filename, mode='rb'):
+ return open(filename, mode, **kwargs) # noqa: SIM115
+
+
+-class NamedStruct(Struct):
++class NamedStruct:
+ """Parse bytes using :class:`Struct` but provide named fields."""
+
+ def __init__(self, info, prefmt='', tuple_name=None):
+@@ -73,7 +73,12 @@ class NamedStruct(Struct):
+ elif not i[0]: # Skip items with no name
+ conv_off += 1
+ self._tuple = namedtuple(tuple_name, ' '.join(n for n in names if n))
+- super().__init__(prefmt + ''.join(f for f in fmts if f))
++ self._struct = Struct(prefmt + ''.join(f for f in fmts if f))
++
++ @property
++ def size(self):
++ """Return the size of the struct in bytes."""
++ return self._struct.size
+
+ def _create(self, items):
+ if self.converters:
+@@ -90,11 +95,11 @@ class NamedStruct(Struct):
+
+ def unpack(self, s):
+ """Parse bytes and return a namedtuple."""
+- return self._create(super().unpack(s))
++ return self._create(self._struct.unpack(s))
+
+ def unpack_from(self, buff, offset=0):
+ """Read bytes from a buffer and return as a namedtuple."""
+- return self._create(super().unpack_from(buff, offset))
++ return self._create(self._struct.unpack_from(buff, offset))
+
+ def unpack_file(self, fobj):
+ """Unpack the next bytes from a file object."""
+@@ -103,12 +108,12 @@ class NamedStruct(Struct):
+ def pack(self, **kwargs):
+ """Pack the arguments into bytes using the structure."""
+ t = self.make_tuple(**kwargs)
+- return super().pack(*t)
++ return self._struct.pack(*t)
+
+
+ # This works around times when we have more than 255 items and can't use
+ # NamedStruct. This is a CPython limit for arguments.
+-class DictStruct(Struct):
++class DictStruct:
+ """Parse bytes using :class:`Struct` but provide named fields using dictionary access."""
+
+ def __init__(self, info, prefmt=''):
+@@ -118,18 +123,23 @@ class DictStruct(Struct):
+ # Remove empty names
+ self._names = [n for n in names if n]
+
+- super().__init__(prefmt + ''.join(f for f in formats if f))
++ self._struct = Struct(prefmt + ''.join(f for f in formats if f))
++
++ @property
++ def size(self):
++ """Return the size of the struct in bytes."""
++ return self._struct.size
+
+ def _create(self, items):
+ return dict(zip(self._names, items))
+
+ def unpack(self, s):
+ """Parse bytes and return a dict."""
+- return self._create(super().unpack(s))
++ return self._create(self._struct.unpack(s))
+
+ def unpack_from(self, buff, offset=0):
+ """Unpack the next bytes from a file object."""
+- return self._create(super().unpack_from(buff, offset))
++ return self._create(self._struct.unpack_from(buff, offset))
+
+
+ class Enum:
+diff --git a/tests/calc/test_thermo.py b/tests/calc/test_thermo.py
+index dc1e7a7..59877bb 100644
+--- a/tests/calc/test_thermo.py
++++ b/tests/calc/test_thermo.py
+@@ -141,9 +141,9 @@ def test_moist_lapse_ref_pressure():
+ def test_moist_lapse_multiple_temps():
+ """Test moist_lapse with multiple starting temperatures."""
+ temp = moist_lapse(np.array([1050., 800., 600., 500., 400.]) * units.mbar,
+- np.array([19.85, np.nan, 19.85]) * units.degC, 1000. * units.mbar)
++ np.array([19.85, 25.6, 19.85]) * units.degC, 1000. * units.mbar)
+ true_temp = np.array([[294.76, 284.64, 272.81, 264.42, 252.91],
+- [np.nan, np.nan, np.nan, np.nan, np.nan],
++ [300.35, 291.27, 281.05, 274.05, 264.64],
+ [294.76, 284.64, 272.81, 264.42, 252.91]]) * units.kelvin
+ assert_array_almost_equal(temp, true_temp, 2)
+
=====================================
debian/patches/series
=====================================
@@ -1,2 +1,3 @@
0001-Skip-tests-requiring-internet.patch
-arm64.patch
+0002-arm64.patch
+0003-Fix-compatibility-with-Python-3.12.patch
View it on GitLab: https://salsa.debian.org/debian-gis-team/metpy/-/commit/5428cc072870c748487faaa4bf8cfcb4a09a1162
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/metpy/-/commit/5428cc072870c748487faaa4bf8cfcb4a09a1162
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20231125/f75e8e0f/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list