Hello community,

here is the log from the commit of package python-roifile for openSUSE:Factory 
checked in at 2020-11-29 12:30:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-roifile (Old)
 and      /work/SRC/openSUSE:Factory/.python-roifile.new.5913 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-roifile"

Sun Nov 29 12:30:09 2020 rev:2 rq:851333 version:2020.8.13

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-roifile/python-roifile.changes    
2020-08-14 13:11:02.893249493 +0200
+++ /work/SRC/openSUSE:Factory/.python-roifile.new.5913/python-roifile.changes  
2020-11-29 12:30:19.326117107 +0100
@@ -1,0 +2,12 @@
+Thu Nov 26 07:20:28 UTC 2020 - andy great <andythe_gr...@pm.me>
+
+- Update to version 2020.8.13.
+  * Support writing to ZIP file.
+  * Support os.PathLike file names.
+
+-------------------------------------------------------------------
+Sat Aug  1 16:24:41 UTC 2020 - andy great <andythe_gr...@pm.me>
+
+- Update spec file to use python alternative. 
+
+-------------------------------------------------------------------

Old:
----
  roifile-2020.5.28.tar.gz

New:
----
  roifile-2020.8.13.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-roifile.spec ++++++
--- /var/tmp/diff_new_pack.THNLMu/_old  2020-11-29 12:30:19.914117702 +0100
+++ /var/tmp/diff_new_pack.THNLMu/_new  2020-11-29 12:30:19.918117705 +0100
@@ -20,7 +20,7 @@
 %define packagename roifile
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-roifile
-Version:        2020.5.28
+Version:        2020.8.13
 Release:        0
 Summary:        Read and write ImageJ ROI format
 License:        BSD-3-Clause
@@ -32,11 +32,13 @@
 BuildRequires:  python-rpm-macros
 BuildRequires:  %{python_module Cython}
 BuildRequires:  %{python_module numpy >= 1.15.1}
-BuildRequires:  %{python_module matplotlib >= 3.1}
-BuildRequires:  %{python_module tifffile}
+BuildRequires:  %{python_module matplotlib >= 3.2}
+BuildRequires:  %{python_module tifffile >= 2020.8.13}
 Requires:       python-numpy >= 1.15.1
-Requires:       python-matplotlib >= 3.1
-Requires:       python-tifffile
+Requires:       python-matplotlib >= 3.2
+Requires:       python-tifffile >= 2020.8.13
+Requires(post): update-alternatives
+Requires(postun): update-alternatives
 BuildArch:      noarch
 %python_subpackages
 
@@ -56,7 +58,17 @@
 
 %install
 %python_install
+%python_clone -a %{buildroot}%{_bindir}/%{packagename}
+
+
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
+%prepare_alternative %{packagename}
+
+%post
+%python_install_alternative %{packagename}
+
+%postun
+%python_uninstall_alternative %{packagename}
 
 %check
 # Test not given
@@ -64,7 +76,7 @@
 %files %{python_files}
 %doc README.rst
 %license LICENSE
