pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/py-magic py-magic: updated to 0.4.22



details:   https://anonhg.NetBSD.org/pkgsrc/rev/6fbd5bc397f2
branches:  trunk
changeset: 447245:6fbd5bc397f2
user:      adam <adam%pkgsrc.org@localhost>
date:      Thu Feb 18 12:29:54 2021 +0000

description:
py-magic: updated to 0.4.22

Changes to 0.4.21, 0.4.22

 - Unify dll loader between the standard and compat library, fixing load
 failures on some previously supported platforms.

Changes to 0.4.20

- merge in a compatability layer for the upstream libmagic python binding.
  Since both this package and that one are called 'magic', this compat layer
  removes a very common source of runtime errors.  Use of that libmagic API will
  produce a deprecation warning.

- support python 3.9 in tests and pypi metadata

- add support for magic_descriptor functions, which take a file descriptor
  rather than a filename.

- sometimes the returned description includes snippets of the file, e.g a title
  for MS Word docs.  Since this is in an unknown encoding, we would throw a
  unicode decode error trying to decode.  Now, it decodes with
  'backslashreplace' to handle this more gracefully.  The undecodable characters
  are replaced with hex escapes.

- add support for MAGIC_EXTENSION, to return possible file extensions.

- add mypy typing stubs file, for type checking

diffstat:

 sysutils/py-magic/Makefile                      |   7 +++----
 sysutils/py-magic/PLIST                         |  14 ++++++++++----
 sysutils/py-magic/distinfo                      |  12 ++++++------
 sysutils/py-magic/patches/patch-magic.py        |  15 ---------------
 sysutils/py-magic/patches/patch-magic_loader.py |  23 +++++++++++++++++++++++
 5 files changed, 42 insertions(+), 29 deletions(-)

diffs (100 lines):

diff -r da4298e86808 -r 6fbd5bc397f2 sysutils/py-magic/Makefile
--- a/sysutils/py-magic/Makefile        Thu Feb 18 11:14:56 2021 +0000
+++ b/sysutils/py-magic/Makefile        Thu Feb 18 12:29:54 2021 +0000
@@ -1,8 +1,7 @@
-# $NetBSD: Makefile,v 1.9 2020/10/04 18:15:43 js Exp $
+# $NetBSD: Makefile,v 1.10 2021/02/18 12:29:54 adam Exp $
 
