[python-astropy] 02/04: Support numpy 1.9. Closes: #761392

Ole Streicher olebole at moszumanska.debian.org
Sun Sep 14 14:10:47 UTC 2014


This is an automated email from the git hooks/post-receive script.

olebole pushed a commit to branch debian
in repository python-astropy.

commit 9f14e7db71e035d7148c9b62328e0dba718da1e4
Author: Ole Streicher <olebole at debian.org>
Date:   Sun Sep 14 13:53:41 2014 +0200

    Support numpy 1.9. Closes: #761392
---
 debian/changelog                       |  1 +
 debian/patches/series                  |  1 +
 debian/patches/support_numpy_1.9.patch | 59 ++++++++++++++++++++++++++++++++++
 3 files changed, 61 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 93f5c79..8334a8e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 python-astropy (0.4.1+dfsg-2) UNRELEASED; urgency=low
 
   * Disable astropy helper download. Closes: #761055
+  * Support numpy 1.9. Closes: #761392
 
  -- Ole Streicher <olebole at debian.org>  Sun, 14 Sep 2014 13:50:29 +0200
 
diff --git a/debian/patches/series b/debian/patches/series
index e95a3aa..e38b6ef 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 mark_known_failures.patch
 use_extern_ply.patch
 disable_helper_download.patch
+support_numpy_1.9.patch
diff --git a/debian/patches/support_numpy_1.9.patch b/debian/patches/support_numpy_1.9.patch
new file mode 100644
index 0000000..c203f15
--- /dev/null
+++ b/debian/patches/support_numpy_1.9.patch
@@ -0,0 +1,59 @@
+From: Marten van Kerkwijk <mhvk at astro.utoronto.ca>
+Date: Fri, 12 Sep 2014 17:07:43 -0400
+Subject: Support numpy 1.9, adapting Quantity.__eq__, __ne__
+Bug: http://bugs.debian.org/761392
+--- a/astropy/units/quantity.py
++++ b/astropy/units/quantity.py
+@@ -13,6 +13,7 @@
+ import numbers
+ 
+ import numpy as np
++NUMPY_LT_1P9 = [int(x) for x in np.__version__.split('.')[:2]] < [1, 9]
+ 
+ # AstroPy
+ from ..extern import six
+@@ -694,6 +695,34 @@
+         else:
+             return value
+ 
++    if not NUMPY_LT_1P9:
++        # Equality (return False if units do not match) needs to be handled
++        # explicitly for numpy >=1.9, since it no longer traps errors.
++        def __eq__(self, other):
++            try:
++                try:
++                    return super(Quantity, self).__eq__(other)
++                except DeprecationWarning:
++                    # We treat the DeprecationWarning separately, since it may
++                    # mask another Exception.  But we do not want to just use
++                    # np.equal, since super's __eq__ treats recarrays correctly.
++                    return np.equal(self, other)
++            except UnitsError:
++                return False
++            except TypeError:
++                return NotImplemented
++
++        def __ne__(self, other):
++            try:
++                try:
++                    return super(Quantity, self).__ne__(other)
++                except DeprecationWarning:
++                    return np.not_equal(self, other)
++            except UnitsError:
++                return True
++            except TypeError:
++                return NotImplemented
++
+     # Arithmetic operations
+     def __mul__(self, other):
+         """ Multiplication between `Quantity` objects and other objects."""
+--- a/CHANGES.rst
++++ b/CHANGES.rst
+@@ -372,6 +372,7 @@
+     for more details on the motivation behind and implementation of
+     astropy-helpers.  [#1563]
+ 
++- Ensure numpy 1.9 is supported. [#2917]
+ 
+ API Changes
+ ^^^^^^^^^^^

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/python-astropy.git



More information about the debian-science-commits mailing list