- 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

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-magic?expand=0&rev=19
This commit is contained in:
Matej Cepl 2022-02-16 18:13:57 +00:00 committed by Git OBS Bridge
parent 35a9daa942
commit c9f0ca09c5
8 changed files with 55 additions and 108 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b787e8056c115f37e2af11e0b98dc67d5fc182ed5ed827a62f95e3a7f0ed4be4
size 856291

3
0.4.25.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0c1f483995067ffff268103f8bb6860d2f42aa3a5a9b906eaf34bcce1de36329
size 864121

View File

@ -1,15 +0,0 @@
---
test/test.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- test/test.py
+++ test/test.py 2021-04-16 12:54:00.275731435 +0000
@@ -87,7 +87,7 @@ class MagicTest(unittest.TestCase):
try:
self.assert_values(m, {
'magic._pyc_': 'python 2.4 byte-compiled',
- 'test.pdf': 'PDF document, version 1.2',
+ 'test.pdf': 'PDF document, version 1.2, 2 pages',
'test.gz':
('gzip compressed data, was "test", from Unix, last '
'modified: Sun Jun 29 01:32:52 2008',

View File

@ -1,13 +0,0 @@
diff --git a/test/test.py b/test/test.py
index 8ea9138..968f904 100755
--- a/test/test.py
+++ b/test/test.py
@@ -70,7 +70,7 @@ class MagicTest(unittest.TestCase):
try:
m = magic.Magic(mime=True)
self.assert_values(m, {
- 'magic._pyc_': 'text/x-bytecode.python',
+ 'magic._pyc_': ('application/octet-stream', 'text/x-bytecode.python', 'application/x-bytecode.python'),
'test.pdf': 'application/pdf',
'test.gz': ('application/gzip', 'application/x-gzip'),
'test.snappy.parquet': 'application/octet-stream',

View File

@ -1,34 +0,0 @@
--- python-magic-0.4.18/test/test.py 2020-05-06 04:25:46.000000000 +0200
+++ python-magic-0.4.18/test/test.py 2020-07-25 19:51:08.263172240 +0200
@@ -59,9 +59,9 @@
def test_from_buffer_str_and_bytes(self):
m = magic.Magic(mime=True)
s = '#!/usr/bin/env python\nprint("foo")'
- self.assertEqual("text/x-python", m.from_buffer(s))
+ self.assertEqual("text/x-script.python", m.from_buffer(s))
b = b'#!/usr/bin/env python\nprint("foo")'
- self.assertEqual("text/x-python", m.from_buffer(b))
+ self.assertEqual("text/x-script.python", m.from_buffer(b))
def test_mime_types(self):
dest = os.path.join(MagicTest.TESTDATA_DIR,
@@ -70,7 +70,7 @@
try:
m = magic.Magic(mime=True)
self.assert_values(m, {
- 'magic._pyc_': 'application/octet-stream',
+ 'magic._pyc_': 'text/x-bytecode.python',
'test.pdf': 'application/pdf',
'test.gz': ('application/gzip', 'application/x-gzip'),
'test.snappy.parquet': 'application/octet-stream',
@@ -97,7 +97,9 @@
': 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'
+ 'from Unix, original size modulo 2^32 15',
+ 'gzip compressed data, was "test", last modified: '
+ 'Sun Jun 29 01:32:52 2008, from Unix, truncated',
),
'text.txt': 'ASCII text',
'test.snappy.parquet': ('Apache Parquet', 'Par archive data'),

View File

@ -1,13 +0,0 @@
--- python-magic-0.4.18/test/test.py 2020-05-06 04:25:46.000000000 +0200
+++ python-magic-0.4.18/test/test.py 2020-07-25 20:02:37.988452945 +0200
@@ -97,7 +97,9 @@
': 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'
+ 'from Unix, original size modulo 2^32 15',
+ 'gzip compressed data, was "test", last modified: '
+ 'Sun Jun 29 01:32:52 2008, from Unix, truncated',
),
'text.txt': 'ASCII text',
'test.snappy.parquet': ('Apache Parquet', 'Par archive data'),

View File

@ -1,3 +1,45 @@
-------------------------------------------------------------------
Wed Feb 16 17:32:56 UTC 2022 - Matej Cepl <mcepl@suse.com>
- 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 <mcepl@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-python-magic
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -19,30 +19,24 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define oldpython python
Name: python-python-magic
Version: 0.4.18
Version: 0.4.25
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
#PATCH-FIX-OPENSUSE fix-test.patch -- adapt file outputs to opensuse
Patch0: fix-test.patch
Patch1: fix-test-tumbleweed.patch
Patch2: fix-4-file-5.40.patch
Patch3: fix-support-file-5.41.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
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
Provides: python-magic
BuildArch: noarch
%ifpython2
Conflicts: %{oldpython}-magic
Provides: %{oldpython}-magic
%endif
%python_subpackages
@ -53,25 +47,12 @@ supports both textual and MIME-type output.
%prep
%setup -q -n python-magic-%{version}
%if 0%{?suse_version} > 1500
# Tumbleweed
%patch1 -p1
%elif 0%{?sle_version} < 150300 && 0%{?is_opensuse}
# Leap 15.2 and older
%patch0 -p1
%endif
%if %{?pkg_vcmp:%{pkg_vcmp file >= 5.40}}%{!?pkg_vcmp:0}
%patch2 -p0
%endif
%if %{?pkg_vcmp:%{pkg_vcmp file >= 5.41}}%{!?pkg_vcmp:0}
%patch3 -p1
%endif
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
@ -81,8 +62,7 @@ export LC_ALL=en_US.UTF-8
%files %{python_files}
%license LICENSE
%doc README.md
%{python_sitelib}/magic.py*
%pycache_only %{python_sitelib}/__pycache__/magic*.py*
%{python_sitelib}/python_magic-%{version}-py*.egg-info
%{python_sitelib}/magic
%{python_sitelib}/python_magic-%{version}*-info
%changelog