-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock

Please unblock pymoc/0.4.2-1 for stretch.

This fixes a FTBFS on stretch/i386 reported by
Lucas Nussbaum during the full-rebuild.  This was triggered by a
failing testcase on 32-bit systems:

  https://bugs.debian.org/860629
  https://github.com/grahambell/pymoc/issues/3

The fix has come from upstream and arrived within 24 hours; the patch
contains 2-lines of real code changes (in lib/pymoc/io/fits.py).  The
remainder of the diff are two new test case and accompanying
changelog/documentation tweaks.

This would appear to meet criteria 1; (a FTBFS marked as 'serious',
with a targetted fix with optional documentation changes) uploaded via
unstable:

  https://release.debian.org/stretch/freeze_policy.html

Full debdiff attached.

        -Paul

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iD8DBQFY+Motc444tukM+iQRAmRwAKCD2SkybjBrURrCI0pce0t+UskA1ACePnbp
/UU7IwJdFfiUuPPeJKwYlTw=
=J+Lg
-----END PGP SIGNATURE-----

diff -Nru pymoc-0.4.1/CHANGES.txt pymoc-0.4.2/CHANGES.txt
--- pymoc-0.4.1/CHANGES.txt     2016-09-26 13:05:27.000000000 +0200
+++ pymoc-0.4.2/CHANGES.txt     2017-04-20 05:15:32.000000000 +0200
@@ -1,3 +1,8 @@
+0.4.2 2017-04-19
+
+    - Corrected bug reading MOCs in FITS format on 32-bit systems with
+      64-bit NUNIQ columns.
+
 0.4.1 2016-08-08
 
     - Corrected bug in intersection routine.
diff -Nru pymoc-0.4.1/debian/changelog pymoc-0.4.2/debian/changelog
--- pymoc-0.4.1/debian/changelog        2016-09-26 13:12:24.000000000 +0200
+++ pymoc-0.4.2/debian/changelog        2017-04-20 15:21:00.000000000 +0200
@@ -1,3 +1,10 @@
+pymoc (0.4.2-1) unstable; urgency=low
+
+  * Import upstream bugfix release (0.4.2)
+  + Fix large FITS import on 32-bit architectures (Closes: #860629)
+
+ -- Paul Sladen <deb...@paul.sladen.org>  Thu, 20 Apr 2017 15:21:00 +0200
+
 pymoc (0.4.1-1) unstable; urgency=low
 
   * Initial release (Closes: #839744)
diff -Nru pymoc-0.4.1/debian/copyright pymoc-0.4.2/debian/copyright
--- pymoc-0.4.1/debian/copyright        2016-09-26 13:12:24.000000000 +0200
+++ pymoc-0.4.2/debian/copyright        2017-04-20 15:21:00.000000000 +0200
@@ -5,7 +5,7 @@
 
 Files: *
 Copyright: 2014-2016, Graham Bell
- 2015-2016, East Asian Observatory
+ 2015-2017, East Asian Observatory
  2013-2014, Science and Technology Facilities Council
 License: GPL-3+
 
diff -Nru pymoc-0.4.1/doc/.gitignore pymoc-0.4.2/doc/.gitignore
--- pymoc-0.4.1/doc/.gitignore  1970-01-01 01:00:00.000000000 +0100
+++ pymoc-0.4.2/doc/.gitignore  2017-04-20 05:15:32.000000000 +0200
@@ -0,0 +1 @@
+/_build
diff -Nru pymoc-0.4.1/.gitignore pymoc-0.4.2/.gitignore
--- pymoc-0.4.1/.gitignore      1970-01-01 01:00:00.000000000 +0100
+++ pymoc-0.4.2/.gitignore      2017-04-20 05:15:32.000000000 +0200
@@ -0,0 +1,5 @@
+*~
+*.pyc
+/MANIFEST
+/build
+/dist
diff -Nru pymoc-0.4.1/lib/pymoc/io/fits.py pymoc-0.4.2/lib/pymoc/io/fits.py
--- pymoc-0.4.1/lib/pymoc/io/fits.py    2016-09-26 13:05:27.000000000 +0200
+++ pymoc-0.4.2/lib/pymoc/io/fits.py    2017-04-20 05:15:32.000000000 +0200
@@ -1,4 +1,5 @@
 # Copyright (C) 2013-2014 Science and Technology Facilities Council.
+# Copyright (C) 2017 East Asian Observatory.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -143,8 +144,12 @@
     current_order = None
     current_cells = []
 
+    # Determine type to use for orders: 32 bit if column type is J,
+    # otherwise assume we need 64 bit.
+    moc_type = np.int32 if (hdu.data.formats[0] == 'J') else np.int64
+
     nuniqs = hdu.data.field(0)
-    orders = (np.log2(nuniqs / 4) / 2).astype(int)
+    orders = (np.log2(nuniqs / 4) / 2).astype(moc_type)
     cells = nuniqs - 4 * (4 ** orders)
 
     for (order, cell) in izip(orders, cells):
diff -Nru pymoc-0.4.1/lib/pymoc/version.py pymoc-0.4.2/lib/pymoc/version.py
--- pymoc-0.4.1/lib/pymoc/version.py    2016-09-26 13:05:27.000000000 +0200
+++ pymoc-0.4.2/lib/pymoc/version.py    2017-04-20 05:15:32.000000000 +0200
@@ -13,4 +13,4 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-version = '0.4.1'
+version = '0.4.2'
diff -Nru pymoc-0.4.1/test/test_ascii.py pymoc-0.4.2/test/test_ascii.py
--- pymoc-0.4.1/test/test_ascii.py      2016-09-26 13:05:27.000000000 +0200
+++ pymoc-0.4.2/test/test_ascii.py      2017-04-20 05:15:32.000000000 +0200
@@ -40,3 +40,28 @@
         write_moc_ascii(moc, file=out)
 
         self.assertEqual(out.getvalue(), test_ascii_sorted)
+
+    def test_ascii_large(self):
+        orig = MOC()
+        orig.add(29, [
+            3458700000000000000, 3458700000000000007,
+            3458700000000000008, 3458700000000000009,
+        ])
+
+        out = StringIO()
+        write_moc_ascii(orig, file=out)
+        text = out.getvalue()
+
+        self.assertEqual(
+            text, '29/3458700000000000000,'
+            '3458700000000000007-3458700000000000009')
+
+        copy = MOC()
+        in_ = StringIO(text)
+        read_moc_ascii(copy, file=in_)
+
+        self.assertEqual(copy.order, 29)
+        self.assertEqual(copy.cells, 4)
+        self.assertEqual(copy[29], frozenset([
+            3458700000000000000, 3458700000000000007,
+            3458700000000000008, 3458700000000000009]))
diff -Nru pymoc-0.4.1/test/test_json.py pymoc-0.4.2/test/test_json.py
--- pymoc-0.4.1/test/test_json.py       2016-09-26 13:05:27.000000000 +0200
+++ pymoc-0.4.2/test/test_json.py       2017-04-20 05:15:32.000000000 +0200
@@ -39,3 +39,28 @@
         write_moc_json(moc, file=out)
 
         self.assertEqual(out.getvalue(), test_json)
+
+    def test_json_large(self):
+        orig = MOC()
+        orig.add(29, [
+            3458700000000000000, 3458700000000000007,
+            3458700000000000008, 3458700000000000009,
+        ])
+
+        out = BytesIO()
+        write_moc_json(orig, file=out)
+        json = out.getvalue()
+
+        self.assertEqual(
+            json, b'{"29":[3458700000000000000,3458700000000000007,'
+            b'3458700000000000008,3458700000000000009]}')
+
+        copy = MOC()
+        in_ = BytesIO(json)
+        read_moc_json(copy, file=in_)
+
+        self.assertEqual(copy.order, 29)
+        self.assertEqual(copy.cells, 4)
+        self.assertEqual(copy[29], frozenset([
+            3458700000000000000, 3458700000000000007,
+            3458700000000000008, 3458700000000000009]))

Reply via email to