Hello community,

here is the log from the commit of package python-imagesize for 
openSUSE:Factory checked in at 2020-03-08 22:21:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-imagesize (Old)
 and      /work/SRC/openSUSE:Factory/.python-imagesize.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-imagesize"

Sun Mar  8 22:21:52 2020 rev:7 rq:780403 version:1.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-imagesize/python-imagesize.changes        
2019-05-09 14:27:31.865817017 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-imagesize.new.26092/python-imagesize.changes 
    2020-03-08 22:21:54.391994870 +0100
@@ -1,0 +2,7 @@
+Fri Feb 28 22:43:08 UTC 2020 - Dirk Mueller <dmuel...@suse.com>
+
+- update to 1.2.0:
+  * add SVG testsuite
+  * Python 3.8 compat
+
+-------------------------------------------------------------------

Old:
----
  imagesize-1.1.0.tar.gz

New:
----
  imagesize-1.2.0.tar.gz

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

Other differences:
------------------
++++++ python-imagesize.spec ++++++
--- /var/tmp/diff_new_pack.bTWYTm/_old  2020-03-08 22:21:55.399995492 +0100
+++ /var/tmp/diff_new_pack.bTWYTm/_new  2020-03-08 22:21:55.411995500 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-imagesize
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,12 +18,12 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-imagesize
-Version:        1.1.0
+Version:        1.2.0
 Release:        0
 Summary:        Getting image size from PNG/JPEG/JPEG2000/GIF files
 License:        MIT
 Group:          Development/Languages/Python
-Url:            https://github.com/shibukawa/imagesize_py
+URL:            https://github.com/shibukawa/imagesize_py
 Source:         
https://files.pythonhosted.org/packages/source/i/imagesize/imagesize-%{version}.tar.gz
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  python-rpm-macros

++++++ imagesize-1.1.0.tar.gz -> imagesize-1.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.1.0/MANIFEST.in 
new/imagesize-1.2.0/MANIFEST.in
--- old/imagesize-1.1.0/MANIFEST.in     2018-02-15 06:26:10.000000000 +0100
+++ new/imagesize-1.2.0/MANIFEST.in     2019-12-26 16:53:43.000000000 +0100
@@ -1,2 +1,3 @@
 include LICENSE.rst
