From ecdac123787b96ce6649f0f91da12ea6458cc2b1 Mon Sep 17 00:00:00 2001 From: Palica Date: Tue, 23 Jun 2020 22:35:08 +0200 Subject: Updating liguros repo --- dev-python/python-magic/Manifest | 2 + .../python-magic-0.4.15-fix-buffer-test.patch | 65 ++++++++++++++++++++++ .../python-magic-0.4.15-fix-gzip-test-2.patch | 26 +++++++++ .../files/python-magic-0.4.15-fix-gzip-test.patch | 19 +++++++ .../files/python-magic-0.4.15-fix-jpeg-test.patch | 49 ++++++++++++++++ dev-python/python-magic/metadata.xml | 17 ++++++ .../python-magic/python-magic-0.4.15-r1.ebuild | 39 +++++++++++++ dev-python/python-magic/python-magic-0.4.18.ebuild | 29 ++++++++++ 8 files changed, 246 insertions(+) create mode 100644 dev-python/python-magic/Manifest create mode 100644 dev-python/python-magic/files/python-magic-0.4.15-fix-buffer-test.patch create mode 100644 dev-python/python-magic/files/python-magic-0.4.15-fix-gzip-test-2.patch create mode 100644 dev-python/python-magic/files/python-magic-0.4.15-fix-gzip-test.patch create mode 100644 dev-python/python-magic/files/python-magic-0.4.15-fix-jpeg-test.patch create mode 100644 dev-python/python-magic/metadata.xml create mode 100644 dev-python/python-magic/python-magic-0.4.15-r1.ebuild create mode 100644 dev-python/python-magic/python-magic-0.4.18.ebuild (limited to 'dev-python/python-magic') diff --git a/dev-python/python-magic/Manifest b/dev-python/python-magic/Manifest new file mode 100644 index 000000000000..9bccdda8f9ea --- /dev/null +++ b/dev-python/python-magic/Manifest @@ -0,0 +1,2 @@ +DIST python-magic-0.4.15.gh.tar.gz 75476 BLAKE2B dad4973f69a21d08972e1e29bc92a51bc92f405907cc28f18eb9357029afdf9f1ba68010ce651acd821140d60dc10eb2e04138627fb19d132f185a2831fcea28 SHA512 004d6bfde52d58a9d3019ef4ff8c5b18b6a4206bf89820d3a0ae0ed78813f80dfba422aee9685528f88c990526ba65fa2153ac3b95b8863ce6cb3ebe925bd780 +DIST python-magic-0.4.18.gh.tar.gz 856291 BLAKE2B 882c86d3e8995d1e1b6168637a01f4f8bc86f23390b1c67248baf46d16d574a41789938ccdf0acd83db0652678ab0fa0f6e043eb2c4a75743e5d448e80530da5 SHA512 d5f0047c7537ce0598537629c60aa708623480792d489fa003328b5c6c5b0d42748b6e996f27dc2c164c598813fcf19393567e7ea266a9f0718cf2ddafbd33ac 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 +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-2.patch b/dev-python/python-magic/files/python-magic-0.4.15-fix-gzip-test-2.patch new file mode 100644 index 000000000000..4dd362ebb610 --- /dev/null +++ b/dev-python/python-magic/files/python-magic-0.4.15-fix-gzip-test-2.patch @@ -0,0 +1,26 @@ +From 18c909c4c98463d8292a7d1733aec007f178f1e5 Mon Sep 17 00:00:00 2001 +From: Adam Hupp +Date: Sat, 11 Jan 2020 21:57:24 -0800 +Subject: [PATCH] Hopefully fix #105 + +--- + test/test.py | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/test/test.py b/test/test.py +index 62e8a03..c15227d 100755 +--- a/test/test.py ++++ b/test/test.py +@@ -78,7 +78,11 @@ def test_descriptions(self): + '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'), ++ ': 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' ++ ), + 'text.txt': 'ASCII text', + }, buf_equals_file=False) + finally: 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 +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 +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/metadata.xml b/dev-python/python-magic/metadata.xml new file mode 100644 index 000000000000..35ac56ba5109 --- /dev/null +++ b/dev-python/python-magic/metadata.xml @@ -0,0 +1,17 @@ + + + + + thev00d00@gentoo.org + Ian Whyman + + + python@gentoo.org + Python + + + python-magic + ahupp/python-magic + + gentoo-staging + 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..47ed926109ab --- /dev/null +++ b/dev-python/python-magic/python-magic-0.4.15-r1.ebuild @@ -0,0 +1,39 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( pypy3 python{2_7,3_{6..9}} ) + +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="~alpha amd64 arm hppa ~ia64 ppc ppc64 sparc x86 ~amd64-linux" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND="sys-apps/file[-python]" +BDEPEND=" + test? ( sys-apps/file ) +" + +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" + # https://github.com/ahupp/python-magic/commit/18c909c4c98463d8292a7d1733aec007f178f1e5 + "${FILESDIR}/${P}-fix-gzip-test-2.patch" +) + +python_test() { + "${EPYTHON}" test/test.py -v || die "Tests fail with ${EPYTHON}" +} diff --git a/dev-python/python-magic/python-magic-0.4.18.ebuild b/dev-python/python-magic/python-magic-0.4.18.ebuild new file mode 100644 index 000000000000..681cb207e6ef --- /dev/null +++ b/dev-python/python-magic/python-magic-0.4.18.ebuild @@ -0,0 +1,29 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( pypy3 python{2_7,3_{6..9}} ) + +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="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND="sys-apps/file[-python]" +BDEPEND=" + test? ( sys-apps/file ) +" + +python_test() { + local -x LC_ALL=en_US.UTF-8 + "${EPYTHON}" test/test.py -v || die "Tests fail with ${EPYTHON}" +} -- cgit v1.3.1