[Git][debian-gis-team/glymur][upstream] New upstream version 0.11.2

Antonio Valentino (@antonio.valentino) gitlab at salsa.debian.org
Sat Aug 13 16:25:04 BST 2022



Antonio Valentino pushed to branch upstream at Debian GIS Project / glymur


Commits:
db2acaf3 by Antonio Valentino at 2022-08-13T15:00:04+00:00
New upstream version 0.11.2
- - - - -


7 changed files:

- CHANGES.txt
- docs/source/conf.py
- docs/source/whatsnew/0.11.rst
- glymur/jp2k.py
- glymur/version.py
- setup.cfg
- tests/test_jp2k.py


Changes:

=====================================
CHANGES.txt
=====================================
@@ -1,11 +1,14 @@
+August 9, 2022 - v0.11.2
+    Relax ResolutionBox requirement on child boxes.
+
 August 6, 2022 - v0.11.1
-    Improve efficiency of striped TIFF to tiled JP2 conversion
+    Improve efficiency of striped TIFF to tiled JP2 conversion.
 
 July 29, 2022 - v0.11.0
-    Add options for supporting ResolutionBoxes
-    Fix ctypes interface to C library on windows
-    Add option to convert XMLPacket into UUID box
-    Add option for excluding tags from Exif UUID box
+    Add options for supporting ResolutionBoxes.
+    Fix ctypes interface to C library on windows.
+    Add option to convert XMLPacket into UUID box.
+    Add option for excluding tags from Exif UUID box.
 
 July 16, 2022 - v0.10.2
     Fix appveyor builds


=====================================
docs/source/conf.py
=====================================
@@ -78,7 +78,7 @@ copyright = '2013-2022, John Evans'
 # The short X.Y version.
 version = '0.11'
 # The full version, including alpha/beta/rc tags.
-release = '0.11.1'
+release = '0.11.2'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.


=====================================
docs/source/whatsnew/0.11.rst
=====================================
@@ -2,17 +2,22 @@
 Changes in glymur 0.11
 ######################
 
+*****************
+Changes in 0.11.2
+*****************
+    * Relax requirement on ResolutionBox number of child boxes.
+
 *****************
 Changes in 0.11.1
 *****************
-    * Improve efficiency of striped TIFF to tiled JP2 conversion
+    * Improve efficiency of striped TIFF to tiled JP2 conversion.
 
 
 *****************
 Changes in 0.11.0
 *****************
 
-    * Add options for supporting ResolutionBoxes
-    * Fix ctypes interface to C library on windows
-    * Add option to convert XMLPacket into UUID box
-    * Add option for excluding tags from Exif UUID box
+    * Add options for supporting ResolutionBoxes.
+    * Fix ctypes interface to C library on windows.
+    * Add option to convert XMLPacket into UUID box.
+    * Add option for excluding tags from Exif UUID box.


=====================================
glymur/jp2k.py
=====================================
@@ -276,7 +276,10 @@ class Jp2k(Jp2kBox):
             return
 
         # So now we are basically done writing a JP2/Jp2k file ...
-        if self._capture_resolution is None:
+        if (
+            self._capture_resolution is None
+            and self._display_resolution is None
+        ):
             # ... and we don't have any extra boxes, so go ahead and parse.
             self.parse()
             return