-graft test
+include test/*.py
+include test/images/*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.1.0/PKG-INFO new/imagesize-1.2.0/PKG-INFO
--- old/imagesize-1.1.0/PKG-INFO        2018-09-03 04:07:59.000000000 +0200
+++ new/imagesize-1.2.0/PKG-INFO        2019-12-26 17:13:14.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: imagesize
-Version: 1.1.0
+Version: 1.2.0
 Summary: Getting image size from png/jpeg/jpeg2000/gif file
 Home-page: https://github.com/shibukawa/imagesize_py
 Author: Yoshiki Shibukawa
@@ -14,6 +14,7 @@
         * JPEG2000
         * GIF
         * TIFF (experimental)
+        * SVG
         
         This is a pure Python library.
         
@@ -31,6 +32,7 @@
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Multimedia :: Graphics
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.1.0/README.rst 
new/imagesize-1.2.0/README.rst
--- old/imagesize-1.1.0/README.rst      2018-08-30 17:15:06.000000000 +0200
+++ new/imagesize-1.2.0/README.rst      2019-12-26 17:09:43.000000000 +0100
@@ -4,7 +4,7 @@
 .. image:: https://travis-ci.org/shibukawa/imagesize_py.svg?branch=master
     :target: https://travis-ci.org/shibukawa/imagesize_py
 
-This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF image headers and returns 
image size.
+This module analyzes JPEG/JPEG 2000/PNG/GIF/TIFF/SVG image headers and returns 
image size.
 
 .. code:: python
 
@@ -21,6 +21,12 @@
 * ``imagesize.get(filepath)``
 
   Returns image size (width, height).
+  ``get_from_bytes(bytes)`` is for bytes.
+
+* ``imagesize.getDPI(filepath)``
+
+  Returns DPI value.
+  ``getDPI_from_bytes(bytes)`` is for bytes.
 
 Benchmark
 ------------
@@ -55,7 +61,7 @@
 
 .. code:: bash
 
-   python -m unittestt
+   python -m unittest
 
 License
 -----------
@@ -83,4 +89,6 @@
 * Jon Dufresne (https://github.com/jdufresne)
 * Geoff Lankow (https://github.com/darktrojan)
 * Hugo (https://github.com/hugovk)
-
+* Jack Cherng (https://github.com/jfcherng)
+* Tyler A. Young (https://github.com/s3cur3)
+* Mark Browning (https://github.com/mabrowning)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.1.0/imagesize.egg-info/PKG-INFO 
new/imagesize-1.2.0/imagesize.egg-info/PKG-INFO
--- old/imagesize-1.1.0/imagesize.egg-info/PKG-INFO     2018-09-03 
04:07:59.000000000 +0200
+++ new/imagesize-1.2.0/imagesize.egg-info/PKG-INFO     2019-12-26 
17:13:13.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: imagesize
-Version: 1.1.0
+Version: 1.2.0
 Summary: Getting image size from png/jpeg/jpeg2000/gif file
 Home-page: https://github.com/shibukawa/imagesize_py
 Author: Yoshiki Shibukawa
@@ -14,6 +14,7 @@
         * JPEG2000
         * GIF
         * TIFF (experimental)
+        * SVG
         
         This is a pure Python library.
         
@@ -31,6 +32,7 @@
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Multimedia :: Graphics
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.1.0/imagesize.egg-info/SOURCES.txt 
new/imagesize-1.2.0/imagesize.egg-info/SOURCES.txt
--- old/imagesize-1.1.0/imagesize.egg-info/SOURCES.txt  2018-09-03 
04:07:59.000000000 +0200
+++ new/imagesize-1.2.0/imagesize.egg-info/SOURCES.txt  2019-12-26 
17:13:13.000000000 +0100
@@ -8,14 +8,12 @@
 imagesize.egg-info/SOURCES.txt
 imagesize.egg-info/dependency_links.txt
 imagesize.egg-info/top_level.txt
-test/.DS_Store
 test/__init__.py
 test/test_get.py
-test/__pycache__/__init__.cpython-36.pyc
-test/__pycache__/test_get.cpython-36.pyc
 test/images/multipage_tiff_example.tif
 test/images/test.gif
 test/images/test.jp2
 test/images/test.jpg
 test/images/test.png
+test/images/test.svg
 test/images/test.tiff
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.1.0/imagesize.py 
new/imagesize-1.2.0/imagesize.py
--- old/imagesize-1.1.0/imagesize.py    2018-09-03 04:03:41.000000000 +0200
+++ new/imagesize-1.2.0/imagesize.py    2019-12-26 16:53:43.000000000 +0100
@@ -1,4 +1,6 @@
+import re
 import struct
+from xml.etree import ElementTree
 
 _UNIT_KM = -3
 _UNIT_100M = -2
@@ -52,15 +54,41 @@
     return density
 
 
+def _convertToPx(value):
+    matched = re.match(r"(\d+)(?:\.\d)?([a-z]*)$", value)
+    if not matched:
+        raise ValueError("unknown length value: %s" % value)
+    else:
+        length, unit = matched.groups()
+        if unit == "":
+            return int(length)
+        elif unit == "cm":
+            return int(length) * 96 / 2.54
+        elif unit == "mm":
+            return int(length) * 96 / 2.54 / 10
+        elif unit == "in":
+            return int(length) * 96
+        elif unit == "pc":
+            return int(length) * 96 / 6
+        elif unit == "pt":
+            return int(length) * 96 / 6
+        elif unit == "px":
+            return int(length)
+        else:
+            raise ValueError("unknown unit type: %s" % unit)
+
+
 def get(filepath):
     """
     Return (width, height) for a given img file content
     no requirements
+    :type filepath: Union[str, pathlib.Path]
+    :rtype Tuple[int, int]
     """
     height = -1
     width = -1
 
-    with open(filepath, 'rb') as fhandle:
+    with open(str(filepath), 'rb') as fhandle:
         head = fhandle.read(24)
         size = len(head)
         # handle GIFs
@@ -108,7 +136,7 @@
                 height, width = struct.unpack('>LL', fhandle.read(8))
             except struct.error:
                 raise ValueError("Invalid JPEG2000 file")
-        # handle big endien TIFF
+        # handle big endian TIFF
         elif size >= 8 and head.startswith(b"\x4d\x4d\x00\x2a"):
             offset = struct.unpack('>L', head[4:8])[0]
             fhandle.seek(offset)
@@ -147,18 +175,29 @@
                     break
             if width == -1 or height == -1:
                 raise ValueError("Invalid TIFF file: width and/or height IDS 
entries are missing.")
+        # handle SVGs
+        elif size >= 5 and head.startswith(b'<?xml'):
+            try:
+                fhandle.seek(0)
+                root = ElementTree.parse(fhandle).getroot()
+                width = _convertToPx(root.attrib["width"])
+                height = _convertToPx(root.attrib["height"])
+            except Exception:
+                raise ValueError("Invalid SVG file")
 
     return width, height
 
 
 def getDPI(filepath):
     """
-    Return (width, height) for a given img file content
+    Return (x DPI, y DPI) for a given img file content
     no requirements
+    :type filepath: Union[str, pathlib.Path]
+    :rtype Tuple[int, int]
     """
     xDPI = -1
     yDPI = -1
-    with open(filepath, 'rb') as fhandle:
+    with open(str(filepath), 'rb') as fhandle:
         head = fhandle.read(24)
         size = len(head)
         # handle GIFs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.1.0/setup.py new/imagesize-1.2.0/setup.py
--- old/imagesize-1.1.0/setup.py        2018-09-03 04:04:55.000000000 +0200
+++ new/imagesize-1.2.0/setup.py        2019-12-26 17:10:15.000000000 +0100
@@ -3,7 +3,7 @@
 from setuptools import setup
 
 setup(name='imagesize',
-      version='1.1.0',
+      version='1.2.0',
       description='Getting image size from png/jpeg/jpeg2000/gif file',
       long_description='''
 It parses image files' header and return image size.
@@ -13,6 +13,7 @@
 * JPEG2000
 * GIF
 * TIFF (experimental)
+* SVG
 
 This is a pure Python library.
 ''',
@@ -37,6 +38,7 @@
           'Programming Language :: Python :: 3.5',
           'Programming Language :: Python :: 3.6',
           'Programming Language :: Python :: 3.7',
+          'Programming Language :: Python :: 3.8',
           'Programming Language :: Python :: Implementation :: CPython',
           'Programming Language :: Python :: Implementation :: PyPy',
           'Topic :: Multimedia :: Graphics'
Binary files old/imagesize-1.1.0/test/.DS_Store and 
new/imagesize-1.2.0/test/.DS_Store differ
Binary files old/imagesize-1.1.0/test/__pycache__/__init__.cpython-36.pyc and 
new/imagesize-1.2.0/test/__pycache__/__init__.cpython-36.pyc differ
Binary files old/imagesize-1.1.0/test/__pycache__/test_get.cpython-36.pyc and 
new/imagesize-1.2.0/test/__pycache__/test_get.cpython-36.pyc differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.1.0/test/images/test.svg 
new/imagesize-1.2.0/test/images/test.svg
--- old/imagesize-1.1.0/test/images/test.svg    1970-01-01 01:00:00.000000000 
+0100
+++ new/imagesize-1.2.0/test/images/test.svg    2019-12-26 16:53:43.000000000 
+0100
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink"; height="60" width="90">
+    <circle cx="40" cy="40" r="24" style="stroke:#000000; fill:#ffffff"/>
+</svg>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/imagesize-1.1.0/test/test_get.py 
new/imagesize-1.2.0/test/test_get.py
--- old/imagesize-1.1.0/test/test_get.py        2018-08-29 01:08:53.000000000 
+0200
+++ new/imagesize-1.2.0/test/test_get.py        2019-12-26 16:53:43.000000000 
+0100
@@ -28,12 +28,17 @@
         self.assertEqual(width, 802)
         self.assertEqual(height, 670)
 
-    def test_bigendien_tiff(self):
+    def test_bigendian_tiff(self):
         width, height = imagesize.get(os.path.join(imagedir, "test.tiff"))
         self.assertEqual(width, 802)
         self.assertEqual(height, 670)
 
-    def test_littleendien_tiff(self):
+    def test_load_svg(self):
+        width, height = imagesize.get(os.path.join(imagedir, "test.svg"))
+        self.assertEqual(width, 90)
+        self.assertEqual(height, 60)
+
+    def test_littleendian_tiff(self):
         width, height = imagesize.get(os.path.join(imagedir, 
"multipage_tiff_example.tif"))
         self.assertEqual(width, 800)
         self.assertEqual(height, 600)


Reply via email to