summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authoradam <adam@pkgsrc.org>2021-02-18 12:29:54 +0000
committeradam <adam@pkgsrc.org>2021-02-18 12:29:54 +0000
commit883a06883c747e13808f068ce543cf1d50ccf00a (patch)
treed340a2fb68f28eef4ca7403f3e1bfa3d03ac286c /sysutils
parentd321bf604d279752478cfe6e9e54f2920812d4d7 (diff)
downloadpkgsrc-883a06883c747e13808f068ce543cf1d50ccf00a.tar.gz
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 (limited to 'sysutils')
-rw-r--r--sysutils/py-magic/Makefile7
-rw-r--r--sysutils/py-magic/PLIST14
-rw-r--r--sysutils/py-magic/distinfo12
-rw-r--r--sysutils/py-magic/patches/patch-magic.py15
-rw-r--r--sysutils/py-magic/patches/patch-magic_loader.py23
5 files changed, 42 insertions, 29 deletions
diff --git a/sysutils/py-magic/Makefile b/sysutils/py-magic/Makefile
index 27e018c683c..da7ab45cf41 100644
--- a/sysutils/py-magic/Makefile
+++ b/sysutils/py-magic/Makefile
@@ -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 --git a/sysutils/py-magic/PLIST b/sysutils/py-magic/PLIST
index 4c990f779ca..c6d3813147b 100644
--- a/sysutils/py-magic/PLIST
+++ b/sysutils/py-magic/PLIST
@@ -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 --git a/sysutils/py-magic/distinfo b/sysutils/py-magic/distinfo
index 311f44be916..4ac9c36d1ab 100644
--- a/sysutils/py-magic/distinfo
+++ b/sysutils/py-magic/distinfo
@@ -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 --git a/sysutils/py-magic/patches/patch-magic.py b/sysutils/py-magic/patches/patch-magic.py
deleted file mode 100644
index 75ec96d808d..00000000000
--- a/sysutils/py-magic/patches/patch-magic.py
+++ /dev/null
@@ -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 --git a/sysutils/py-magic/patches/patch-magic_loader.py b/sysutils/py-magic/patches/patch-magic_loader.py
new file mode 100644
index 00000000000..1a3bb06ab48
--- /dev/null
+++ b/sysutils/py-magic/patches/patch-magic_loader.py
@@ -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)