@@ -291,13 +294,22 @@ class Jp2k(Jp2kBox):
         file if we were so instructed.
         """
         with open(self.filename, mode='ab') as f:
-            resc = glymur.jp2box.CaptureResolutionBox(
-                self._capture_resolution[0], self._capture_resolution[1],
-            )
-            resd = glymur.jp2box.DisplayResolutionBox(
-                self._display_resolution[0], self._display_resolution[1],
-            )
-            rbox = glymur.jp2box.ResolutionBox([resc, resd])
+
+            extra_boxes = []
+
+            if self._capture_resolution is not None:
+                resc = glymur.jp2box.CaptureResolutionBox(
+                    self._capture_resolution[0], self._capture_resolution[1],
+                )
+                extra_boxes.append(resc)
+
+            if self._display_resolution is not None:
+                resd = glymur.jp2box.DisplayResolutionBox(
+                    self._display_resolution[0], self._display_resolution[1],
+                )
+                extra_boxes.append(resd)
+
+            rbox = glymur.jp2box.ResolutionBox(extra_boxes)
             rbox.write(f)
 
             # self.box.append(rbox)
@@ -368,16 +380,6 @@ class Jp2k(Jp2kBox):
             )
             raise InvalidJp2kError(msg)
 
-        if (
-            (self._capture_resolution is not None)
-            ^ (self._display_resolution is not None)
-        ):
-            msg = (
-                'The capture_resolution and display resolution keywords must'
-                'both be supplied or neither supplied.'
-            )
-            raise RuntimeError(msg)
-
         if self._readonly and self._capture_resolution is not None:
             msg = (
                 'Capture/Display resolution keyword parameters cannot be '


=====================================
glymur/version.py
=====================================
@@ -21,7 +21,7 @@ from .lib import tiff
 
 # Do not change the format of this next line!  Doing so risks breaking
 # setup.py
-version = "0.11.1"
+version = "0.11.2"
 
 version_tuple = parse(version).release
 


=====================================
setup.cfg
=====================================
@@ -1,6 +1,6 @@
 [metadata]
 name = Glymur
-version = 0.11.1
+version = 0.11.2
 author = 'John Evans'
 author_email = "John Evans" <john.g.evans.ne at gmail.com>
 license = 'MIT'


=====================================
tests/test_jp2k.py
=====================================
@@ -1186,27 +1186,51 @@ class TestJp2k_write(fixtures.MetadataBase):
                 display_resolution=[vresd, hresd],
             )
 
-    def test_one_of_capture_display_resolution_but_not_both(self):
+    def test_capture_resolution_supplied_but_not_display(self):
         """
-        Scenario:  Writing a JP2 is intended, but not both of capture/display
-        resolution key word parameters are supplied.
+        Scenario:  Writing a JP2 is intended, but only a capture resolution
+        box is specified, and not a display resolution box.
 
-        Expected Result:  RuntimeError
+        Expected Result:  No errors, the boxes are validated.
         """
         vresc, hresc = 0.1, 0.2
+
+        j = glymur.Jp2k(
+            self.temp_jp2_filename, data=self.jp2_data,
+            capture_resolution=[vresc, hresc],
+        )
+
+        self.assertEqual(j.box[-1].box_id, 'res ')
+
+        self.assertEqual(j.box[-1].box[0].box_id, 'resc')
+        self.assertEqual(j.box[-1].box[0].vertical_resolution, vresc)
+        self.assertEqual(j.box[-1].box[0].horizontal_resolution, hresc)
+
+        # there's just one child box
+        self.assertEqual(len(j.box[-1].box), 1)
+
+    def test_display_resolution_supplied_but_not_capture(self):
+        """
+        Scenario:  Writing a JP2 is intended, but only a capture resolution
+        box is specified, and not a display resolution box.
+
+        Expected Result:  No errors, the boxes are validated.
+        """
         vresd, hresd = 0.3, 0.4
 
-        with self.assertRaises(RuntimeError):
-            glymur.Jp2k(
-                self.temp_jp2_filename, data=self.jp2_data,
-                capture_resolution=[vresc, hresc],
-            )
+        j = glymur.Jp2k(
+            self.temp_jp2_filename, data=self.jp2_data,
+            display_resolution=[vresd, hresd],
+        )
 
-        with self.assertRaises(RuntimeError):
-            glymur.Jp2k(
-                self.temp_jp2_filename, data=self.jp2_data,
-                display_resolution=[vresd, hresd],
-            )
+        self.assertEqual(j.box[-1].box_id, 'res ')
+
+        self.assertEqual(j.box[-1].box[0].box_id, 'resd')
+        self.assertEqual(j.box[-1].box[0].vertical_resolution, vresd)
+        self.assertEqual(j.box[-1].box[0].horizontal_resolution, hresd)
+
+        # there's just one child box
+        self.assertEqual(len(j.box[-1].box), 1)
 
     def test_no_jp2c_box_in_outermost_jp2_list(self):
         """
@@ -1259,7 +1283,6 @@ class TestJp2k_write(fixtures.MetadataBase):
 
         EXPECTED RESULT:  A TLM segment is detected.
         """
-        breakpoint()
         kwargs = {
             'data': self.jp2_data,
             'tlm': True



View it on GitLab: https://salsa.debian.org/debian-gis-team/glymur/-/commit/db2acaf34c0f4c0075d5f34877fce83367fcc166

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/glymur/-/commit/db2acaf34c0f4c0075d5f34877fce83367fcc166
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20220813/3202c472/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list