aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Weiss <luca@z3ntu.xyz>2020-08-01 21:01:51 +0200
committerLuca Weiss <luca@z3ntu.xyz>2020-08-01 21:57:43 +0200
commit2de37e8913b80f7e59e8b16375e2cf7ea3794d62 (patch)
treef988b1d82aa210ad024ab9c892d9fc015d94c999
parent0e325ff3bedc720deea08ea6231c14f22d0eec27 (diff)
community/py3-magic: fix check()
The mime types seems to have changed recently. Also the gzip output is slightly different now. The same patch fixes the tests on Arch Linux.
-rw-r--r--community/py3-magic/0001-Fix-tests-with-file-5.39.patch51
-rw-r--r--community/py3-magic/APKBUILD8
2 files changed, 56 insertions, 3 deletions
diff --git a/community/py3-magic/0001-Fix-tests-with-file-5.39.patch b/community/py3-magic/0001-Fix-tests-with-file-5.39.patch
new file mode 100644
index 00000000000..f3cc26dc769
--- /dev/null
+++ b/community/py3-magic/0001-Fix-tests-with-file-5.39.patch
@@ -0,0 +1,51 @@
+Patch submitted upstream:
+https://github.com/ahupp/python-magic/pull/219
+
+From 1f500e79077d135afe66ea98a670d8d6e5967b2d Mon Sep 17 00:00:00 2001
+From: Luca Weiss <luca@z3ntu.xyz>
+Date: Sat, 1 Aug 2020 21:13:47 +0200
+Subject: [PATCH] Fix tests with file 5.39
+
+---
+ test/test.py | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/test/test.py b/test/test.py
+index dffefd6..c8c0e80 100755
+--- a/test/test.py
++++ b/test/test.py
+@@ -59,9 +59,9 @@ class MagicTest(unittest.TestCase):
+ def test_from_buffer_str_and_bytes(self):
+ m = magic.Magic(mime=True)
+ s = '#!/usr/bin/env python\nprint("foo")'
+- self.assertEqual("text/x-python", m.from_buffer(s))
++ self.assertEqual("text/x-script.python", m.from_buffer(s))
+ b = b'#!/usr/bin/env python\nprint("foo")'
+- self.assertEqual("text/x-python", m.from_buffer(b))
++ self.assertEqual("text/x-script.python", m.from_buffer(b))
+
+ def test_mime_types(self):
+ dest = os.path.join(MagicTest.TESTDATA_DIR,
+@@ -70,7 +70,7 @@ class MagicTest(unittest.TestCase):
+ try:
+ m = magic.Magic(mime=True)
+ self.assert_values(m, {
+- 'magic._pyc_': 'application/octet-stream',
++ 'magic._pyc_': ('application/octet-stream', 'text/x-bytecode.python'),
+ 'test.pdf': 'application/pdf',
+ 'test.gz': ('application/gzip', 'application/x-gzip'),
+ 'test.snappy.parquet': 'application/octet-stream',
+@@ -97,7 +97,9 @@ class MagicTest(unittest.TestCase):
+ ': Sun Jun 29 01:32:52 2008, from Unix, original size 15',
+ 'gzip compressed data, was "test", '
+ 'last modified: Sun Jun 29 01:32:52 2008, '
+- 'from Unix, original size modulo 2^32 15'
++ 'from Unix, original size modulo 2^32 15',
++ 'gzip compressed data, was "test", last modified'
++ ': Sun Jun 29 01:32:52 2008, from Unix, truncated'
+ ),
+ 'text.txt': 'ASCII text',
+ 'test.snappy.parquet': ('Apache Parquet', 'Par archive data'),
+--
+2.27.0
+
diff --git a/community/py3-magic/APKBUILD b/community/py3-magic/APKBUILD
index d4c91d12665..e499a2328c7 100644
--- a/community/py3-magic/APKBUILD
+++ b/community/py3-magic/APKBUILD
@@ -3,14 +3,15 @@
pkgname=py3-magic
_pkgname=python-magic
pkgver=0.4.18
-pkgrel=0
+pkgrel=1
pkgdesc="Python3 wrapper for libmagic"
url="https://pypi.python.org/pypi/python-magic/"
arch="noarch"
license="MIT"
depends="python3 libmagic"
makedepends="py3-setuptools"
-source="$pkgname-$pkgver.tar.gz::https://github.com/ahupp/$_pkgname/archive/$pkgver.tar.gz"
+source="$pkgname-$pkgver.tar.gz::https://github.com/ahupp/$_pkgname/archive/$pkgver.tar.gz
+ 0001-Fix-tests-with-file-5.39.patch"
builddir="$srcdir/$_pkgname-$pkgver"
replaces="py-magic" # Backwards compatibility
@@ -28,4 +29,5 @@ package() {
python3 setup.py install --prefix=/usr --root="$pkgdir"
}
-sha512sums="d5f0047c7537ce0598537629c60aa708623480792d489fa003328b5c6c5b0d42748b6e996f27dc2c164c598813fcf19393567e7ea266a9f0718cf2ddafbd33ac py3-magic-0.4.18.tar.gz"
+sha512sums="d5f0047c7537ce0598537629c60aa708623480792d489fa003328b5c6c5b0d42748b6e996f27dc2c164c598813fcf19393567e7ea266a9f0718cf2ddafbd33ac py3-magic-0.4.18.tar.gz
+05365dafab2c762511229d95f3a955bf5ae5de24269070ad78d0439e2c1b0ae4032e6729432eaa6032d295451235cd8a799a1410a5df03f329772247209c387e 0001-Fix-tests-with-file-5.39.patch"