* [gentoo-commits] repo/gentoo:master commit in: dev-python/python-magic/files/, dev-python/python-magic/
@ 2020-03-03 6:17 Matt Turner
0 siblings, 0 replies; 3+ messages in thread
From: Matt Turner @ 2020-03-03 6:17 UTC (permalink / raw
To: gentoo-commits
commit: d59faf751cc6da052f20b2b6edeb1330a303aac4
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 3 06:15:52 2020 +0000
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Tue Mar 3 06:17:04 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d59faf75
dev-python/python-magic: Add patch to fix tests
Closes: https://bugs.gentoo.org/663610
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
.../python-magic-0.4.15-fix-gzip-test-2.patch | 26 ++++++++++++++++++++++
.../python-magic/python-magic-0.4.15-r1.ebuild | 2 ++
2 files changed, 28 insertions(+)
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 00000000000..4dd362ebb61
--- /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 <adam@hupp.org>
+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/python-magic-0.4.15-r1.ebuild b/dev-python/python-magic/python-magic-0.4.15-r1.ebuild
index 8f25dcdad7e..e17297d1813 100644
--- a/dev-python/python-magic/python-magic-0.4.15-r1.ebuild
+++ b/dev-python/python-magic/python-magic-0.4.15-r1.ebuild
@@ -31,6 +31,8 @@ PATCHES=(
"${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() {
^ permalink raw reply related [flat|nested] 3+ messages in thread* [gentoo-commits] repo/gentoo:master commit in: dev-python/python-magic/files/, dev-python/python-magic/
@ 2023-11-25 16:57 Michał Górny
0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2023-11-25 16:57 UTC (permalink / raw
To: gentoo-commits
commit: 78938c3eb420d3efbdbfdf11c8675cba0c83c541
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 25 16:57:36 2023 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Nov 25 16:57:53 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78938c3e
dev-python/python-magic: Backport more test fixes
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
.../files/python-magic-0.4.27-fix-gzip-test.patch | 26 --------
.../files/python-magic-0.4.27-test.patch | 69 ++++++++++++++++++++++
dev-python/python-magic/python-magic-0.4.27.ebuild | 3 +-
3 files changed, 71 insertions(+), 27 deletions(-)
diff --git a/dev-python/python-magic/files/python-magic-0.4.27-fix-gzip-test.patch b/dev-python/python-magic/files/python-magic-0.4.27-fix-gzip-test.patch
deleted file mode 100644
index 9a978146f32d..000000000000
--- a/dev-python/python-magic/files/python-magic-0.4.27-fix-gzip-test.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-https://github.com/ahupp/python-magic/commit/4ffcd59113fa26d7c2e9d5897b1eef919fd4b457
-
-From 4ffcd59113fa26d7c2e9d5897b1eef919fd4b457 Mon Sep 17 00:00:00 2001
-From: Adam Hupp <adam@hupp.org>
-Date: Mon, 9 Jan 2023 12:55:15 -0800
-Subject: [PATCH] update test for upstream added gzip extensions
-
---- a/test/python_magic_test.py
-+++ b/test/python_magic_test.py
-@@ -134,7 +134,7 @@ def test_extension(self):
- self.assert_values(m, {
- # some versions return '' for the extensions of a gz file,
- # including w/ the command line. Who knows...
-- 'test.gz': ('gz/tgz/tpz/zabw/svgz', '', '???'),
-+ 'test.gz': ('gz/tgz/tpz/zabw/svgz/adz/kmy/xcfgz', 'gz/tgz/tpz/zabw/svgz', '', '???'),
- 'name_use.jpg': 'jpeg/jpg/jpe/jfif',
- })
- except NotImplementedError:
-@@ -227,6 +227,5 @@ def test_pathlike(self):
- m = magic.Magic(mime=True)
- self.assertEqual('application/pdf', m.from_file(path))
-
--
- if __name__ == '__main__':
- unittest.main()
-
diff --git a/dev-python/python-magic/files/python-magic-0.4.27-test.patch b/dev-python/python-magic/files/python-magic-0.4.27-test.patch
new file mode 100644
index 000000000000..a4e94251fe9f
--- /dev/null
+++ b/dev-python/python-magic/files/python-magic-0.4.27-test.patch
@@ -0,0 +1,69 @@
+https://github.com/ahupp/python-magic/commit/4ffcd59113fa26d7c2e9d5897b1eef919fd4b457
+
+From 4ffcd59113fa26d7c2e9d5897b1eef919fd4b457 Mon Sep 17 00:00:00 2001
+From: Adam Hupp <adam@hupp.org>
+Date: Mon, 9 Jan 2023 12:55:15 -0800
+Subject: [PATCH] update test for upstream added gzip extensions
+
+--- a/test/python_magic_test.py
++++ b/test/python_magic_test.py
+@@ -134,7 +134,7 @@ def test_extension(self):
+ self.assert_values(m, {
+ # some versions return '' for the extensions of a gz file,
+ # including w/ the command line. Who knows...
+- 'test.gz': ('gz/tgz/tpz/zabw/svgz', '', '???'),
++ 'test.gz': ('gz/tgz/tpz/zabw/svgz/adz/kmy/xcfgz', 'gz/tgz/tpz/zabw/svgz', '', '???'),
+ 'name_use.jpg': 'jpeg/jpg/jpe/jfif',
+ })
+ except NotImplementedError:
+@@ -227,6 +227,5 @@ def test_pathlike(self):
+ m = magic.Magic(mime=True)
+ self.assertEqual('application/pdf', m.from_file(path))
+
+-
+ if __name__ == '__main__':
+ unittest.main()
+
+From b434c88c9c8e901adf5b3779e3aac65f10d90aab Mon Sep 17 00:00:00 2001
+From: Dominique Leuenberger <dimstar@opensuse.org>
+Date: Wed, 2 Aug 2023 11:29:47 +0200
+Subject: [PATCH 1/2] Fix test suite with file 5.45
+
+[ 12s] test/python_magic_test.py:53: in assert_values
+[ 12s] self.assertIn(value, expected_value)
+[ 12s] E AssertionError: 'PDF document, version 1.2, 2 page(s)' not found in ('PDF document, version 1.2', 'PDF document, version 1.2, 2 pages')
+---
+ test/libmagic_test.py | 2 +-
+ test/python_magic_test.py | 3 ++-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/test/libmagic_test.py b/test/libmagic_test.py
+index 5719a58..7b4665b 100644
+--- a/test/libmagic_test.py
++++ b/test/libmagic_test.py
+@@ -15,7 +15,7 @@ class MagicTestCase(unittest.TestCase):
+ filename = os.path.join(TESTDATA_DIR, 'test.pdf')
+ expected_mime_type = 'application/pdf'
+ expected_encoding = 'us-ascii'
+- expected_name = ('PDF document, version 1.2', 'PDF document, version 1.2, 2 pages')
++ expected_name = ('PDF document, version 1.2', 'PDF document, version 1.2, 2 pages', 'PDF document, version 1.2, 2 page(s)')
+
+ def assert_result(self, result):
+ self.assertEqual(result.mime_type, self.expected_mime_type)
+diff --git a/test/python_magic_test.py b/test/python_magic_test.py
+index 624a443..78f63a3 100755
+--- a/test/python_magic_test.py
++++ b/test/python_magic_test.py
+@@ -108,7 +108,8 @@ class MagicTest(unittest.TestCase):
+ self.assert_values(m, {
+ 'magic._pyc_': 'python 2.4 byte-compiled',
+ 'test.pdf': ('PDF document, version 1.2',
+- 'PDF document, version 1.2, 2 pages'),
++ 'PDF document, version 1.2, 2 pages',
++ 'PDF document, version 1.2, 2 page(s)'),
+ 'test.gz':
+ ('gzip compressed data, was "test", from Unix, last '
+ 'modified: Sun Jun 29 01:32:52 2008',
+--
+2.43.0
+
diff --git a/dev-python/python-magic/python-magic-0.4.27.ebuild b/dev-python/python-magic/python-magic-0.4.27.ebuild
index 18f913a8638a..eae3b9ee83a3 100644
--- a/dev-python/python-magic/python-magic-0.4.27.ebuild
+++ b/dev-python/python-magic/python-magic-0.4.27.ebuild
@@ -32,7 +32,8 @@ BDEPEND="
"
PATCHES=(
- "${FILESDIR}"/${P}-fix-gzip-test.patch
+ # upstream git backports
+ "${FILESDIR}"/${P}-test.patch
)
distutils_enable_tests unittest
^ permalink raw reply related [flat|nested] 3+ messages in thread* [gentoo-commits] repo/gentoo:master commit in: dev-python/python-magic/files/, dev-python/python-magic/
@ 2018-08-23 8:17 Patrice Clement
0 siblings, 0 replies; 3+ messages in thread
From: Patrice Clement @ 2018-08-23 8:17 UTC (permalink / raw
To: gentoo-commits
commit: 7de54d8bb0adfbc64a5d291416e58884d3096fb8
Author: Louis Sautier <sbraz <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 18 01:04:13 2018 +0000
Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org>
CommitDate: Thu Aug 23 08:17:07 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7de54d8b
dev-python/python-magic: add Python 3.7, PyPy{,3}, fix tests.
* Tests didn't work with recent versions of file. Provide patches that
have been merged upstream.
* Fix dependencies, DEPEND=${DEPEND} was a typo.
* EAPI=7.
Package-Manager: Portage-2.3.45, Repoman-2.3.10
Closes: https://github.com/gentoo/gentoo/pull/9607
.../python-magic-0.4.15-fix-buffer-test.patch | 65 ++++++++++++++++++++++
.../files/python-magic-0.4.15-fix-gzip-test.patch | 19 +++++++
.../files/python-magic-0.4.15-fix-jpeg-test.patch | 49 ++++++++++++++++
.../python-magic/python-magic-0.4.15-r1.ebuild | 37 ++++++++++++
4 files changed, 170 insertions(+)
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 00000000000..75a769b6a5f
--- /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 00000000000..d48637139e2
--- /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 00000000000..9efb34b6672
--- /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 00000000000..5a23238beb2
--- /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}"
+}
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-25 16:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-03 6:17 [gentoo-commits] repo/gentoo:master commit in: dev-python/python-magic/files/, dev-python/python-magic/ Matt Turner
-- strict thread matches above, loose matches on Subject: below --
2023-11-25 16:57 Michał Górny
2018-08-23 8:17 Patrice Clement
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox