Accepting request 1226942 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/1226942 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mrcz?expand=0&rev=4
This commit is contained in:
commit
f913534f52
67
new-pythons.patch
Normal file
67
new-pythons.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From ce031b069262cfd1a21c76bf2d54f7bf31a178c6 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Prestat <eric.prestat@gmail.com>
|
||||
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 <eric.prestat@gmail.com>
|
||||
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
|
66
numpy2.patch
66
numpy2.patch
@ -1,69 +1,3 @@
|
||||
From f28e1a2b90c04ac47c586fa7398d1e694029174a Mon Sep 17 00:00:00 2001
|
||||
From: Eric Prestat <eric.prestat@gmail.com>
|
||||
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 <eric.prestat@gmail.com>
|
||||
Date: Sat, 22 Jun 2024 20:05:46 +0100
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8568a9d9fbf3fa8d1097f4b00edd0ed7ab9dcfda97fe236e05076e67b62fae13
|
||||
size 56897
|
3
python-mrcz-0.5.7.tar.gz
Normal file
3
python-mrcz-0.5.7.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:dfb729604436942e912d5034ea2df72ba0055e00b31ec403b113222b827f4fa4
|
||||
size 56956
|
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 27 11:40:39 UTC 2024 - Markéta Machová <mmachova@suse.com>
|
||||
|
||||
- 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á <mmachova@suse.com>
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user