commit ce1802d85690df174f8ab7123696849903184310 Author: xhaa123 Date: Tue Oct 22 19:43:57 2024 +0800 python-magic 0.4.27-1 diff --git a/545a2a561522efc2869066792062694b59b1b39c.patch b/545a2a561522efc2869066792062694b59b1b39c.patch new file mode 100644 index 0000000..aa08d36 --- /dev/null +++ b/545a2a561522efc2869066792062694b59b1b39c.patch @@ -0,0 +1,40 @@ +From 545a2a561522efc2869066792062694b59b1b39c Mon Sep 17 00:00:00 2001 +From: Dominique Leuenberger +Date: Wed, 2 Aug 2023 11:29:47 +0200 +Subject: [PATCH] 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 d51587c..410a149 100755 +--- a/test/python_magic_test.py ++++ b/test/python_magic_test.py +@@ -108,7 +108,8 @@ def test_descriptions(self): + 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', diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..b104ae4 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,37 @@ +# This is an example PKGBUILD file. Use this as a start to creating your own, +# and remove these comments. For more information, see 'man PKGBUILD'. +# NOTE: Please fill out the license field for your package! If it is unknown, +# then please put 'unknown'. + +# Maintainer: Future Linux Team +pkgname=python-magic +pkgver=0.4.27 +pkgrel=1 +pkgdesc="A python wrapper for libmagic" +arch=('x86_64') +url="https://github.com/ahupp/python-magic" +license=('MIT') +depends=('file' 'python') +makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel') +source=(https://github.com/ahupp/python-magic/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz + 545a2a561522efc2869066792062694b59b1b39c.patch) +sha256sums=(3978a25d43d9a7b8a89ae9d726bd4962fc90dc4f69ae852e399f3c56d4b0bd63 + 95949e7d738738deb8fa79d45f35f2b9132bc57c96649e08acc9ca944c69de8a) + +prepare() { + cd ${pkgname}-${pkgver} + + patch -Np1 -i ${srcdir}/545a2a561522efc2869066792062694b59b1b39c.patch +} + +build() { + cd ${pkgname}-${pkgver} + + python3 -m build --wheel --no-isolation +} + +package() { + cd ${pkgname}-${pkgver} + + python3 -m installer --destdir=${pkgdir} dist/*.whl +}