[Debian-astro-maintainers] Bug#1027191: astropy: autopkgtest fail with numpy/1.24.1

Sebastiaan Couwenberg sebastic at xs4all.nl
Mon Jan 9 10:55:49 GMT 2023


Control: tags -1 fixed-upstream patch

Upstream has already fixed the Numpy compatibility:

  https://github.com/astropy/astropy/pull/14193

The attached patch resolves this issue by including those changes.

Kind Regards,

Bas

-- 
  GPG Key ID: 4096R/6750F10AE88D4AF1
Fingerprint: 8182 DE41 7056 408D 6146  50D1 6750 F10A E88D 4AF1
-------------- next part --------------
diff -Nru astropy-5.2/debian/changelog astropy-5.2/debian/changelog
--- astropy-5.2/debian/changelog	2022-12-14 09:26:03.000000000 +0000
+++ astropy-5.2/debian/changelog	2023-01-09 09:54:09.000000000 +0000
@@ -1,3 +1,11 @@
+astropy (5.2-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add upstream patch to fix FTBFS with Numpy 1.24.
+    (closes: #1027191)
+
+ -- Bas Couwenberg <sebastic at debian.org>  Mon, 09 Jan 2023 09:54:09 +0000
+
 astropy (5.2-1) unstable; urgency=medium
 
   * New upstream version 5.2. Switch back to unstable.
diff -Nru astropy-5.2/debian/patches/pr14193-Fix-compat-with-Numpy-1.24.patch astropy-5.2/debian/patches/pr14193-Fix-compat-with-Numpy-1.24.patch
--- astropy-5.2/debian/patches/pr14193-Fix-compat-with-Numpy-1.24.patch	1970-01-01 00:00:00.000000000 +0000
+++ astropy-5.2/debian/patches/pr14193-Fix-compat-with-Numpy-1.24.patch	2023-01-09 09:54:09.000000000 +0000
@@ -0,0 +1,81 @@
+Description: Fix compat with Numpy 1.24
+ The compat code added in #14128 assumed the keepdims change would
+ concern Numpy 1.25, but this change made it to Numpy 1.24.
+Author: Simon Conseil <contact at saimon.org>
+Origin: https://github.com/astropy/astropy/pull/14193
+Bug: https://github.com/astropy/astropy/issues/14189
+Bug-Debian: https://bugs.debian.org/1027191
+
+--- a/astropy/utils/masked/function_helpers.py
++++ b/astropy/utils/masked/function_helpers.py
+@@ -12,7 +12,7 @@ interpreted.
+ import numpy as np
+ 
+ from astropy.units.quantity_helper.function_helpers import FunctionAssigner
+-from astropy.utils.compat import NUMPY_LT_1_23, NUMPY_LT_1_25
++from astropy.utils.compat import NUMPY_LT_1_23, NUMPY_LT_1_24
+ 
+ # This module should not really be imported, but we define __all__
+ # such that sphinx can typeset the functions with docstrings.
+@@ -587,7 +587,7 @@ def median(a, axis=None, out=None, **kwa
+ 
+     a = Masked(a)
+ 
+-    if NUMPY_LT_1_25:
++    if NUMPY_LT_1_24:
+         keepdims = kwargs.pop("keepdims", False)
+         r, k = np.lib.function_base._ureduce(
+             a, func=_masked_median, axis=axis, out=out, **kwargs
+@@ -643,7 +643,7 @@ def quantile(a, q, axis=None, out=None,
+     if not np.lib.function_base._quantile_is_valid(q):
+         raise ValueError("Quantiles must be in the range [0, 1]")
+ 
+-    if NUMPY_LT_1_25:
++    if NUMPY_LT_1_24:
+         keepdims = kwargs.pop("keepdims", False)
+         r, k = np.lib.function_base._ureduce(
+             a, func=_masked_quantile, q=q, axis=axis, out=out, **kwargs
+--- a/astropy/utils/compat/numpycompat.py
++++ b/astropy/utils/compat/numpycompat.py
+@@ -24,5 +24,5 @@ NUMPY_LT_1_21_1 = not minversion(np, "1.
+ NUMPY_LT_1_22 = not minversion(np, "1.22")
+ NUMPY_LT_1_22_1 = not minversion(np, "1.22.1")
+ NUMPY_LT_1_23 = not minversion(np, "1.23")
+-NUMPY_LT_1_24 = not minversion(np, "1.24dev0")
++NUMPY_LT_1_24 = not minversion(np, "1.24")
+ NUMPY_LT_1_25 = not minversion(np, "1.25.0.dev0+151")
+--- a/astropy/units/quantity.py
++++ b/astropy/units/quantity.py
+@@ -1679,27 +1679,32 @@ class Quantity(np.ndarray):
+         self.view(np.ndarray).itemset(*(args[:-1] + (self._to_own_unit(args[-1]),)))
+ 
+     def tostring(self, order="C"):
++        """Not implemented, use ``.value.tostring()`` instead."""
+         raise NotImplementedError(
+             "cannot write Quantities to string.  Write array with"
+             " q.value.tostring(...)."
+         )
+ 
+     def tobytes(self, order="C"):
++        """Not implemented, use ``.value.tobytes()`` instead."""
+         raise NotImplementedError(
+             "cannot write Quantities to bytes.  Write array with q.value.tobytes(...)."
+         )
+ 
+     def tofile(self, fid, sep="", format="%s"):
++        """Not implemented, use ``.value.tofile()`` instead."""
+         raise NotImplementedError(
+             "cannot write Quantities to file.  Write array with q.value.tofile(...)"
+         )
+ 
+     def dump(self, file):
++        """Not implemented, use ``.value.dump()`` instead."""
+         raise NotImplementedError(
+             "cannot dump Quantities to file.  Write array with q.value.dump()"
+         )
+ 
+     def dumps(self):
++        """Not implemented, use ``.value.dumps()`` instead."""
+         raise NotImplementedError(
+             "cannot dump Quantities to string.  Write array with q.value.dumps()"
+         )
diff -Nru astropy-5.2/debian/patches/series astropy-5.2/debian/patches/series
--- astropy-5.2/debian/patches/series	2022-12-14 09:25:53.000000000 +0000
+++ astropy-5.2/debian/patches/series	2023-01-09 09:54:09.000000000 +0000
@@ -12,3 +12,4 @@
 Ignore-invalid-value-warnings-that-happen-on-mips64el.patch
 Temporarily-disable-restriction-for-matplotlib-version.patch
 Ignore-warnings-about-distutils-setuptools-import-order.patch
+pr14193-Fix-compat-with-Numpy-1.24.patch


More information about the Debian-astro-maintainers mailing list