commit 561a33aaa90c8f15e0c541b90cb3601c49c0f84a2183fce80ca35cd7499931e5 Author: Markéta Machová Date: Tue Jun 10 13:12:23 2025 +0000 - Convert to pip-based build OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-magic?expand=0&rev=31 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0.4.27.tar.gz b/0.4.27.tar.gz new file mode 100644 index 0000000..6324eb7 --- /dev/null +++ b/0.4.27.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3978a25d43d9a7b8a89ae9d726bd4962fc90dc4f69ae852e399f3c56d4b0bd63 +size 863649 diff --git a/4ffcd591.patch b/4ffcd591.patch new file mode 100644 index 0000000..edeaf28 --- /dev/null +++ b/4ffcd591.patch @@ -0,0 +1,29 @@ +From 4ffcd59113fa26d7c2e9d5897b1eef919fd4b457 Mon Sep 17 00:00:00 2001 +From: Adam Hupp +Date: Mon, 9 Jan 2023 12:55:15 -0800 +Subject: [PATCH] update test for upstream added gzip extensions + +--- + test/python_magic_test.py | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/test/python_magic_test.py b/test/python_magic_test.py +index 624a443..d51587c 100755 +--- 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/magic-file-5.45.patch b/magic-file-5.45.patch new file mode 100644 index 0000000..936697f --- /dev/null +++ b/magic-file-5.45.patch @@ -0,0 +1,27 @@ +Index: python-magic-0.4.27/test/python_magic_test.py +=================================================================== +--- python-magic-0.4.27.orig/test/python_magic_test.py ++++ python-magic-0.4.27/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', +Index: python-magic-0.4.27/test/libmagic_test.py +=================================================================== +--- python-magic-0.4.27.orig/test/libmagic_test.py ++++ python-magic-0.4.27/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/python-python-magic.changes b/python-python-magic.changes new file mode 100644 index 0000000..8ab379f --- /dev/null +++ b/python-python-magic.changes @@ -0,0 +1,175 @@ +------------------------------------------------------------------- +Tue Jun 10 13:11:58 UTC 2025 - Markéta Machová + +- Convert to pip-based build + +------------------------------------------------------------------- +Wed Aug 2 09:28:03 UTC 2023 - Dominique Leuenberger + +- Add magic-file-5.45.patch: fix test suite with file 5.45 + (gh#ahupp/python-magic#290). + +------------------------------------------------------------------- +Fri Apr 21 12:32:16 UTC 2023 - Dirk Müller + +- add sle15_python_module_pythons (jsc#PED-68) + +------------------------------------------------------------------- +Thu Apr 13 22:44:16 UTC 2023 - Matej Cepl + +- Make calling of %{sle15modernpython} optional. + +------------------------------------------------------------------- +Wed Jan 11 07:42:59 UTC 2023 - Dominique Leuenberger + +- Add 4ffcd591.patch: update test for upstream added gzip + extensions. + +------------------------------------------------------------------- +Mon Nov 14 15:13:02 UTC 2022 - Dr. Werner Fink + +- Reintroduce the Conflict with python-magic back as paython-paython-magic + uses the same name space but are fully different (boo#1181252) + +------------------------------------------------------------------- +Mon Oct 10 08:53:37 UTC 2022 - Dirk Müller + +- update to 0.4.27: + - remove spurious pyproject.toml that breaks source builds + - Use tox for all multi-version testing + - Fix use of pytest, use it via tox + +------------------------------------------------------------------- +Wed Feb 16 17:32:56 UTC 2022 - Matej Cepl + +- Update to 0.4.25: + - Support file 5.41. + - Support os.PathLike types + - Fix compat mode handling with empty mime string + - Cleanup library loading + - add py.typed sentinal per https://www.python.org/dev/peps/pep-0561/#p… + - Check for cookie attribute before trying to delete it + - Revert "Fix bug in Magic when destructor called too early" + - Fix yet another import error + - add more doc pointers for compat mode, and enable PendingDeprecationW… + - restore python 2.7 to setup.py, to preserve back compat + - document libmagic compat layer + - prefix add_compat with an underscore to avoid namespace pollution + - remove from_open_file, since its duplicative with from_descriptor and… + - move typing stubs next to implementation + - temorarily remove dropped support for python2 + - Revert "Remove Python2 from the tests" + - Merge branch 'master' into redo-compat + - Remove Python2 from the tests + - Add support for Python 3.9 + - Added support for magic_descriptor routine + - Handle undecodable characters in description + - Handle libmagic versions that don't support MAGIC_EXTENSION + - MAGIC_EXTENSION support (file --extension) + - support changed mime types in test + - Fix tests with file 5.39 + - add docker tests for archlinux + - Fallback to default behavior on setparam failure + - Fix bug in Magic when destructor called too early + - sheep Create basic stub file for magic.py + - various cleanups proposed by debian folks + - Merge in compatability mode with libmagic + - add from_open_file to match libmagic binding featureset +- Remove upstreamed patches: + - fix-test-tumbleweed.patch + - fix-test.patch + - fix-4-file-5.40.patch + - fix-support-file-5.41.patch + +------------------------------------------------------------------- +Fri Oct 22 10:09:21 UTC 2021 - Matej Cepl + +- Use pyunittest macro instead of the home-grown solution. + +------------------------------------------------------------------- +Fri Oct 22 08:02:27 UTC 2021 - Martin Liška + +- Add fix-support-file-5.41.patch to support file 5.41. + +------------------------------------------------------------------- +Fri Apr 16 13:00:57 UTC 2021 - Dr. Werner Fink + +- Add patch fix-4-file-5.40.patch to support file 5.40 (boo#1184881) + +------------------------------------------------------------------- +Sat Jul 25 14:46:39 UTC 2020 - Sebastian Wagner + +- remove patches not necessary anymore: + - magic-new-mime.patch + - magic-pep8.patch + - magic-tests.patch + - magic-new-file.patch +- add patch fix-test.patch and fix-test-tumbleweed.patch to adapt the `file` test outputs to OpenSUSE. +- update to version 0.4.18: + - Make bindings for magic_[set|get]param optional, and throw NotImplementedError + if they are used but not supported. Only call setparam() in the constructor if + it's supported. This prevents breakage on CentOS7 which uses an old version of + libmagic. +- update to version 0.4.16 and 0.4.17 (changelog is combined upstream): + - add MAGIC_MIME_TYPE constant, use that in preference to MAGIC_MIME internally. + This sets up for a breaking change in a future major version bump where + MAGIC_MIME will change to mathch magic.h. + - add magic.version() function to return library version + - add setparam/getparam to control internal behavior + - increase internal limits with setparam to prevent spurious error on some jpeg files + - various setup.py improvements to declare modern python support + - support MSYS2 magic dlls + - fix warning about using 'is' on an int in python 3.8 + - include tests in source distribution + - many test improvements: + - tox runner support + - remove deprecated test_suite field from setup.py + - docker tests that cover all LTS ubuntu versions + - add test for snapp file identification + - doc improvements + - document dependency install process for debian + - various typos + - document test running process + +------------------------------------------------------------------- +Thu Jul 4 12:09:23 UTC 2019 - Tomáš Chvátal + +- Update the patch magic-new-file.patch to work with newer file + package + +------------------------------------------------------------------- +Tue Aug 21 10:31:23 UTC 2018 - tchvatal@suse.com + +- Version update to 0.4.15: + * Few test tweaks +- Enable tests +- Add patch to fix gzip detection in tests: + * magic-tests.patch +- Add patch to fix working with new file: + * magic-new-file.patch +- Add patch to work with new mimedb: + * magic-new-mime.patch +- Add patch magic-pep8.patch to have other patches apply cleanly + +------------------------------------------------------------------- +Thu Sep 14 00:17:15 UTC 2017 - toddrme2178@gmail.com + +- Fix python-magic conflicts + +------------------------------------------------------------------- +Thu Sep 7 20:06:52 UTC 2017 - toddrme2178@gmail.com + +- Implement single-spec version. +- Update to version 0.4.13 + * No changelog + +------------------------------------------------------------------- +Tue Feb 3 19:12:38 UTC 2015 - toddrme2178@gmail.com + +- Explicitly require file + +------------------------------------------------------------------- +Mon Feb 2 23:16:35 UTC 2015 - toddrme2178@gmail.com + +- Initial version + diff --git a/python-python-magic.spec b/python-python-magic.spec new file mode 100644 index 0000000..6f70d7e --- /dev/null +++ b/python-python-magic.spec @@ -0,0 +1,78 @@ +# +# spec file for package python-python-magic +# +# Copyright (c) 2025 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define oldpython python +%{?sle15_python_module_pythons} +Name: python-python-magic +Version: 0.4.27 +Release: 0 +Summary: File type identification using libmagic +License: Python-2.0 +Group: Development/Languages/Python +URL: https://github.com/ahupp/python-magic +Source: https://github.com/ahupp/python-magic/archive/%{version}.tar.gz +Patch0: https://github.com/ahupp/python-magic/commit/4ffcd591.patch +Patch1: magic-file-5.45.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: %{python_module xml} +BuildRequires: fdupes +BuildRequires: file +BuildRequires: python-rpm-macros +Requires: file +# python-python-magic and python-magic use the same namespace (ie. filename) +# and have a very similar functionality but are incompatible to each other. +# https://github.com/ahupp/python-magic/issues/21 +Conflicts: python-magic +BuildArch: noarch +%ifpython2 +# python-python-magic and python-magic use the same namespace (ie. filename) +# and have a very similar functionality but are incompatible to each other. +# https://github.com/ahupp/python-magic/issues/21 +Conflicts: %{oldpython}-magic +%endif +%python_subpackages + +%description +This module uses ctypes to access the libmagic file type +identification library. It makes use of the local magic database and +supports both textual and MIME-type output. + +%prep +%autosetup -n python-magic-%{version} -p1 + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +export LC_ALL=en_US.UTF-8 +%pytest + +%files %{python_files} +%license LICENSE +%doc README.md +%{python_sitelib}/magic +%{python_sitelib}/python_magic-%{version}*-info + +%changelog