summaryrefslogtreecommitdiff
path: root/dev-python/python-magic
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-08-25 07:36:27 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-08-25 07:36:27 +0100
commit43793fab84041cfc5c60c0151d1591b8a69fb24a (patch)
tree6208a7f4fc744684fce0f55acbb47511acace498 /dev-python/python-magic
parent28e3d252dc8ac8a5635206dfefe1cfe05058d1db (diff)
gentoo resync : 25.08.2018
Diffstat (limited to 'dev-python/python-magic')
-rw-r--r--dev-python/python-magic/Manifest4
-rw-r--r--dev-python/python-magic/files/python-magic-0.4.15-fix-buffer-test.patch65
-rw-r--r--dev-python/python-magic/files/python-magic-0.4.15-fix-gzip-test.patch19
-rw-r--r--dev-python/python-magic/files/python-magic-0.4.15-fix-jpeg-test.patch49
-rw-r--r--dev-python/python-magic/python-magic-0.4.15-r1.ebuild37
5 files changed, 174 insertions, 0 deletions
diff --git a/dev-python/python-magic/Manifest b/dev-python/python-magic/Manifest
index 9431f385d056..5e12a015c685 100644
--- a/dev-python/python-magic/Manifest
+++ b/dev-python/python-magic/Manifest
@@ -1,5 +1,9 @@
+AUX python-magic-0.4.15-fix-buffer-test.patch 2817 BLAKE2B d8eb024f3e2e3d5e5fa22f9375eb9ada1bdfbf0fecb9b501a2c2938dbfaebcdd0b853ce406536166444f3154618fbceade1940bab112433076e41edfb889a4a5 SHA512 72a9d171c7421f354c504e7a0066e7ba51feb404f28ea3dee26223d44f42ad9f41ad94c7854d81d9510df4967c8a0692664e1a5e8a1444e59fe92f137fbda35f
+AUX python-magic-0.4.15-fix-gzip-test.patch 768 BLAKE2B f97629ea04b4b9ba191087fd1eb3dbb0ed10deb81428754a6edfbd48ac48e0b8ae208b7e9c16e31876d050c9935eaf48165cd97ed58eb5cb72949d0fa221a32c SHA512 790c87209c131c4e394f605669297262b91ca6034309d910902dc19e28691102df0b66cb2392fc8c21727bb16c8af9baf6a316c0b6ca29c9ba542fdb49580e2b
+AUX python-magic-0.4.15-fix-jpeg-test.patch 1768 BLAKE2B 64899d227643a8a09d27e0f7cc5c80ac366cd8e0d70d4ccc076df51794cf0fac14dd1f6e4f5426fe84600bbfdf35fc8e1ea571bab7839f753720fceb575d4658 SHA512 5e31ae71c01334af8e781b2aaeb98da38a68a7772d39e5eb7b231623cb4ac66652a66888a3eae5d35b07cac3024944176a52c4ebf1336b976d68f9c558cbdef5
DIST python-magic-0.4.10.tar.gz 3950 BLAKE2B f672b95082a68ff8fb2c4b50da0d22316456cda4b72b92d4244fdcd47c43bf599821a9577c76d99bc2a3ae578f4ff05aa76efcfcde684f27a06b90e28d58235e SHA512 8dadfd069bbca574a159dc034fca84fb110a3015ba54fa62c715006b586a5fd10373a5108a4847887bd86c6b7f2c4da90dfb7041cd5e4d51829ac1b94b8e1a03
DIST python-magic-0.4.15.gh.tar.gz 75476 BLAKE2B dad4973f69a21d08972e1e29bc92a51bc92f405907cc28f18eb9357029afdf9f1ba68010ce651acd821140d60dc10eb2e04138627fb19d132f185a2831fcea28 SHA512 004d6bfde52d58a9d3019ef4ff8c5b18b6a4206bf89820d3a0ae0ed78813f80dfba422aee9685528f88c990526ba65fa2153ac3b95b8863ce6cb3ebe925bd780
EBUILD python-magic-0.4.10.ebuild 610 BLAKE2B 091ab80438f8026e27a429a92a784455448332bae07ab2a30ca2a368ef196569ac8d75165b32caa12514685f85b6d9282cad4788ccd04499bbbc33efe72ecca6 SHA512 58275f8d490033b415fd2e95caeffbe04ea76bcf39186d33ea830e1f7c8a42bc7996286d7ce4cc8b2f18198325603b3c9f429d2ba91ee0c5041f099384177efb
+EBUILD python-magic-0.4.15-r1.ebuild 1031 BLAKE2B 63b57f9fa50765b4bb6716d42dd52c8dd7b0fd80d5680e74c4767b8c8f85298471c49fbfbb465cc0fed94607aa4cc394ed8d8f8a1f4f3275d663270423089226 SHA512 51f6db84e0242e20935beccdd3f1a380616f3cdedc3c0bc80c9b4017e8c9f1218cab257d67d8efdcf855aa440023e6c543fe79183b21c8cb2f1f00efdef9f054
EBUILD python-magic-0.4.15.ebuild 629 BLAKE2B 3a38065ed1794fd461531a44929040290a0709cff97649ee0de85fa43c7222381a5bd4169eaa775c3f4f50f5977dfd7c6993ab2f56f12c76082da2380ec336b0 SHA512 6ecb50b3293079258c4678e1d8bc315be14d35610b984ae2abc662fe067285fd2f3be75bd5b8a06cb29788b053bbe0abd168d06e17026e4658160f9588857761
MISC metadata.xml 495 BLAKE2B 416789755f00235cc92891f85c214cd6f21751fd4c65df5d73199aac39b73245505b5fbba4b151bc03e92967859facaf8875aa4431e77af8cc9766bb2bec67af SHA512 014c7f81cb02bc8e06ff0f0cebbe15954f48715bcbb2fb34a0d9ab7291447a18359597592f026ac3d5b2082381cc9487257351dbde1bb7a2ed0ed7066563bdfa
diff --git a/dev-python/python-magic/files/python-magic-0.4.15-fix-buffer-test.patch b/dev-python/python-magic/files/python-magic-0.4.15-fix-buffer-test.patch
new file mode 100644
index 000000000000..75a769b6a5f5
--- /dev/null
+++ b/dev-python/python-magic/files/python-magic-0.4.15-fix-buffer-test.patch
@@ -0,0 +1,65 @@
+commit acfda9c26df888741805249f3ec0f60f369fc664
+Author: Louis Sautier <sautier.louis@gmail.com>
+Date: Tue Aug 14 11:14:19 2018 +0200
+
+ Tests: allow differences when reading a buffer or a file, fixes #173
+
+ Also remove the loop in order to avoid analyzing files or buffers for each
+ expected value, replace it with a call to assertIn().
+
+diff --git a/test/test.py b/test/test.py
+index addccc6..67957ee 100755
+--- a/test/test.py
++++ b/test/test.py
+@@ -10,7 +10,7 @@ import magic
+ class MagicTest(unittest.TestCase):
+ TESTDATA_DIR = os.path.join(os.path.dirname(__file__), 'testdata')
+
+- def assert_values(self, m, expected_values):
++ def assert_values(self, m, expected_values, buf_equals_file=True):
+ for filename, expected_value in expected_values.items():
+ try:
+ filename = os.path.join(self.TESTDATA_DIR, filename)
+@@ -21,15 +21,16 @@ class MagicTest(unittest.TestCase):
+ if type(expected_value) is not tuple:
+ expected_value = (expected_value,)
+
+- for i in expected_value:
+- with open(filename, 'rb') as f:
+- buf_value = m.from_buffer(f.read())
++ with open(filename, 'rb') as f:
++ buf_value = m.from_buffer(f.read())
+
+- file_value = m.from_file(filename)
+- if buf_value == i and file_value == i:
+- break
+- else:
+- self.assertTrue(False, "no match for " + repr(expected_value))
++ file_value = m.from_file(filename)
++
++ if buf_equals_file:
++ self.assertEqual(buf_value, file_value)
++
++ for value in (buf_value, file_value):
++ self.assertIn(value, expected_value)
+
+ def test_from_buffer_str_and_bytes(self):
+ m = magic.Magic(mime=True)
+@@ -62,10 +63,14 @@ class MagicTest(unittest.TestCase):
+ 'magic._pyc_': 'python 2.4 byte-compiled',
+ 'test.pdf': 'PDF document, version 1.2',
+ 'test.gz':
+- ('gzip compressed data, was "test", from Unix, last modified: Sun Jun 29 01:32:52 2008',
+- 'gzip compressed data, was "test", last modified: Sun Jun 29 01:32:52 2008, from Unix'),
++ ('gzip compressed data, was "test", from Unix, last '
++ 'modified: Sun Jun 29 01:32:52 2008',
++ 'gzip compressed data, was "test", last modified'
++ ': Sun Jun 29 01:32:52 2008, from Unix',
++ 'gzip compressed data, was "test", last modified'
++ ': Sun Jun 29 01:32:52 2008, from Unix, original size 15'),
+ 'text.txt': 'ASCII text',
+- })
++ }, buf_equals_file=False)
+ finally:
+ del os.environ['TZ']
+
diff --git a/dev-python/python-magic/files/python-magic-0.4.15-fix-gzip-test.patch b/dev-python/python-magic/files/python-magic-0.4.15-fix-gzip-test.patch
new file mode 100644
index 000000000000..d48637139e2f
--- /dev/null
+++ b/dev-python/python-magic/files/python-magic-0.4.15-fix-gzip-test.patch
@@ -0,0 +1,19 @@
+commit e83487a20bacd4f9b33d0478861671bf79468f59
+Author: Louis Sautier <sautier.louis@gmail.com>
+Date: Mon Aug 13 12:15:13 2018 +0200
+
+ Allow x-gzip as MIME type for gzip files, fixes #96
+
+diff --git a/test/test.py b/test/test.py
+index e29335f..e3ee703 100755
+--- a/test/test.py
++++ b/test/test.py
+@@ -54,7 +54,7 @@ class MagicTest(unittest.TestCase):
+ self.assert_values(m, {
+ 'magic._pyc_': 'application/octet-stream',
+ 'test.pdf': 'application/pdf',
+- 'test.gz': 'application/gzip',
++ 'test.gz': ('application/gzip', 'application/x-gzip'),
+ 'text.txt': 'text/plain',
+ b'\xce\xbb'.decode('utf-8'): 'text/plain',
+ b'\xce\xbb': 'text/plain',
diff --git a/dev-python/python-magic/files/python-magic-0.4.15-fix-jpeg-test.patch b/dev-python/python-magic/files/python-magic-0.4.15-fix-jpeg-test.patch
new file mode 100644
index 000000000000..9efb34b6672e
--- /dev/null
+++ b/dev-python/python-magic/files/python-magic-0.4.15-fix-jpeg-test.patch
@@ -0,0 +1,49 @@
+commit 4bda684f8b461cc1f69593799efcf6afe8397756
+Author: Adam Hupp <adam@hupp.org>
+Date: Sat Dec 9 09:09:00 2017 -0800
+
+ fix test for xenial since travis started enabling it
+
+diff --git a/test/test.py b/test/test.py
+index addccc6..c6e2d9c 100755
+--- a/test/test.py
++++ b/test/test.py
+@@ -17,7 +17,7 @@ class MagicTest(unittest.TestCase):
+ except TypeError:
+ filename = os.path.join(self.TESTDATA_DIR.encode('utf-8'), filename)
+
+-
++
+ if type(expected_value) is not tuple:
+ expected_value = (expected_value,)
+
+@@ -37,7 +37,7 @@ class MagicTest(unittest.TestCase):
+ self.assertEqual("text/x-python", m.from_buffer(s))
+ b = b'#!/usr/bin/env python\nprint("foo")'
+ self.assertEqual("text/x-python", m.from_buffer(b))
+-
++
+ def test_mime_types(self):
+ dest = os.path.join(MagicTest.TESTDATA_DIR, b'\xce\xbb'.decode('utf-8'))
+ shutil.copyfile(os.path.join(MagicTest.TESTDATA_DIR, 'lambda'), dest)
+@@ -92,9 +92,9 @@ class MagicTest(unittest.TestCase):
+
+ m = magic.Magic(mime=True)
+ self.assertEqual(m.from_file(filename), 'image/jpeg')
+-
++
+ m = magic.Magic(mime=True, keep_going=True)
+- self.assertEqual(m.from_file(filename), 'image/jpeg')
++ self.assertEqual(m.from_file(filename), 'image/jpeg\\012- application/octet-stream')
+
+
+ def test_rethrow(self):
+@@ -103,7 +103,7 @@ class MagicTest(unittest.TestCase):
+ def t(x,y):
+ raise magic.MagicException("passthrough")
+ magic.magic_buffer = t
+-
++
+ self.assertRaises(magic.MagicException, magic.from_buffer, "hello", True)
+ finally:
+ magic.magic_buffer = old
diff --git a/dev-python/python-magic/python-magic-0.4.15-r1.ebuild b/dev-python/python-magic/python-magic-0.4.15-r1.ebuild
new file mode 100644
index 000000000000..5a23238beb2f
--- /dev/null
+++ b/dev-python/python-magic/python-magic-0.4.15-r1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( pypy{,3} python{2_7,3_{4,5,6,7}} )
+
+inherit distutils-r1
+
+DESCRIPTION="Access the libmagic file type identification library"
+HOMEPAGE="https://github.com/ahupp/python-magic"
+# https://github.com/ahupp/python-magic/pull/178
+SRC_URI="https://github.com/ahupp/python-magic/archive/${PV}.tar.gz -> ${P}.gh.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~hppa ~ia64 ~x86"
+IUSE="test"
+
+RDEPEND="sys-apps/file[-python]"
+BDEPEND="
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ test? ( ${RDEPEND} )
+"
+
+PATCHES=(
+ # https://github.com/ahupp/python-magic/pull/177
+ "${FILESDIR}/${P}-fix-buffer-test.patch"
+ # https://github.com/ahupp/python-magic/pull/176
+ "${FILESDIR}/${P}-fix-gzip-test.patch"
+ # https://github.com/ahupp/python-magic/commit/4bda684f8b461cc1f69593799efcf6afe8397756
+ "${FILESDIR}/${P}-fix-jpeg-test.patch"
+)
+
+python_test() {
+ "${EPYTHON}" test/test.py -v || die "Tests fail with ${EPYTHON}"
+}