Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-filetype for openSUSE:Factory
checked in at 2021-11-22 23:04:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-filetype (Old)
and /work/SRC/openSUSE:Factory/.python-filetype.new.1895 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-filetype"
Mon Nov 22 23:04:35 2021 rev:3 rq:933145 version:1.0.8
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-filetype/python-filetype.changes
2020-09-17 15:03:40.364643411 +0200
+++
/work/SRC/openSUSE:Factory/.python-filetype.new.1895/python-filetype.changes
2021-11-22 23:05:31.589661757 +0100
@@ -1,0 +2,43 @@
+Mon Nov 22 17:51:22 UTC 2021 - Matej Cepl <[email protected]>
+
+- Restrict more which files are packaged.
+
+-------------------------------------------------------------------
+Mon Nov 22 13:19:36 UTC 2021 - John Paul Adrian Glaubitz
<[email protected]>
+
+- update to 1.0.8:
+ * docs: fix typos: s/againts/against
+ * Support special video/3gp file.
+ * fix: small error in docs
+ * Fix for PEP8 styles
+ * Fix version
+ * Add command line
+ * Fix linter error.
+ * Add xcf type.
+ * Add application abstraction and wasm type.
+ * Add rpm and dcm type.
+ * Add 3gp type.
+ * Add aac type.
+ * Add dwg type.
+ * Add brotli support.
+ * Fix avi matcher.
+ * Fix cr2 handling.
+ * Add py39 to test environment.
+ * Add clean and doc target to tox.
+ * Add docs to .gitignore
+ * Switch to tox in travis CI.
+ * Add lint and test target to tox.ini
+ * Clean up .gitignore
+ * Update Readme.
+ * Extend mp3 matcher
+ * Added support for lzop.
+ * Added support for lz4.
+ * Accept os.PathLike objects.
+ * Added support for elf
+ * setup.py: Exclude 'examples' from being installed as a global pkg
+ * Create LICENSE
+ * Add sample.jpg fixture
+- Install new filetype command into %{_bindir}
+- Enable update-alternatives mechanism for filetype command
+
+-------------------------------------------------------------------
Old:
----
filetype-1.0.7.tar.gz
New:
----
filetype-1.0.8.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-filetype.spec ++++++
--- /var/tmp/diff_new_pack.mNJKQx/_old 2021-11-22 23:05:32.121659971 +0100
+++ /var/tmp/diff_new_pack.mNJKQx/_new 2021-11-22 23:05:32.121659971 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-filetype
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-filetype
-Version: 1.0.7
+Version: 1.0.8
Release: 0
Summary: Infer file type and MIME type of any file/buffer. No external
dependencies
License: MIT
@@ -28,6 +28,8 @@
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
+Requires(post): update-alternatives
+Requires(postun):update-alternatives
BuildArch: noarch
%python_subpackages
@@ -45,16 +47,22 @@
%install
%python_install
-# do not install examples in generic folder
-%python_expand rm -r %{buildroot}%{$python_sitelib}/examples/
+%python_clone -a %{buildroot}%{_bindir}/filetype
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m unittest
discover -v
+%post
+%python_install_alternative filetype
+
+%postun
+%python_uninstall_alternative filetype
+
%files %{python_files}
%doc README.rst
%license LICENSE
-%{python_sitelib}/*
+%{python_sitelib}/filetype*
+%python_alternative %{_bindir}/filetype
%changelog
++++++ filetype-1.0.7.tar.gz -> filetype-1.0.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/PKG-INFO new/filetype-1.0.8/PKG-INFO
--- old/filetype-1.0.7/PKG-INFO 2020-04-28 20:33:40.000000000 +0200
+++ new/filetype-1.0.8/PKG-INFO 2021-09-24 17:27:02.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: filetype
-Version: 1.0.7
+Version: 1.0.8
Summary: Infer file type and MIME type of any file/buffer. No external
dependencies.
Home-page: https://github.com/h2non/filetype.py
Author: Tomas Aparicio
@@ -71,6 +71,8 @@
Image
^^^^^
+ - **dwg** - ``image/vnd.dwg``
+ - **xcf** - ``image/x-xcf``
- **jpg** - ``image/jpeg``
- **jpx** - ``image/jpx``
- **png** - ``image/png``
@@ -87,6 +89,7 @@
Video
^^^^^
+ - **3gp** - ``video/3gpp``
- **mp4** - ``video/mp4``
- **m4v** - ``video/x-m4v``
- **mkv** - ``video/x-matroska``
@@ -100,6 +103,7 @@
Audio
^^^^^
+ - **aac** - ``audio/aac``
- **mid** - ``audio/midi``
- **mp3** - ``audio/mpeg``
- **m4a** - ``audio/m4a``
@@ -111,6 +115,9 @@
Archive
^^^^^^^
+ - **br** - ``application/x-brotli``
+ - **rpm** - ``application/x-rpm``
+ - **dcm** - ``application/dicom``
- **epub** - ``application/epub+zip``
- **zip** - ``application/zip``
- **tar** - ``application/x-tar``
@@ -133,7 +140,9 @@
- **deb** - ``application/x-deb``
- **ar** - ``application/x-unix-archive``
- **Z** - ``application/x-compress``
+ - **lzo** - ``application/x-lzop``
- **lz** - ``application/x-lzip``
+ - **lz4** - ``application/x-lz4``
Font
^^^^
@@ -143,6 +152,11 @@
- **ttf** - ``application/font-sfnt``
- **otf** - ``application/font-sfnt``
+ Application
+ ^^^^^^^^^^^
+
+ - **wasm** - ``application/wasm``
+
.. _Python: http://python.org
.. _magic numbers:
https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files
.. _filetype: https://github.com/h2non/filetype
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/README.rst
new/filetype-1.0.8/README.rst
--- old/filetype-1.0.7/README.rst 2020-03-23 16:10:50.000000000 +0100
+++ new/filetype-1.0.8/README.rst 2021-09-24 17:26:51.000000000 +0200
@@ -62,6 +62,8 @@
Image
^^^^^
+- **dwg** - ``image/vnd.dwg``
+- **xcf** - ``image/x-xcf``
- **jpg** - ``image/jpeg``
- **jpx** - ``image/jpx``
- **png** - ``image/png``
@@ -78,6 +80,7 @@
Video
^^^^^
+- **3gp** - ``video/3gpp``
- **mp4** - ``video/mp4``
- **m4v** - ``video/x-m4v``
- **mkv** - ``video/x-matroska``
@@ -91,6 +94,7 @@
Audio
^^^^^
+- **aac** - ``audio/aac``
- **mid** - ``audio/midi``
- **mp3** - ``audio/mpeg``
- **m4a** - ``audio/m4a``
@@ -102,6 +106,9 @@
Archive
^^^^^^^
+- **br** - ``application/x-brotli``
+- **rpm** - ``application/x-rpm``
+- **dcm** - ``application/dicom``
- **epub** - ``application/epub+zip``
- **zip** - ``application/zip``
- **tar** - ``application/x-tar``
@@ -124,7 +131,9 @@
- **deb** - ``application/x-deb``
- **ar** - ``application/x-unix-archive``
- **Z** - ``application/x-compress``
+- **lzo** - ``application/x-lzop``
- **lz** - ``application/x-lzip``
+- **lz4** - ``application/x-lz4``
Font
^^^^
@@ -134,6 +143,11 @@
- **ttf** - ``application/font-sfnt``
- **otf** - ``application/font-sfnt``
+Application
+^^^^^^^^^^^
+
+- **wasm** - ``application/wasm``
+
.. _Python: http://python.org
.. _magic numbers:
https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files
.. _filetype: https://github.com/h2non/filetype
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype/__init__.py
new/filetype-1.0.8/filetype/__init__.py
--- old/filetype-1.0.7/filetype/__init__.py 2020-04-28 20:33:16.000000000
+0200
+++ new/filetype-1.0.8/filetype/__init__.py 2021-09-22 18:50:21.000000000
+0200
@@ -7,4 +7,4 @@
from .match import * # noqa
# Current package semver version
-__version__ = version = '1.0.7'
+__version__ = version = '1.0.8'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype/__main__.py
new/filetype-1.0.8/filetype/__main__.py
--- old/filetype-1.0.7/filetype/__main__.py 1970-01-01 01:00:00.000000000
+0100
+++ new/filetype-1.0.8/filetype/__main__.py 2021-09-22 18:50:21.000000000
+0200
@@ -0,0 +1,29 @@
+import filetype
+
+
+def guess(path):
+ kind = filetype.guess(path)
+ if kind is None:
+ print('{}: File type determination failure.'.format(path))
+ else:
+ print('{}: {} ({})'.format(path, kind.extension, kind.mime))
+
+
+def main():
+ import argparse
+
+ parser = argparse.ArgumentParser(description='Determine type of FILEs.')
+ parser.add_argument("file", nargs='+')
+ parser.add_argument('-v', '--version', action='store_true',
+ help='output version information and exit')
+ args = parser.parse_args()
+
+ if args.version:
+ print(filetype.version)
+ else:
+ for i in args.file:
+ guess(i)
+
+
+if __name__ == '__main__':
+ main()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype/match.py
new/filetype-1.0.8/filetype/match.py
--- old/filetype-1.0.7/filetype/match.py 2020-04-28 20:31:26.000000000
+0200
+++ new/filetype-1.0.8/filetype/match.py 2021-09-22 18:50:21.000000000
+0200
@@ -4,6 +4,7 @@
from .types import ARCHIVE as archive_matchers
from .types import AUDIO as audio_matchers
+from .types import APPLICATION as application_matchers
from .types import FONT as font_matchers
from .types import IMAGE as image_matchers
from .types import VIDEO as video_matchers
@@ -13,7 +14,7 @@
def match(obj, matchers=TYPES):
"""
- Matches the given input againts the available
+ Matches the given input against the available
file type matchers.
Args:
@@ -36,7 +37,7 @@
def image_match(obj):
"""
- Matches the given input againts the available
+ Matches the given input against the available
image type matchers.
Args:
@@ -53,7 +54,7 @@
def font_match(obj):
"""
- Matches the given input againts the available
+ Matches the given input against the available
font type matchers.
Args:
@@ -70,7 +71,7 @@
def video_match(obj):
"""
- Matches the given input againts the available
+ Matches the given input against the available
video type matchers.
Args:
@@ -87,7 +88,7 @@
def audio_match(obj):
"""
- Matches the given input againts the available
+ Matches the given input against the available
autio type matchers.
Args:
@@ -104,7 +105,7 @@
def archive_match(obj):
"""
- Matches the given input againts the available
+ Matches the given input against the available
archive type matchers.
Args:
@@ -117,3 +118,20 @@
TypeError: if obj is not a supported type.
"""
return match(obj, archive_matchers)
+
+
+def application_match(obj):
+ """
+ Matches the given input against the available
+ application type matchers.
+
+ Args:
+ obj: path to file, bytes or bytearray.
+
+ Returns:
+ Type instance if matches. Otherwise None.
+
+ Raises:
+ TypeError: if obj is not a supported type.
+ """
+ return match(obj, application_matchers)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype/types/__init__.py
new/filetype-1.0.8/filetype/types/__init__.py
--- old/filetype-1.0.7/filetype/types/__init__.py 2020-01-18
17:45:56.000000000 +0100
+++ new/filetype-1.0.8/filetype/types/__init__.py 2021-09-22
18:50:21.000000000 +0200
@@ -4,6 +4,7 @@
from . import archive
from . import audio
+from . import application
from . import font
from . import image
from . import video
@@ -11,13 +12,15 @@
# Supported image types
IMAGE = (
+ image.Dwg(),
+ image.Xcf(),
image.Jpeg(),
image.Jpx(),
image.Png(),
image.Gif(),
image.Webp(),
- image.Cr2(),
image.Tiff(),
+ image.Cr2(),
image.Bmp(),
image.Jxr(),
image.Psd(),
@@ -28,6 +31,7 @@
# Supported video types
VIDEO = (
+ video.M3gp(),
video.Mp4(),
video.M4v(),
video.Mkv(),
@@ -41,6 +45,7 @@
# Supported audio types
AUDIO = (
+ audio.Aac(),
audio.Midi(),
audio.Mp3(),
audio.M4a(),
@@ -55,6 +60,9 @@
# Supported archive container types
ARCHIVE = (
+ archive.Br(),
+ archive.Rpm(),
+ archive.Dcm(),
archive.Epub(),
archive.Zip(),
archive.Tar(),
@@ -76,8 +84,17 @@
archive.Deb(),
archive.Ar(),
archive.Z(),
+ archive.Lzop(),
archive.Lz(),
+ archive.Elf(),
+ archive.Lz4(),
+)
+
+# Supported archive container types
+APPLICATION = (
+ application.Wasm(),
)
+
# Expose supported type matchers
-TYPES = list(VIDEO + IMAGE + AUDIO + FONT + ARCHIVE)
+TYPES = list(VIDEO + IMAGE + AUDIO + FONT + ARCHIVE + APPLICATION)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype/types/application.py
new/filetype-1.0.8/filetype/types/application.py
--- old/filetype-1.0.7/filetype/types/application.py 1970-01-01
01:00:00.000000000 +0100
+++ new/filetype-1.0.8/filetype/types/application.py 2021-09-22
18:50:21.000000000 +0200
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+
+from __future__ import absolute_import
+
+from .base import Type
+
+
+class Wasm(Type):
+ """Implements the Wasm image type matcher."""
+
+ MIME = 'application/wasm'
+ EXTENSION = 'wasm'
+
+ def __init__(self):
+ super(Wasm, self).__init__(
+ mime=Wasm.MIME,
+ extension=Wasm.EXTENSION
+ )
+
+ def match(self, buf):
+ return buf[:8] == bytearray([0x00, 0x61, 0x73, 0x6d,
+ 0x01, 0x00, 0x00, 0x00])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype/types/archive.py
new/filetype-1.0.8/filetype/types/archive.py
--- old/filetype-1.0.7/filetype/types/archive.py 2020-01-18
17:45:56.000000000 +0100
+++ new/filetype-1.0.8/filetype/types/archive.py 2021-09-22
18:50:21.000000000 +0200
@@ -494,6 +494,31 @@
buf[1] == 0x9D)))
+class Lzop(Type):
+ """
+ Implements the Lzop archive type matcher.
+ """
+ MIME = 'application/x-lzop'
+ EXTENSION = 'lzo'
+
+ def __init__(self):
+ super(Lzop, self).__init__(
+ mime=Lzop.MIME,
+ extension=Lzop.EXTENSION
+ )
+
+ def match(self, buf):
+ return (len(buf) > 7 and
+ buf[0] == 0x89 and
+ buf[1] == 0x4C and
+ buf[2] == 0x5A and
+ buf[3] == 0x4F and
+ buf[4] == 0x00 and
+ buf[5] == 0x0D and
+ buf[6] == 0x0A and
+ buf[7] == 0x1A)
+
+
class Lz(Type):
"""
Implements the Lz archive type matcher.
@@ -513,3 +538,93 @@
buf[1] == 0x5A and
buf[2] == 0x49 and
buf[3] == 0x50)
+
+
+class Elf(Type):
+ """
+ Implements the Elf archive type matcher
+ """
+ MIME = 'application/x-executable'
+ EXTENSION = 'elf'
+
+ def __init__(self):
+ super(Elf, self).__init__(
+ mime=Elf.MIME,
+ extension=Elf.EXTENSION
+ )
+
+ def match(self, buf):
+ return (len(buf) > 52 and
+ buf[0] == 0x7F and
+ buf[1] == 0x45 and
+ buf[2] == 0x4C and
+ buf[3] == 0x46)
+
+
+class Lz4(Type):
+ """
+ Implements the Lz4 archive type matcher.
+ """
+ MIME = 'application/x-lz4'
+ EXTENSION = 'lz4'
+
+ def __init__(self):
+ super(Lz4, self).__init__(
+ mime=Lz4.MIME,
+ extension=Lz4.EXTENSION
+ )
+
+ def match(self, buf):
+ return (len(buf) > 3 and
+ buf[0] == 0x04 and
+ buf[1] == 0x22 and
+ buf[2] == 0x4D and
+ buf[3] == 0x18)
+
+
+class Br(Type):
+ """Implements the Br image type matcher."""
+
+ MIME = 'application/x-brotli'
+ EXTENSION = 'br'
+
+ def __init__(self):
+ super(Br, self).__init__(
+ mime=Br.MIME,
+ extension=Br.EXTENSION
+ )
+
+ def match(self, buf):
+ return buf[:4] == bytearray([0xce, 0xb2, 0xcf, 0x81])
+
+
+class Dcm(Type):
+ """Implements the Dcm image type matcher."""
+
+ MIME = 'application/dicom'
+ EXTENSION = 'dcm'
+
+ def __init__(self):
+ super(Dcm, self).__init__(
+ mime=Dcm.MIME,
+ extension=Dcm.EXTENSION
+ )
+
+ def match(self, buf):
+ return buf[128:131] == bytearray([0x44, 0x49, 0x43, 0x4d])
+
+
+class Rpm(Type):
+ """Implements the Rpm image type matcher."""
+
+ MIME = 'application/x-rpm'
+ EXTENSION = 'rpm'
+
+ def __init__(self):
+ super(Rpm, self).__init__(
+ mime=Rpm.MIME,
+ extension=Rpm.EXTENSION
+ )
+
+ def match(self, buf):
+ return buf[:4] == bytearray([0xed, 0xab, 0xee, 0xdb])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype/types/audio.py
new/filetype-1.0.8/filetype/types/audio.py
--- old/filetype-1.0.7/filetype/types/audio.py 2020-01-18 17:45:56.000000000
+0100
+++ new/filetype-1.0.8/filetype/types/audio.py 2021-09-22 18:50:21.000000000
+0200
@@ -42,10 +42,14 @@
def match(self, buf):
return (len(buf) > 2 and
((buf[0] == 0x49 and
- buf[1] == 0x44 and
- buf[2] == 0x33) or
- (buf[0] == 0xFF and
- buf[1] == 0xfb)))
+ buf[1] == 0x44 and
+ buf[2] == 0x33) or
+ (buf[0] == 0xFF and
+ buf[1] == 0xF2) or
+ (buf[0] == 0xFF and
+ buf[1] == 0xF3) or
+ (buf[0] == 0xFF and
+ buf[1] == 0xFB)))
class M4a(Type):
@@ -164,3 +168,20 @@
buf[3] == 0x4D and
buf[4] == 0x52 and
buf[5] == 0x0A)
+
+
+class Aac(Type):
+ """Implements the Aac audio type matcher."""
+
+ MIME = 'audio/aac'
+ EXTENSION = 'aac'
+
+ def __init__(self):
+ super(Aac, self).__init__(
+ mime=Aac.MIME,
+ extension=Aac.EXTENSION
+ )
+
+ def match(self, buf):
+ return (buf[:2] == bytearray([0xff, 0xf1]) or
+ buf[:2] == bytearray([0xff, 0xf9]))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype/types/image.py
new/filetype-1.0.8/filetype/types/image.py
--- old/filetype-1.0.7/filetype/types/image.py 2020-03-23 16:10:50.000000000
+0100
+++ new/filetype-1.0.8/filetype/types/image.py 2021-09-22 18:50:21.000000000
+0200
@@ -156,7 +156,8 @@
((buf[0] == 0x49 and buf[1] == 0x49 and
buf[2] == 0x2A and buf[3] == 0x0) or
(buf[0] == 0x4D and buf[1] == 0x4D and
- buf[2] == 0x0 and buf[3] == 0x2A)))
+ buf[2] == 0x0 and buf[3] == 0x2A))
+ and not(buf[8] == 0x43 and buf[9] == 0x52))
class Bmp(Type):
@@ -283,3 +284,36 @@
buf[Dcm.OFFSET + 1] == 0x49 and
buf[Dcm.OFFSET + 2] == 0x43 and
buf[Dcm.OFFSET + 3] == 0x4D)
+
+
+class Dwg(Type):
+ """Implements the Dwg image type matcher."""
+
+ MIME = 'image/vnd.dwg'
+ EXTENSION = 'dwg'
+
+ def __init__(self):
+ super(Dwg, self).__init__(
+ mime=Dwg.MIME,
+ extension=Dwg.EXTENSION
+ )
+
+ def match(self, buf):
+ return buf[:4] == bytearray([0x41, 0x43, 0x31, 0x30])
+
+
+class Xcf(Type):
+ """Implements the Xcf image type matcher."""
+
+ MIME = 'image/x-xcf'
+ EXTENSION = 'xcf'
+
+ def __init__(self):
+ super(Xcf, self).__init__(
+ mime=Xcf.MIME,
+ extension=Xcf.EXTENSION
+ )
+
+ def match(self, buf):
+ return buf[:10] == bytearray([0x67, 0x69, 0x6d, 0x70, 0x20,
+ 0x78, 0x63, 0x66, 0x20, 0x76])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype/types/video.py
new/filetype-1.0.8/filetype/types/video.py
--- old/filetype-1.0.7/filetype/types/video.py 2020-03-23 16:10:50.000000000
+0100
+++ new/filetype-1.0.8/filetype/types/video.py 2021-09-22 18:50:21.000000000
+0200
@@ -24,6 +24,9 @@
return False
major_brand, minor_version, compatible_brands = self._get_ftyp(buf)
+ for brand in compatible_brands:
+ if brand in ['mp41', 'mp42', 'isom']:
+ return True
return major_brand in ['mp41', 'mp42', 'isom']
@@ -136,14 +139,15 @@
)
def match(self, buf):
- return (len(buf) > 10 and
+ return (len(buf) > 11 and
buf[0] == 0x52 and
buf[1] == 0x49 and
buf[2] == 0x46 and
buf[3] == 0x46 and
buf[8] == 0x41 and
buf[9] == 0x56 and
- buf[10] == 0x49)
+ buf[10] == 0x49 and
+ buf[11] == 0x20)
class Wmv(Type):
@@ -214,3 +218,19 @@
buf[2] == 0x1 and
buf[3] >= 0xb0 and
buf[3] <= 0xbf)
+
+
+class M3gp(Type):
+ """Implements the 3gp image type matcher."""
+
+ MIME = 'video/3gpp'
+ EXTENSION = '3gp'
+
+ def __init__(self):
+ super(M3gp, self).__init__(
+ mime=M3gp.MIME,
+ extension=M3gp.EXTENSION
+ )
+
+ def match(self, buf):
+ return buf[:7] == bytearray([0x66, 0x74, 0x79, 0x70, 0x33, 0x67, 0x70])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype/utils.py
new/filetype-1.0.8/filetype/utils.py
--- old/filetype-1.0.7/filetype/utils.py 2020-01-18 17:45:56.000000000
+0100
+++ new/filetype-1.0.8/filetype/utils.py 2021-09-22 18:50:21.000000000
+0200
@@ -1,5 +1,12 @@
# -*- coding: utf-8 -*-
+# Python 2.7 workaround
+try:
+ import pathlib
+except ImportError:
+ pass
+
+
_NUM_SIGNATURE_BYTES = 262
@@ -69,4 +76,7 @@
if kind is memoryview:
return signature(obj).tolist()
+ if isinstance(obj, pathlib.PurePath):
+ return get_signature_bytes(obj)
+
raise TypeError('Unsupported type as file input: %s' % kind)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype.egg-info/PKG-INFO
new/filetype-1.0.8/filetype.egg-info/PKG-INFO
--- old/filetype-1.0.7/filetype.egg-info/PKG-INFO 2020-04-28
20:33:39.000000000 +0200
+++ new/filetype-1.0.8/filetype.egg-info/PKG-INFO 2021-09-24
17:27:02.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: filetype
-Version: 1.0.7
+Version: 1.0.8
Summary: Infer file type and MIME type of any file/buffer. No external
dependencies.
Home-page: https://github.com/h2non/filetype.py
Author: Tomas Aparicio
@@ -71,6 +71,8 @@
Image
^^^^^
+ - **dwg** - ``image/vnd.dwg``
+ - **xcf** - ``image/x-xcf``
- **jpg** - ``image/jpeg``
- **jpx** - ``image/jpx``
- **png** - ``image/png``
@@ -87,6 +89,7 @@
Video
^^^^^
+ - **3gp** - ``video/3gpp``
- **mp4** - ``video/mp4``
- **m4v** - ``video/x-m4v``
- **mkv** - ``video/x-matroska``
@@ -100,6 +103,7 @@
Audio
^^^^^
+ - **aac** - ``audio/aac``
- **mid** - ``audio/midi``
- **mp3** - ``audio/mpeg``
- **m4a** - ``audio/m4a``
@@ -111,6 +115,9 @@
Archive
^^^^^^^
+ - **br** - ``application/x-brotli``
+ - **rpm** - ``application/x-rpm``
+ - **dcm** - ``application/dicom``
- **epub** - ``application/epub+zip``
- **zip** - ``application/zip``
- **tar** - ``application/x-tar``
@@ -133,7 +140,9 @@
- **deb** - ``application/x-deb``
- **ar** - ``application/x-unix-archive``
- **Z** - ``application/x-compress``
+ - **lzo** - ``application/x-lzop``
- **lz** - ``application/x-lzip``
+ - **lz4** - ``application/x-lz4``
Font
^^^^
@@ -143,6 +152,11 @@
- **ttf** - ``application/font-sfnt``
- **otf** - ``application/font-sfnt``
+ Application
+ ^^^^^^^^^^^
+
+ - **wasm** - ``application/wasm``
+
.. _Python: http://python.org
.. _magic numbers:
https://en.wikipedia.org/wiki/Magic_number_(programming)#Magic_numbers_in_files
.. _filetype: https://github.com/h2non/filetype
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype.egg-info/SOURCES.txt
new/filetype-1.0.8/filetype.egg-info/SOURCES.txt
--- old/filetype-1.0.7/filetype.egg-info/SOURCES.txt 2020-04-28
20:33:39.000000000 +0200
+++ new/filetype-1.0.8/filetype.egg-info/SOURCES.txt 2021-09-24
17:27:02.000000000 +0200
@@ -9,6 +9,7 @@
examples/bytes.py
examples/file.py
filetype/__init__.py
+filetype/__main__.py
filetype/filetype.py
filetype/helpers.py
filetype/match.py
@@ -16,9 +17,11 @@
filetype.egg-info/PKG-INFO
filetype.egg-info/SOURCES.txt
filetype.egg-info/dependency_links.txt
+filetype.egg-info/entry_points.txt
filetype.egg-info/top_level.txt
filetype.egg-info/zip-safe
filetype/types/__init__.py
+filetype/types/application.py
filetype/types/archive.py
filetype/types/audio.py
filetype/types/base.py
@@ -33,6 +36,7 @@
tests/test_match.py
tests/test_types.py
tests/test_utils.py
+tests/fixtures/LICENSE
tests/fixtures/sample.gif
tests/fixtures/sample.heic
tests/fixtures/sample.jpg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype.egg-info/entry_points.txt
new/filetype-1.0.8/filetype.egg-info/entry_points.txt
--- old/filetype-1.0.7/filetype.egg-info/entry_points.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/filetype-1.0.8/filetype.egg-info/entry_points.txt 2021-09-24
17:27:02.000000000 +0200
@@ -0,0 +1,3 @@
+[console_scripts]
+filetype = filetype.__main__:main
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/filetype.egg-info/top_level.txt
new/filetype-1.0.8/filetype.egg-info/top_level.txt
--- old/filetype-1.0.7/filetype.egg-info/top_level.txt 2020-04-28
20:33:39.000000000 +0200
+++ new/filetype-1.0.8/filetype.egg-info/top_level.txt 2021-09-24
17:27:02.000000000 +0200
@@ -1,2 +1 @@
-examples
filetype
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/setup.py new/filetype-1.0.8/setup.py
--- old/filetype-1.0.7/setup.py 2020-04-28 20:31:46.000000000 +0200
+++ new/filetype-1.0.8/setup.py 2021-09-24 17:25:48.000000000 +0200
@@ -6,7 +6,7 @@
setup(
name='filetype',
- version='1.0.7',
+ version='1.0.8',
description='Infer file type and MIME type of any file/buffer. '
'No external dependencies.',
long_description=codecs.open('README.rst', 'r',
@@ -36,6 +36,10 @@
'Topic :: System :: Filesystems',
'Topic :: Utilities'],
platforms=['any'],
- packages=find_packages(exclude=['dist', 'build', 'docs', 'tests']),
+ packages=find_packages(exclude=['dist', 'build', 'docs', 'tests',
+ 'examples']),
package_data={'filetype': ['LICENSE', '*.md']},
- zip_safe=True)
+ zip_safe=True,
+ entry_points={
+ 'console_scripts': ['filetype=filetype.__main__:main'],
+ })
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/filetype-1.0.7/tests/fixtures/LICENSE
new/filetype-1.0.8/tests/fixtures/LICENSE
--- old/filetype-1.0.7/tests/fixtures/LICENSE 1970-01-01 01:00:00.000000000
+0100
+++ new/filetype-1.0.8/tests/fixtures/LICENSE 2021-09-22 18:50:21.000000000
+0200
@@ -0,0 +1,2 @@
+All files in this folder are Copyright 2016-2020 Tom??s Aparicio
+and are under the same license used by filetype.py.
Binary files old/filetype-1.0.7/tests/fixtures/sample.jpg and
new/filetype-1.0.8/tests/fixtures/sample.jpg differ