Browse Source

Initial packaging. Closes: #877849

Christoph Biedl 6 years ago
parent
commit
451ffe93cc

+ 7 - 0
debian/changelog

@@ -0,0 +1,7 @@
+python-magic (2:0.4.15-1~exp1) experimental; urgency=medium
+
+  * Initial packaging. Closes: #877849
+  * Upload to experimental to ease tests of packages that use
+    python-magic from src:file
+
+ -- Christoph Biedl <debian.axhn@manchmal.in-ulm.de>  Mon, 08 Jan 2018 08:20:53 +0100

+ 1 - 0
debian/compat

@@ -0,0 +1 @@
+11

+ 46 - 0
debian/control

@@ -0,0 +1,46 @@
+Source: python-magic
+Maintainer: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Homepage: https://github.com/ahupp/python-magic/
+Standards-Version: 4.1.3
+Testsuite: autopkgtest-pkg-python
+Build-Depends: debhelper (>= 11~),
+    dh-python,
+    python-all,
+    python-setuptools,
+    python3-all,
+    python3-setuptools,
+Priority: extra
+Section: libs
+X-Python-Version: >= 2.6
+X-Python3-Version: >= 3.3
+
+Package: python-magic
+Architecture: all
+Depends: ${misc:Depends}, ${python:Depends},
+    libmagic1,
+Provides:
+    ${python:Provides},
+Section: python
+Priority: optional
+Description: python2 interface to the libmagic file type identification library
+ python-magic is a Python interface to the libmagic file type
+ identification library. libmagic identifies file types by checking
+ their headers according to a predefined list of file types. This
+ functionality is exposed to the command line by the Unix command file.
+ .
+ This package provides the Python 2 version of the python-magic module.
+XB-Python-Version: ${python:Versions}
+
+Package: python3-magic
+Architecture: all
+Depends: ${misc:Depends}, ${python3:Depends},
+    libmagic1,
+Section: python
+Priority: optional
+Description: python3 interface to the libmagic file type identification library
+ python-magic is a Python interface to the libmagic file type
+ identification library. libmagic identifies file types by checking
+ their headers according to a predefined list of file types. This
+ functionality is exposed to the command line by the Unix command file.
+ .
+ This package provides the Python 3 version of the python-magic module.

+ 62 - 0
debian/copyright

@@ -0,0 +1,62 @@
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: python-magic
+Source: https://github.com/ahupp/python-magic/
+
+Files: *
+Copyright: 2001-2014 Adam Hupp
+License: MIT
+
+Files:
+ magic/compat.py
+ test/libmagic_test.py
+Copyright: Ian F. Darwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995.
+ Software written by Ian F. Darwin and others;
+ maintained 1994- Christos Zoulas.
+License: BSD-2-Clause-alike
+
+Files:
+ debian/*
+Copyright: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+License: MIT
+
+License: MIT
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+License: BSD-2-Clause-alike
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+    notice immediately at the beginning of the file, without modification,
+    this list of conditions, and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ .
+ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.

+ 16 - 0
debian/patches/cherry-pick.0.4.11-32-g9d127ce.update-filetype-reported-by-libmagic-5-23-for-keep-going-true.patch

@@ -0,0 +1,16 @@
+Subject: Update filetype reported by libmagic >=5.23 for keep_going=true
+Origin: 0.4.11-32-g9d127ce
+Upstream-Author: Adam Hupp <adam@hupp.org>
+Date: Sun Oct 1 20:52:48 2017 -0700
+
+--- a/test/test.py
++++ b/test/test.py
+@@ -94,7 +94,7 @@
+         self.assertEqual(m.from_file(filename), 'image/jpeg')
+         
+         m = magic.Magic(mime=True, keep_going=True)
+-        self.assertEqual(m.from_file(filename), 'image/jpeg')
++        self.assertEqual(m.from_file(filename), 'image/jpeg\\012- application/octet-stream')
+ 
+ 
+     def test_rethrow(self):

+ 16 - 0
debian/patches/fix-buffer-test.patch

@@ -0,0 +1,16 @@
+Subject: Fix test failing in python3
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Date: 2018-01-08
+Forwarded: yes
+
+--- a/test/libmagic_test.py
++++ b/test/libmagic_test.py
+@@ -28,7 +28,7 @@
+ 
+     def test_detect_from_content(self):
+         with open(self.filename) as fobj:
+-            result = magic.detect_from_content(fobj.read(4096))
++            result = magic.detect_from_content(fobj.read(4096).encode())
+         self.assert_result(result)
+ 
+ if __name__ == '__main__':

+ 15 - 0
debian/patches/fix-installation.patch

@@ -0,0 +1,15 @@
+Subject: Fix installation path
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Date: 2018-01-08
+Forwarded: yes
+
+--- a/setup.py
++++ b/setup.py
+@@ -14,6 +14,7 @@
+ identification library.  It makes use of the local magic database and
+ supports both textual and MIME-type output.
+ """,
++      packages=["magic"],
+       keywords="mime magic file",
+       license="MIT",
+       test_suite='test',

File diff suppressed because it is too large
+ 1096 - 0
debian/patches/libmagic-compat.patch


+ 29 - 0
debian/patches/make-deprecation-warning-switchable.patch

@@ -0,0 +1,29 @@
+Subject: Make the deprecation warning switchable
+Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
+Date: 2018-01-08
+Forwarded: soon
+
+--- a/magic/__init__.py
++++ b/magic/__init__.py
+@@ -19,6 +19,7 @@
+ 
+ import sys
+ import glob
++import os
+ import os.path
+ import ctypes
+ import ctypes.util
+@@ -325,9 +326,10 @@
+ 
+     def deprecation_wrapper(compat, fn, alternate):
+         def _(*args, **kwargs):
+-            warnings.warn(
+-                "Using compatability mode with libmagic's python binding",
+-                DeprecationWarning)
++            if "PYTHONMAGIC_WARN_DEPRECATED" in os.environ:
++                warnings.warn(
++                    "Using compatibility mode with libmagic's python binding",
++                    DeprecationWarning)
+ 
+             return compat[fn](*args, **kwargs)
+         return _

+ 5 - 0
debian/patches/series

@@ -0,0 +1,5 @@
+cherry-pick.0.4.11-32-g9d127ce.update-filetype-reported-by-libmagic-5-23-for-keep-going-true.patch
+libmagic-compat.patch
+fix-buffer-test.patch
+fix-installation.patch
+make-deprecation-warning-switchable.patch

+ 2 - 0
debian/python-magic.install

@@ -0,0 +1,2 @@
+
+debian/tmp/usr/lib/python2.?/

+ 2 - 0
debian/python3-magic.install

@@ -0,0 +1,2 @@
+
+debian/tmp/usr/lib/python3.?/

+ 6 - 0
debian/rules

@@ -0,0 +1,6 @@
+#!/usr/bin/make -f
+
+export LC_ALL=C.UTF-8
+
+%:
+	dh $@ --with python2,python3 --buildsystem=pybuild

+ 1 - 0
debian/source/format

@@ -0,0 +1 @@
+3.0 (quilt)

+ 4 - 0
debian/watch

@@ -0,0 +1,4 @@
+
+version=3
+https://github.com/ahupp/python-magic/releases \
+    /ahupp/python-magic/archive/([0-9][.0-9]*)\.tar\.gz