summaryrefslogtreecommitdiff
path: root/dev-python/python-magic
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/python-magic')
-rw-r--r--dev-python/python-magic/Manifest1
-rw-r--r--dev-python/python-magic/files/python-magic-0.4.27-test.patch69
-rw-r--r--dev-python/python-magic/metadata.xml10
-rw-r--r--dev-python/python-magic/python-magic-0.4.27.ebuild44
4 files changed, 124 insertions, 0 deletions
diff --git a/dev-python/python-magic/Manifest b/dev-python/python-magic/Manifest
new file mode 100644
index 000000000000..bd4436ba370a
--- /dev/null
+++ b/dev-python/python-magic/Manifest
@@ -0,0 +1 @@
+DIST python-magic-0.4.27.gh.tar.gz 863649 BLAKE2B 4ba22d0f8bd5e70eb37e3b46eba1b885d49682bf45d703ad7966bcc67614427ebe597e3100575f863b7e54421c6de6fc875af24a9d5b49742fe07b361b65f198 SHA512 a476730a5caa9a2a784187f57743d5cec4b1829a6a76d4d1fb4e0112caf5487888961df293bc38074ef1a5d313b0fc4aed4cc99b980f5336e8a907c44a33e84e
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/metadata.xml b/dev-python/python-magic/metadata.xml
new file mode 100644
index 000000000000..5e95859f915a
--- /dev/null
+++ b/dev-python/python-magic/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://docs.baldeagleos.com/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <stabilize-allarches />
+ <origin>baldeagleos-repo</origin>
+</pkgmetadata>
diff --git a/dev-python/python-magic/python-magic-0.4.27.ebuild b/dev-python/python-magic/python-magic-0.4.27.ebuild
new file mode 100644
index 000000000000..8ac20fd1a5dd
--- /dev/null
+++ b/dev-python/python-magic/python-magic-0.4.27.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{13..14} )
+
+inherit distutils-r1
+
+DESCRIPTION="Access the libmagic file type identification library"
+HOMEPAGE="
+ https://github.com/ahupp/python-magic/
+ https://pypi.org/project/python-magic/
+"
+SRC_URI="
+ https://github.com/ahupp/python-magic/archive/${PV}.tar.gz
+ -> ${P}.gh.tar.gz
+"
+
+LICENSE="BSD-2 MIT"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
+
+RDEPEND="
+ sys-apps/file[-python]
+"
+BDEPEND="
+ test? (
+ sys-apps/file
+ )
+"
+
+PATCHES=(
+ # upstream git backports
+ "${FILESDIR}"/${P}-test.patch
+)
+
+distutils_enable_tests unittest
+
+python_test() {
+ local -x LC_ALL=en_US.UTF-8
+ eunittest -p "*_test.py"
+}