From 79a37f54d5d0724baddf96cdb3228740a01098a9b969450ebacfa0c88b4563e6 Mon Sep 17 00:00:00 2001 From: Nico Krapp Date: Wed, 27 Nov 2024 16:10:59 +0000 Subject: [PATCH] Accepting request 1226889 from home:mcalabkova:branches:devel:languages:python - Update to 0.5.7 * Renamed np.product to np.prod as the old name is deprecated in NumPy 2.0. - Add patch new-pythons.patch to fix build with Python 3.13 - Python 2 can be finally gone OBS-URL: https://build.opensuse.org/request/show/1226889 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mrcz?expand=0&rev=9 --- new-pythons.patch | 67 ++++++++++++++++++++++++++++++++++++++++ numpy2.patch | 66 --------------------------------------- python-mrcz-0.5.6.tar.gz | 3 -- python-mrcz-0.5.7.tar.gz | 3 ++ python-mrcz.changes | 8 +++++ python-mrcz.spec | 12 ++----- 6 files changed, 81 insertions(+), 78 deletions(-) create mode 100644 new-pythons.patch delete mode 100644 python-mrcz-0.5.6.tar.gz create mode 100644 python-mrcz-0.5.7.tar.gz diff --git a/new-pythons.patch b/new-pythons.patch new file mode 100644 index 0000000..6b2b09a --- /dev/null +++ b/new-pythons.patch @@ -0,0 +1,67 @@ +From ce031b069262cfd1a21c76bf2d54f7bf31a178c6 Mon Sep 17 00:00:00 2001 +From: Eric Prestat +Date: Sun, 13 Oct 2024 11:21:06 +0100 +Subject: [PATCH 1/2] Remove use of distutils, use packaging library instead + +--- + mrcz/ioMRC.py | 8 ++++---- + requirements.txt | 1 + + utils/update_mrcz_to_0.5.0.py | 1 - + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/utils/update_mrcz_to_0.5.0.py b/utils/update_mrcz_to_0.5.0.py +index ba84d2b..515bd01 100644 +--- a/utils/update_mrcz_to_0.5.0.py ++++ b/utils/update_mrcz_to_0.5.0.py +@@ -1,7 +1,6 @@ + import glob, sys, os, os.path as path + import numpy as np + import mrcz +-from distutils.version import StrictVersion + import shutil + + args = sys.argv + +From 6c196f6602a50f14545c197234e0b8fdd7711e0f Mon Sep 17 00:00:00 2001 +From: Eric Prestat +Date: Sun, 13 Oct 2024 11:57:13 +0100 +Subject: [PATCH 2/2] Fix deprecated `unittest.makeSuite` and explicitly list + python supported version + +--- + mrcz/test_mrcz.py | 4 ++-- + setup.py | 5 +++++ + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/mrcz/test_mrcz.py b/mrcz/test_mrcz.py +index d76f5fa..fe58e38 100644 +--- a/mrcz/test_mrcz.py ++++ b/mrcz/test_mrcz.py +@@ -573,9 +573,9 @@ def test(verbosity=2): + + theSuite = unittest.TestSuite() + +- theSuite.addTest(unittest.makeSuite(PythonMrczTests)) ++ theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(PythonMrczTests)) + if cmrczProg is not None: +- theSuite.addTest(unittest.makeSuite(PythonToCMrczTests)) ++ theSuite.addTest(unittest.defaultTestLoader.loadTestsFromTestCase(PythonToCMrczTests)) + + test_result = unittest.TextTestRunner(verbosity=verbosity).run(theSuite) + return test_result +diff --git a/setup.py b/setup.py +index ebda8b3..47914a7 100644 +--- a/setup.py ++++ b/setup.py +@@ -62,6 +62,11 @@ def exit_with_error(message): + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 ++Programming Language :: Python :: 3.9 ++Programming Language :: Python :: 3.10 ++Programming Language :: Python :: 3.11 ++Programming Language :: Python :: 3.12 ++Programming Language :: Python :: 3.13 + Topic :: Software Development :: Libraries :: Python Modules + Topic :: System :: Archiving :: Compression + Operating System :: Microsoft :: Windows diff --git a/numpy2.patch b/numpy2.patch index e782596..ee5bb28 100644 --- a/numpy2.patch +++ b/numpy2.patch @@ -1,69 +1,3 @@ -From f28e1a2b90c04ac47c586fa7398d1e694029174a Mon Sep 17 00:00:00 2001 -From: Eric Prestat -Date: Sat, 22 Jun 2024 20:02:09 +0100 -Subject: [PATCH 1/5] Replace `np.product` with `np.prod` since it has been - removed in numpy 2 - ---- - mrcz/ioMRC.py | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/mrcz/ioMRC.py b/mrcz/ioMRC.py -index b1184bb..998de75 100644 ---- a/mrcz/ioMRC.py -+++ b/mrcz/ioMRC.py -@@ -318,7 +318,7 @@ def readMRC(MRCfilename, idx=None, endian='le', - header['dimensions'][0] = n - - # This offset will be applied to f.seek(): -- offset = idx * np.product(header['dimensions'][1:])*np.dtype(header['dtype']).itemsize -+ offset = idx * np.prod(header['dimensions'][1:])*np.dtype(header['dtype']).itemsize - - else: - offset = 0 -@@ -331,7 +331,7 @@ def readMRC(MRCfilename, idx=None, endian='le', - else: # Load entire file into memory - dims = header['dimensions'] - if slices > 0: # List of NumPy 2D-arrays -- frame_size = slices * np.product(dims[1:]) -+ frame_size = slices * np.prod(dims[1:]) - n_frames = dims[0] // slices - dtype = header['dtype'] - -@@ -343,12 +343,12 @@ def readMRC(MRCfilename, idx=None, endian='le', - image.append(buffer) - - else: # monolithic NumPy ndarray -- image = np.fromfile(f, dtype=header['dtype'], count=np.product(dims)) -+ image = np.fromfile(f, dtype=header['dtype'], count=np.prod(dims)) - - if header['MRCtype'] == 101: - # Seems the 4-bit is interlaced ... - interlaced_image = image -- image = np.empty(np.product(dims), dtype=header['dtype']) -+ image = np.empty(np.prod(dims), dtype=header['dtype']) - image[0::2] = np.left_shift(interlaced_image,4) / 15 - image[1::2] = np.right_shift(interlaced_image,4) - -@@ -429,7 +429,7 @@ def __MRCZImport(f, header, slices, endian='le', fileConvention='ccpem', - raise NotImplementedError('MRC type 101 (uint4) not supported with return as `list`') - interlaced_image = image - -- image = np.empty(np.product(header['dimensions']), dtype=dtype) -+ image = np.empty(np.prod(header['dimensions']), dtype=dtype) - # Bit-shift and Bit-and to seperate decimated pixels - image[0::2] = np.left_shift(interlaced_image, 4) / 15 - image[1::2] = np.right_shift(interlaced_image, 4) -@@ -872,7 +872,7 @@ def writeMRC(input_image, MRCfilename, meta=None, endian='le', dtype=None, - header['dimensions'] = np.array([idx + input_image.shape[0], header['dimensions'][1], header['dimensions'][2]]) - - # This offset will be applied to f.seek(): -- offset = idx * np.product(header['dimensions'][1:]) * np.dtype(header['dtype']).itemsize -+ offset = idx * np.prod(header['dimensions'][1:]) * np.dtype(header['dtype']).itemsize - - else: - offset = 0 - From 07c01ce360fd3bad884f2a3c03c5f33c0f8348cf Mon Sep 17 00:00:00 2001 From: Eric Prestat Date: Sat, 22 Jun 2024 20:05:46 +0100 diff --git a/python-mrcz-0.5.6.tar.gz b/python-mrcz-0.5.6.tar.gz deleted file mode 100644 index 0f28d56..0000000 --- a/python-mrcz-0.5.6.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8568a9d9fbf3fa8d1097f4b00edd0ed7ab9dcfda97fe236e05076e67b62fae13 -size 56897 diff --git a/python-mrcz-0.5.7.tar.gz b/python-mrcz-0.5.7.tar.gz new file mode 100644 index 0000000..2f0bc74 --- /dev/null +++ b/python-mrcz-0.5.7.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dfb729604436942e912d5034ea2df72ba0055e00b31ec403b113222b827f4fa4 +size 56956 diff --git a/python-mrcz.changes b/python-mrcz.changes index a89f8b8..1bd6c93 100644 --- a/python-mrcz.changes +++ b/python-mrcz.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Wed Nov 27 11:40:39 UTC 2024 - Markéta Machová + +- Update to 0.5.7 + * Renamed np.product to np.prod as the old name is deprecated in NumPy 2.0. +- Add patch new-pythons.patch to fix build with Python 3.13 +- Python 2 can be finally gone + ------------------------------------------------------------------- Mon Sep 9 13:39:13 UTC 2024 - Markéta Machová diff --git a/python-mrcz.spec b/python-mrcz.spec index f32579b..872bf2a 100644 --- a/python-mrcz.spec +++ b/python-mrcz.spec @@ -18,7 +18,7 @@ %{?sle15_python_module_pythons} Name: python-mrcz -Version: 0.5.6 +Version: 0.5.7 Release: 0 Summary: MRCZ meta-compressed image file-format library License: BSD-3-Clause @@ -26,6 +26,8 @@ URL: https://github.com/em-MRCZ/python-mrcz Source: https://github.com/em-MRCZ/python-mrcz/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz # PATCH-FIX-UPSTREAM https://github.com/em-MRCZ/python-mrcz/pull/15 Numpy 2.0 and deprecation fixes Patch: numpy2.patch +# PATCH-FIX-UPSTREAM https://github.com/em-MRCZ/python-mrcz/pull/16 Remove distutils / support python >=3.12 +Patch: new-pythons.patch BuildRequires: %{python_module blosc} BuildRequires: %{python_module numpy} BuildRequires: %{python_module pytest} @@ -36,14 +38,6 @@ BuildRequires: python-rpm-macros Requires: python-numpy Recommends: python-blosc BuildArch: noarch -%if %{with python2} -BuildRequires: python-enum34 -BuildRequires: python-futures -%endif -%ifpython2 -Requires: python-enum34 -Requires: python-futures -%endif %python_subpackages %description