-DISTNAME=      python-magic-0.4.18
-PKGNAME=       ${DISTNAME:S/python/${PYPKGPREFIX}/1}
-PKGREVISION=   1
+DISTNAME=      python-magic-0.4.22
+PKGNAME=       ${PYPKGPREFIX}-${DISTNAME:S/^python-//}
 CATEGORIES=    sysutils python
 MASTER_SITES=  ${MASTER_SITE_PYPI:=p/python-magic/}
 
diff -r da4298e86808 -r 6fbd5bc397f2 sysutils/py-magic/PLIST
--- a/sysutils/py-magic/PLIST   Thu Feb 18 11:14:56 2021 +0000
+++ b/sysutils/py-magic/PLIST   Thu Feb 18 12:29:54 2021 +0000
@@ -1,8 +1,14 @@
-@comment $NetBSD: PLIST,v 1.2 2020/05/08 13:57:19 adam Exp $
+@comment $NetBSD: PLIST,v 1.3 2021/02/18 12:29:54 adam Exp $
 ${PYSITELIB}/${EGG_INFODIR}/PKG-INFO
 ${PYSITELIB}/${EGG_INFODIR}/SOURCES.txt
 ${PYSITELIB}/${EGG_INFODIR}/dependency_links.txt
 ${PYSITELIB}/${EGG_INFODIR}/top_level.txt
-${PYSITELIB}/magic.py
-${PYSITELIB}/magic.pyc
-${PYSITELIB}/magic.pyo
+${PYSITELIB}/magic/__init__.py
+${PYSITELIB}/magic/__init__.pyc
+${PYSITELIB}/magic/__init__.pyo
+${PYSITELIB}/magic/compat.py
+${PYSITELIB}/magic/compat.pyc
+${PYSITELIB}/magic/compat.pyo
+${PYSITELIB}/magic/loader.py
+${PYSITELIB}/magic/loader.pyc
+${PYSITELIB}/magic/loader.pyo
diff -r da4298e86808 -r 6fbd5bc397f2 sysutils/py-magic/distinfo
--- a/sysutils/py-magic/distinfo        Thu Feb 18 11:14:56 2021 +0000
+++ b/sysutils/py-magic/distinfo        Thu Feb 18 12:29:54 2021 +0000
@@ -1,7 +1,7 @@
-$NetBSD: distinfo,v 1.6 2020/10/04 18:15:43 js Exp $
+$NetBSD: distinfo,v 1.7 2021/02/18 12:29:54 adam Exp $
 
-SHA1 (python-magic-0.4.18.tar.gz) = b48c84ef096baaf10b4f7cb3792ef8328c946c81
-RMD160 (python-magic-0.4.18.tar.gz) = 54bd572566e60eec7e8b2652ecc6d287ff300d56
-SHA512 (python-magic-0.4.18.tar.gz) = 18c4d75bc762d44f42c44bb52b999930ea570d2dd11d7cb840807e372806dc14164e1b3ea0acb23ccd692177a1a683d4537b01675bc57f06334bcc0f40520e6c
-Size (python-magic-0.4.18.tar.gz) = 11442 bytes
-SHA1 (patch-magic.py) = 54dd70103feb8278601f7dc00731a4f2c6e25f1d
+SHA1 (python-magic-0.4.22.tar.gz) = 36808b9a6138d862d0ac3128b936237191499cd0
+RMD160 (python-magic-0.4.22.tar.gz) = 3a90368e41f15584565321408145ba481e6c3680
+SHA512 (python-magic-0.4.22.tar.gz) = 7c49ba87625abb2fab8f813de85978ce6e9732a5a4be425dc498221008a46a172fd900a42740929964cb0984f925c8d440f4795f5b18fed2b3f8f869092351ff
+Size (python-magic-0.4.22.tar.gz) = 16964 bytes
+SHA1 (patch-magic_loader.py) = 12e8e10dbded41a0a9da885d0e5f50c0471a68bf
diff -r da4298e86808 -r 6fbd5bc397f2 sysutils/py-magic/patches/patch-magic.py
--- a/sysutils/py-magic/patches/patch-magic.py  Thu Feb 18 11:14:56 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-$NetBSD: patch-magic.py,v 1.1 2020/10/04 18:15:43 js Exp $
-
---- magic.py.orig      2020-05-06 02:14:40.000000000 +0000
-+++ magic.py
-@@ -187,8 +187,10 @@ if not libmagic or not libmagic._name:
-                        'win32': windows_dlls,
-                        'cygwin': windows_dlls,
-                        'linux': ['libmagic.so.1'],  # fallback for some Linuxes (e.g. Alpine) where library search does not work # flake8:noqa
-+                       'netbsd': ['libmagic.so.6.0'],  # fallback for running in chroot
-                       }
-     platform = 'linux' if sys.platform.startswith('linux') else sys.platform
-+    platform = 'netbsd' if sys.platform.startswith('netbsd') else sys.platform
-     for dll in platform_to_lib.get(platform, []):
-         try:
-             libmagic = ctypes.CDLL(dll)
diff -r da4298e86808 -r 6fbd5bc397f2 sysutils/py-magic/patches/patch-magic_loader.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/py-magic/patches/patch-magic_loader.py   Thu Feb 18 12:29:54 2021 +0000
@@ -0,0 +1,23 @@
+$NetBSD: patch-magic_loader.py,v 1.1 2021/02/18 12:29:55 adam Exp $
+
+NetBSD support.
+
+--- magic/loader.py.orig       2021-02-18 12:24:08.000000000 +0000
++++ magic/loader.py
+@@ -24,9 +24,15 @@ def load_lib():
+                         'win32': windows_dlls,
+                         'cygwin': windows_dlls,
+                         'linux': ['libmagic.so.1'],
++                        'netbsd': ['libmagic.so.6.0'],
+                         # fallback for some Linuxes (e.g. Alpine) where library search does not work # flake8:noqa
+                         }
+-      platform = 'linux' if sys.platform.startswith('linux') else sys.platform
++      if sys.platform.startswith('linux'):
++          platform = 'linux'
++      elif sys.platform.startswith('netbsd'):
++          platform = 'netbsd'
++      else:
++          sys.platform
+       for dll in platform_to_lib.get(platform, []):
+           try:
+               libmagic = ctypes.CDLL(dll)



Home | Main Index | Thread Index | Old Index