-%{_bindir}/%{packagename}
+%python_alternative %{_bindir}/%{packagename}
 %{python_sitelib}/*egg-info/
 %{python_sitelib}/%{packagename}/
 

++++++ roifile-2020.5.28.tar.gz -> roifile-2020.8.13.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/roifile-2020.5.28/README.rst 
new/roifile-2020.8.13/README.rst
--- old/roifile-2020.5.28/README.rst    2020-05-28 17:10:13.000000000 +0200
+++ new/roifile-2020.8.13/README.rst    2020-08-14 05:40:40.000000000 +0200
@@ -15,21 +15,23 @@
 
 :License: BSD 3-Clause
 
-:Version: 2020.5.28
+:Version: 2020.8.13
 
 Requirements
 ------------
-* `CPython >= 3.6 <https://www.python.org>`_
+* `CPython >= 3.7 <https://www.python.org>`_
 * `Numpy 1.15.1 <https://www.numpy.org>`_
-* `Tifffile 2020.5.25 <https://pypi.org/project/tifffile/>`_  (optional)
-* `Matplotlib 3.1 <https://pypi.org/project/matplotlib/>`_  (optional)
+* `Tifffile 2020.8.13 <https://pypi.org/project/tifffile/>`_  (optional)
+* `Matplotlib 3.2 <https://pypi.org/project/matplotlib/>`_  (optional)
 
 Revisions
 ---------
+2020.8.13
+    Support writing to ZIP file.
+    Support os.PathLike file names.
 2020.5.28
     Fix int32 to hex color conversion.
     Fix coordinates of closing path.
-2020.5.2
     Fix reading TIFF files with no overlays.
 2020.5.1
     Split positions from counters.
@@ -39,6 +41,9 @@
 Notes
 -----
 
+The ImageJ ROI format cannot store integer coordinate values outside the
+range of -32768 to 32767 (16-bit signed).
+
 Other Python packages handling ImageJ ROIs:
 
 * `ijpython_roi <https://github.com/dwaithe/ijpython_roi>`_
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/roifile-2020.5.28/roifile/roifile.py 
new/roifile-2020.8.13/roifile/roifile.py
--- old/roifile-2020.5.28/roifile/roifile.py    2020-05-28 17:10:13.000000000 
+0200
+++ new/roifile-2020.8.13/roifile/roifile.py    2020-08-14 05:40:40.000000000 
+0200
@@ -45,21 +45,23 @@
 
 :License: BSD 3-Clause
 
-:Version: 2020.5.28
+:Version: 2020.8.13
 
 Requirements
 ------------
-* `CPython >= 3.6 <https://www.python.org>`_
+* `CPython >= 3.7 <https://www.python.org>`_
 * `Numpy 1.15.1 <https://www.numpy.org>`_
-* `Tifffile 2020.5.25 <https://pypi.org/project/tifffile/>`_  (optional)
-* `Matplotlib 3.1 <https://pypi.org/project/matplotlib/>`_  (optional)
+* `Tifffile 2020.8.13 <https://pypi.org/project/tifffile/>`_  (optional)
+* `Matplotlib 3.2 <https://pypi.org/project/matplotlib/>`_  (optional)
 
 Revisions
 ---------
+2020.8.13
+    Support writing to ZIP file.
+    Support os.PathLike file names.
 2020.5.28
     Fix int32 to hex color conversion.
     Fix coordinates of closing path.
-2020.5.2
     Fix reading TIFF files with no overlays.
 2020.5.1
     Split positions from counters.
@@ -69,6 +71,9 @@
 Notes
 -----
 
+The ImageJ ROI format cannot store integer coordinate values outside the
+range of -32768 to 32767 (16-bit signed).
+
 Other Python packages handling ImageJ ROIs:
 
 * `ijpython_roi <https://github.com/dwaithe/ijpython_roi>`_
@@ -109,10 +114,11 @@
 
 """
 
-__version__ = '2020.5.28'
+__version__ = '2020.8.13'
 
 __all__ = ('ImagejRoi', 'ROI_TYPE',  'ROI_SUBTYPE', 'ROI_OPTIONS')
 
+import os
 import sys
 import enum
 import struct
@@ -276,6 +282,7 @@
         For ZIP or TIFF files, return a list of ImagejRoi.
 
         """
+        filename = os.fspath(filename)
         if filename[-4:].lower() == '.tif':
             import tifffile
             with tifffile.TiffFile(filename) as tif:
@@ -400,7 +407,7 @@
                     dtype=self.byteorder + 'u4',
                     buffer=data,
                     offset=counters_offset
-                    )
+                )
                 self.counters = (counters & 0xFF).astype('u1')
                 self.counter_positions = counters >> 8
 
@@ -433,7 +440,7 @@
                 buffer=data,
                 offset=64,
                 order='F'
-                ).copy()
+            ).copy()
 
             if self.subpixelresolution:
                 self.subpixel_coordinates = numpy.ndarray(
@@ -442,7 +449,7 @@
                     buffer=data,
                     offset=64 + self.n_coordinates * 4,
                     order='F'
-                    ).copy()
+                ).copy()
 
         elif self.composite and self.roitype == ROI_TYPE.RECT:
             self.multi_coordinates = numpy.ndarray(
@@ -450,17 +457,34 @@
                 dtype=self.byteorder + 'f4',
                 buffer=data,
                 offset=64
-                ).copy()
+            ).copy()
 
         elif self.roitype not in (ROI_TYPE.RECT, ROI_TYPE.LINE, ROI_TYPE.OVAL):
             log_warning(f'cannot handle ImagejRoi type {self.roitype!r}')
 
         return self
 
-    def tofile(self, filename):
-        """Write ImagejRoi to a new ROI file."""
-        with open(filename, 'wb') as fh:
-            fh.write(self.tobytes())
+    def tofile(self, filename, name=None, mode=None):
+        """Write ImagejRoi to a ROI or ZIP file.
+
+        Existing ZIP files are opened for append.
+
+        """
+        filename = os.fspath(filename)
+        if filename[-4:].lower() == '.zip':
+            import zipfile
+            if name is None:
+                name = self.name if self.name else self.autoname
+            if name[-4:].lower() != '.roi':
+                name += '.roi'
+            if mode is None:
+                mode = 'a' if os.path.exists(filename) else 'w'
+            with zipfile.ZipFile(filename, mode) as zf:
+                with zf.open(name, 'w') as fh:
+                    fh.write(self.tobytes())
+        else:
+            with open(filename, 'wb') as fh:
+                fh.write(self.tobytes())
 
     def tobytes(self):
         """Return ImagejRoi as bytes."""
@@ -700,15 +724,17 @@
                  [self.left, self.bottom],
                  [self.right, self.bottom],
                  [self.right, self.top],
-                 [self.left, self.top]], 'f4')
+                 [self.left, self.top]],
+                'f4'
+            )
         else:
             coords = numpy.empty((0, 2), dtype=self.byteorder + 'i4')
         return [coords] if multi else coords
 
-    def hexcolor(self, b):
+    def hexcolor(self, b, default=None):
         """Return color (bytes) as hex triplet or None if black."""
         if b == ROI_COLOR_NONE:
-            return None
+            return default
         if self.byteorder == '>':
             return f'#{b[1]:02x}{b[2]:02x}{b[3]:02x}'
         return f'#{b[3]:02x}{b[2]:02x}{b[1]:02x}'
@@ -777,6 +803,17 @@
             ))
 
     @property
+    def autoname(self):
+        """Return name generated from positions."""
+        y = (self.bottom - self.top) // 2
+        x = (self.right - self.left) // 2
+        name = f'{y:05}-{x:05}'
+        if self.counter_positions is not None:
+            tzc = int(self.counter_positions.max())
+            name = f'{tzc:05}-' + name
+        return name
+
+    @property
     def utf16(self):
         """Return UTF-16 codec depending on byteorder."""
         return 'utf-16' + ('be' if self.byteorder == '>' else 'le')
@@ -814,6 +851,7 @@
 
 def test_imagejroi():
     """Test roifile.ImagejRoi class."""
+    # test ROIs from a ZIP file
     rois = ImagejRoi.fromfile('tests/ijzip.zip')
     assert len(rois) == 7
     for roi in rois:
@@ -821,6 +859,16 @@
         roi.coordinates()
         roi.__str__()
 
+    # re-write ROIs to a ZIP file
+    try:
+        os.remove('_test.zip')
+    except OSError:
+        pass
+    for roi in rois:
+        roi.tofile('_test.zip')
+    assert ImagejRoi.fromfile('_test.zip')[-1] == rois[-1]
+
+    # verify box_combined
     roi = ImagejRoi.fromfile('tests/box_combined.roi')
     assert roi.tobytes() == ImagejRoi.frombytes(roi.tobytes()).tobytes()
     assert roi.name == '0464-0752'
@@ -834,6 +882,7 @@
     assert roi.multi_coordinates[0] == 0.0
     roi.__str__()
 
+    # read a ROI from a TIFF file
     for roi in ImagejRoi.fromfile('tests/IJMetadata.tif'):
         assert roi == ImagejRoi.frombytes(roi.tobytes())
         roi.coordinates()
@@ -850,7 +899,6 @@
     ``python -m roifile file_or_directory``
 
     """
-    import os
     from glob import glob
 
     if argv is None:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/roifile-2020.5.28/setup.py 
new/roifile-2020.8.13/setup.py
--- old/roifile-2020.5.28/setup.py      2020-05-28 17:10:13.000000000 +0200
+++ new/roifile-2020.8.13/setup.py      2020-08-14 05:40:40.000000000 +0200
@@ -39,8 +39,13 @@
     long_description=readme,
     author='Christoph Gohlke',
     author_email='cgoh...@uci.edu',
-    url='https://www.lfd.uci.edu/~gohlke/',
     license='BSD',
+    url='https://www.lfd.uci.edu/~gohlke/',
+    project_urls={
+        'Bug Tracker': 'https://github.com/cgohlke/roifile/issues',
+        'Source Code': 'https://github.com/cgohlke/roifile',
+        # 'Documentation': 'https://',
+    },
     packages=['roifile'],
     entry_points={
         'console_scripts': ['roifile = roifile.roifile:main']},
@@ -49,7 +54,7 @@
     extras_require={
         'all': [
             'matplotlib>=3.1',
-            'tifffile>=2020.5.25',
+            'tifffile>=2020.6.3',
         ]
     },
     platforms=['any'],
@@ -60,7 +65,6 @@
         'Intended Audience :: Developers',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 3 :: Only',
-        'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
         'Programming Language :: Python :: 3.9',
_______________________________________________
openSUSE Commits mailing list -- commit@lists.opensuse.org
To unsubscribe, email commit-le...@lists.opensuse.org
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/commit@lists.opensuse.org

Reply via email to