Skip to content
Commits on Source (21)
mat2 (0.1.1-1) unstable; urgency=medium
mat2 (0.4.0-1) unstable; urgency=medium
[ Georg Faerber + Jonas Meurer ]
* Initial release. (Closes: #898622)
-- Jonas Meurer <jonas@freesources.org> Fri, 18 May 2018 21:14:19 +0200
-- Georg Faerber <georg@riseup.net> Thu, 04 Oct 2018 23:39:09 +0200
Source: mat2
Section: python
Section: utils
Priority: optional
Maintainer: Debian Privacy Tools Maintainers <pkg-privacy-maintainers@lists.alioth.debian.org>
Uploaders: Georg Faerber <georg@riseup.net>,
Jonas Meurer <jonas@freesources.org>,
Build-Depends: debhelper (>= 11),
Build-Depends: debhelper (>= 11~),
dh-exec,
dh-python,
gir1.2-gdkpixbuf-2.0,
......@@ -13,21 +13,22 @@ Build-Depends: debhelper (>= 11),
python3,
python3-gi-cairo,
python3-mutagen,
Standards-Version: 4.1.4
python3-setuptools,
Standards-Version: 4.2.1
X-Python3-Version: >= 3.5
Homepage: https://0xacab.org/jvoisin/mat2
Vcs-Git: https://salsa.debian.org/debian/mat2.git
Vcs-Browser: https://salsa.debian.org/debian/mat2
Vcs-Git: https://salsa.debian.org/pkg-privacy-team/mat2.git
Vcs-Browser: https://salsa.debian.org/pkg-privacy-team/mat2
Package: mat2
Architecture: all
Depends: ${misc:Depends}, ${python3:Depends}
Recommends: gir1.2-gdkpixbuf-2.0,
gir1.2-poppler-0.18,
libimage-exiftool-perl,
python-nautilus,
python3-gi-cairo,
python3-mutagen,
Depends: gir1.2-gdkpixbuf-2.0,
gir1.2-poppler-0.18,
libimage-exiftool-perl,
python3-gi-cairo,
python3-mutagen,
${misc:Depends},
${python3:Depends},
Description: Metadata anonymisation toolkit v2
Metadata consist of information that characterizes data. Metadata are
used to provide documentation for data products. In essence, metadata
......
#!/usr/bin/dh-exec
mat2.py => /usr/bin/mat2
nautilus/nautilus_mat2.py => /usr/share/nautilus-python/extensions/mat2.py
mat2 => /usr/bin/mat2
From: jvoisin <julien.voisin@dustri.org>
Date: Fri, 18 May 2018 23:52:40 +0200
Subject: Rename some files to simplify packaging
- the `src` folder is now `libmat2`
- the `main.py` script is now `mat2.py`
---
.gitlab-ci.yml | 6 +++---
README.md | 2 +-
{src => libmat2}/__init__.py | 0
{src => libmat2}/abstract.py | 0
{src => libmat2}/audio.py | 0
{src => libmat2}/harmless.py | 0
{src => libmat2}/images.py | 0
{src => libmat2}/office.py | 0
{src => libmat2}/parser_factory.py | 6 +++---
{src => libmat2}/pdf.py | 0
{src => libmat2}/torrent.py | 0
main.py => mat2.py | 2 +-
tests/test_climat2.py | 44 +++++++++++++++++++-------------------
tests/test_libmat2.py | 2 +-
14 files changed, 31 insertions(+), 31 deletions(-)
rename {src => libmat2}/__init__.py (100%)
rename {src => libmat2}/abstract.py (100%)
rename {src => libmat2}/audio.py (100%)
rename {src => libmat2}/harmless.py (100%)
rename {src => libmat2}/images.py (100%)
rename {src => libmat2}/office.py (100%)
rename {src => libmat2}/parser_factory.py (86%)
rename {src => libmat2}/pdf.py (100%)
rename {src => libmat2}/torrent.py (100%)
rename main.py => mat2.py (98%)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 90596a5..37f3b01 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,14 +9,14 @@ bandit:
script:
- apt-get -qqy update
- apt-get -qqy install --no-install-recommends python3-bandit
- - bandit -r ./src --format txt --skip B404,B603
+ - bandit -r ./libmat2 --format txt --skip B404,B603
pyflakes:
stage: linting
script:
- apt-get -qqy update
- apt-get -qqy install --no-install-recommends pyflakes3
- - pyflakes3 ./src
+ - pyflakes3 ./libmat2
tests:
stage: test
@@ -24,4 +24,4 @@ tests:
- apt-get -qqy update
- apt-get -qqy install --no-install-recommends python3-mutagen python3-gi-cairo gir1.2-poppler-0.18 gir1.2-gdkpixbuf-2.0 libimage-exiftool-perl python3-coverage
- python3-coverage run -m unittest discover -s tests/
- - python3-coverage report -m --include 'src/*'
+ - python3-coverage report -m --include 'libmat2/*'
diff --git a/README.md b/README.md
index 51f3c63..0499372 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ $ python3 -m unittest discover -v
# Supported formats
```bash
-$ python3 ./main.py -l
+$ python3 ./mat2.py -l
```
# Related softwares
diff --git a/src/__init__.py b/libmat2/__init__.py
similarity index 100%
rename from src/__init__.py
rename to libmat2/__init__.py
diff --git a/src/abstract.py b/libmat2/abstract.py
similarity index 100%
rename from src/abstract.py
rename to libmat2/abstract.py
diff --git a/src/audio.py b/libmat2/audio.py
similarity index 100%
rename from src/audio.py
rename to libmat2/audio.py
diff --git a/src/harmless.py b/libmat2/harmless.py
similarity index 100%
rename from src/harmless.py
rename to libmat2/harmless.py
diff --git a/src/images.py b/libmat2/images.py
similarity index 100%
rename from src/images.py
rename to libmat2/images.py
diff --git a/src/office.py b/libmat2/office.py
similarity index 100%
rename from src/office.py
rename to libmat2/office.py
diff --git a/src/parser_factory.py b/libmat2/parser_factory.py
similarity index 86%
rename from src/parser_factory.py
rename to libmat2/parser_factory.py
index 48616b0..dbe68b9 100644
--- a/src/parser_factory.py
+++ b/libmat2/parser_factory.py
@@ -10,10 +10,10 @@ from . import abstract, unsupported_extensions
T = TypeVar('T', bound='abstract.AbstractParser')
# This loads every parser in a dynamic way
-for module_loader, name, ispkg in pkgutil.walk_packages('.src'):
- if not name.startswith('src.'):
+for module_loader, name, ispkg in pkgutil.walk_packages('.libmat2'):
+ if not name.startswith('libmat2.'):
continue
- elif name == 'src.abstract':
+ elif name == 'libmat2.abstract':
continue
importlib.import_module(name)
diff --git a/src/pdf.py b/libmat2/pdf.py
similarity index 100%
rename from src/pdf.py
rename to libmat2/pdf.py
diff --git a/src/torrent.py b/libmat2/torrent.py
similarity index 100%
rename from src/torrent.py
rename to libmat2/torrent.py
diff --git a/main.py b/mat2.py
similarity index 98%
rename from main.py
rename to mat2.py
index 55489be..aa213ab 100755
--- a/main.py
+++ b/mat2.py
@@ -8,7 +8,7 @@ import mimetypes
import argparse
import multiprocessing
-from src import parser_factory, unsupported_extensions
+from libmat2 import parser_factory, unsupported_extensions
__version__ = '0.1.1'
diff --git a/tests/test_climat2.py b/tests/test_climat2.py
index 864ee0d..36973bf 100644
--- a/tests/test_climat2.py
+++ b/tests/test_climat2.py
@@ -6,43 +6,43 @@ import unittest
class TestHelp(unittest.TestCase):
def test_help(self):
- proc = subprocess.Popen(['./main.py', '--help'], stdout=subprocess.PIPE)
+ proc = subprocess.Popen(['./mat2.py', '--help'], stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
- self.assertIn(b'usage: main.py [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout)
+ self.assertIn(b'usage: mat2.py [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout)
def test_no_arg(self):
- proc = subprocess.Popen(['./main.py'], stdout=subprocess.PIPE)
+ proc = subprocess.Popen(['./mat2.py'], stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
- self.assertIn(b'usage: main.py [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout)
+ self.assertIn(b'usage: mat2.py [-h] [-v] [-l] [-c | -s | -L] [files [files ...]]', stdout)
class TestVersion(unittest.TestCase):
def test_version(self):
- proc = subprocess.Popen(['./main.py', '--version'], stdout=subprocess.PIPE)
+ proc = subprocess.Popen(['./mat2.py', '--version'], stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertTrue(stdout.startswith(b'MAT2 '))
class TestExclusiveArgs(unittest.TestCase):
def test_version(self):
- proc = subprocess.Popen(['./main.py', '-s', '-c'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ proc = subprocess.Popen(['./mat2.py', '-s', '-c'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = proc.communicate()
- self.assertIn(b'main.py: error: argument -c/--check: not allowed with argument -s/--show', stderr)
+ self.assertIn(b'mat2.py: error: argument -c/--check: not allowed with argument -s/--show', stderr)
class TestReturnValue(unittest.TestCase):
def test_nonzero(self):
- ret = subprocess.call(['./main.py', './main.py'], stdout=subprocess.DEVNULL)
+ ret = subprocess.call(['./mat2.py', './mat2.py'], stdout=subprocess.DEVNULL)
self.assertEqual(255, ret)
- ret = subprocess.call(['./main.py', '--whololo'], stderr=subprocess.DEVNULL)
+ ret = subprocess.call(['./mat2.py', '--whololo'], stderr=subprocess.DEVNULL)
self.assertEqual(2, ret)
def test_zero(self):
- ret = subprocess.call(['./main.py'], stdout=subprocess.DEVNULL)
+ ret = subprocess.call(['./mat2.py'], stdout=subprocess.DEVNULL)
self.assertEqual(0, ret)
- ret = subprocess.call(['./main.py', '--show', './main.py'], stdout=subprocess.DEVNULL)
+ ret = subprocess.call(['./mat2.py', '--show', './mat2.py'], stdout=subprocess.DEVNULL)
self.assertEqual(0, ret)
@@ -50,16 +50,16 @@ class TestCleanMeta(unittest.TestCase):
def test_jpg(self):
shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg')
- proc = subprocess.Popen(['./main.py', '--show', './tests/data/clean.jpg'],
+ proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/clean.jpg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'Comment: Created with GIMP', stdout)
- proc = subprocess.Popen(['./main.py', './tests/data/clean.jpg'],
+ proc = subprocess.Popen(['./mat2.py', './tests/data/clean.jpg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
- proc = subprocess.Popen(['./main.py', '--show', './tests/data/clean.cleaned.jpg'],
+ proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/clean.cleaned.jpg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertNotIn(b'Comment: Created with GIMP', stdout)
@@ -69,25 +69,25 @@ class TestCleanMeta(unittest.TestCase):
class TestGetMeta(unittest.TestCase):
def test_pdf(self):
- proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.pdf'],
+ proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.pdf'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'producer: pdfTeX-1.40.14', stdout)
def test_png(self):
- proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.png'],
+ proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.png'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'Comment: This is a comment, be careful!', stdout)
def test_jpg(self):
- proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.jpg'],
+ proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.jpg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'Comment: Created with GIMP', stdout)
def test_docx(self):
- proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.docx'],
+ proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.docx'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'Application: LibreOffice/5.4.5.1$Linux_X86_64', stdout)
@@ -95,7 +95,7 @@ class TestGetMeta(unittest.TestCase):
self.assertIn(b'revision: 1', stdout)
def test_odt(self):
- proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.odt'],
+ proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.odt'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'generator: LibreOffice/3.3$Unix', stdout)
@@ -103,14 +103,14 @@ class TestGetMeta(unittest.TestCase):
self.assertIn(b'date_time: 2011-07-26 02:40:16', stdout)
def test_mp3(self):
- proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.mp3'],
+ proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.mp3'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'TALB: harmfull', stdout)
self.assertIn(b'COMM::: Thank you for using MAT !', stdout)
def test_flac(self):
- proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.flac'],
+ proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.flac'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'comments: Thank you for using MAT !', stdout)
@@ -118,7 +118,7 @@ class TestGetMeta(unittest.TestCase):
self.assertIn(b'title: I am so', stdout)
def test_ogg(self):
- proc = subprocess.Popen(['./main.py', '--show', './tests/data/dirty.ogg'],
+ proc = subprocess.Popen(['./mat2.py', '--show', './tests/data/dirty.ogg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'comments: Thank you for using MAT !', stdout)
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py
index f3e11d9..89a5811 100644
--- a/tests/test_libmat2.py
+++ b/tests/test_libmat2.py
@@ -6,7 +6,7 @@ import os
import zipfile
import tempfile
-from src import pdf, images, audio, office, parser_factory, torrent
+from libmat2 import pdf, images, audio, office, parser_factory, torrent
class TestParserFactory(unittest.TestCase):
Description: autopkgtest: fix tests
Some tests invoke the mat2 binary via './mat2'. This fails during
autopkgtest, as the software "as installed" should be tested, and
therefore, the 'tests' directory and the binary are not stored in the
same directory. The following upstream patch fixes this via
introducing an environment variable, which, if set, calls the binary
stored in '/usr/bin/'.
Author: Georg Faerber <georg@riseup.net>
Upstream: https://0xacab.org/jvoisin/mat2/issues/16#note_153878
Last-Update: 2018-10-04
--
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/tests/test_climat2.py
+++ b/tests/test_climat2.py
@@ -4,16 +4,24 @@
import unittest
+mat2_binary = ['./mat2']
+
+if 'MAT2_GLOBAL_PATH_TESTSUITE' in os.environ:
+ # Debian runs tests after installing the package
+ # https://0xacab.org/jvoisin/mat2/issues/16#note_153878
+ mat2_binary = ['/usr/bin/env', 'mat2']
+
+
class TestHelp(unittest.TestCase):
def test_help(self):
- proc = subprocess.Popen(['./mat2', '--help'], stdout=subprocess.PIPE)
+ proc = subprocess.Popen(mat2_binary + ['--help'], stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'usage: mat2 [-h] [-v] [-l] [--check-dependencies] [-V]',
stdout)
self.assertIn(b'[--unknown-members policy] [-s | -L]', stdout)
def test_no_arg(self):
- proc = subprocess.Popen(['./mat2'], stdout=subprocess.PIPE)
+ proc = subprocess.Popen(mat2_binary, stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'usage: mat2 [-h] [-v] [-l] [--check-dependencies] [-V]',
stdout)
@@ -22,29 +30,29 @@
class TestVersion(unittest.TestCase):
def test_version(self):
- proc = subprocess.Popen(['./mat2', '--version'], stdout=subprocess.PIPE)
+ proc = subprocess.Popen(mat2_binary + ['--version'], stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertTrue(stdout.startswith(b'MAT2 '))
class TestDependencies(unittest.TestCase):
def test_dependencies(self):
- proc = subprocess.Popen(['./mat2', '--check-dependencies'], stdout=subprocess.PIPE)
+ proc = subprocess.Popen(mat2_binary + ['--check-dependencies'], stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertTrue(b'MAT2' in stdout)
class TestReturnValue(unittest.TestCase):
def test_nonzero(self):
- ret = subprocess.call(['./mat2', './mat2'], stdout=subprocess.DEVNULL)
+ ret = subprocess.call(mat2_binary + ['mat2'], stdout=subprocess.DEVNULL)
self.assertEqual(255, ret)
- ret = subprocess.call(['./mat2', '--whololo'], stderr=subprocess.DEVNULL)
+ ret = subprocess.call(mat2_binary + ['--whololo'], stderr=subprocess.DEVNULL)
self.assertEqual(2, ret)
def test_zero(self):
- ret = subprocess.call(['./mat2'], stdout=subprocess.DEVNULL)
+ ret = subprocess.call(mat2_binary, stdout=subprocess.DEVNULL)
self.assertEqual(0, ret)
- ret = subprocess.call(['./mat2', '--show', './mat2'], stdout=subprocess.DEVNULL)
+ ret = subprocess.call(mat2_binary + ['--show', 'mat2'], stdout=subprocess.DEVNULL)
self.assertEqual(0, ret)
@@ -57,19 +65,19 @@
shutil.copy('./tests/data/dirty.jpg', './tests/data/folder/clean1.jpg')
shutil.copy('./tests/data/dirty.jpg', './tests/data/folder/clean2.jpg')
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/folder/'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/folder/'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'Comment: Created with GIMP', stdout)
- proc = subprocess.Popen(['./mat2', './tests/data/folder/'],
+ proc = subprocess.Popen(mat2_binary + ['./tests/data/folder/'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
os.remove('./tests/data/folder/clean1.jpg')
os.remove('./tests/data/folder/clean2.jpg')
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/folder/'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/folder/'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertNotIn(b'Comment: Created with GIMP', stdout)
@@ -81,16 +89,16 @@
def test_jpg(self):
shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg')
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/clean.jpg'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/clean.jpg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'Comment: Created with GIMP', stdout)
- proc = subprocess.Popen(['./mat2', './tests/data/clean.jpg'],
+ proc = subprocess.Popen(mat2_binary + ['./tests/data/clean.jpg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/clean.cleaned.jpg'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/clean.cleaned.jpg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertNotIn(b'Comment: Created with GIMP', stdout)
@@ -100,32 +108,32 @@
class TestIsSupported(unittest.TestCase):
def test_pdf(self):
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.pdf'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.pdf'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertNotIn(b"isn't supported", stdout)
class TestGetMeta(unittest.TestCase):
def test_pdf(self):
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.pdf'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.pdf'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'producer: pdfTeX-1.40.14', stdout)
def test_png(self):
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.png'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.png'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'Comment: This is a comment, be careful!', stdout)
def test_jpg(self):
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.jpg'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.jpg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'Comment: Created with GIMP', stdout)
def test_docx(self):
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.docx'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.docx'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'Application: LibreOffice/5.4.5.1$Linux_X86_64', stdout)
@@ -133,7 +141,7 @@
self.assertIn(b'revision: 1', stdout)
def test_odt(self):
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.odt'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.odt'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'generator: LibreOffice/3.3$Unix', stdout)
@@ -141,14 +149,14 @@
self.assertIn(b'date_time: 2011-07-26 02:40:16', stdout)
def test_mp3(self):
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.mp3'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.mp3'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'TALB: harmfull', stdout)
self.assertIn(b'COMM::: Thank you for using MAT !', stdout)
def test_flac(self):
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.flac'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.flac'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'comments: Thank you for using MAT !', stdout)
@@ -156,7 +164,7 @@
self.assertIn(b'title: I am so', stdout)
def test_ogg(self):
- proc = subprocess.Popen(['./mat2', '--show', './tests/data/dirty.ogg'],
+ proc = subprocess.Popen(mat2_binary + ['--show', './tests/data/dirty.ogg'],
stdout=subprocess.PIPE)
stdout, _ = proc.communicate()
self.assertIn(b'comments: Thank you for using MAT !', stdout)
Description: fix shebang
Author: Georg Faerber <georg@riseup.net>
Forwarded: https://0xacab.org/jvoisin/mat2/merge_requests/19
Last-Update: 2018-10-03
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/libmat2/__init__.py
+++ b/libmat2/__init__.py
@@ -1,4 +1,4 @@
-#!/bin/env python3
+#!/usr/bin/env python3
import os
import collections
From: Jonas Meurer <jonas@freesources.org>
Date: Sat, 19 May 2018 17:08:59 +0200
Subject: libmat2/__init__.py: Fix path to env
---
libmat2/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmat2/__init__.py b/libmat2/__init__.py
index 07d3036..d660e90 100644
--- a/libmat2/__init__.py
+++ b/libmat2/__init__.py
@@ -1,4 +1,4 @@
-#!/bin/env python3
+#!/usr/bin/env python3
# A set of extension that aren't supported, despite matching a supported mimetype
unsupported_extensions = set(['bat', 'c', 'h', 'ksh', 'pl', 'txt', 'asc',
From: Jonas Meurer <jonas@freesources.org>
Date: Sun, 20 May 2018 20:16:36 +0200
Subject: libmat2/*: Fix importing packages when installed in global python3
path
---
libmat2/audio.py | 4 ++--
libmat2/harmless.py | 4 ++--
libmat2/images.py | 6 +++---
libmat2/office.py | 5 +++--
libmat2/parser_factory.py | 7 ++++---
libmat2/pdf.py | 4 ++--
libmat2/torrent.py | 4 ++--
7 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/libmat2/audio.py b/libmat2/audio.py
index 3a6aa79..d64cb73 100644
--- a/libmat2/audio.py
+++ b/libmat2/audio.py
@@ -2,10 +2,10 @@ import shutil
import mutagen
-from . import abstract
+import libmat2.abstract
-class MutagenParser(abstract.AbstractParser):
+class MutagenParser(libmat2.abstract.AbstractParser):
def get_meta(self):
f = mutagen.File(self.filename)
if f.tags:
diff --git a/libmat2/harmless.py b/libmat2/harmless.py
index aa00582..fcf20cc 100644
--- a/libmat2/harmless.py
+++ b/libmat2/harmless.py
@@ -1,7 +1,7 @@
-from . import abstract
+import libmat2.abstract
-class HarmlessParser(abstract.AbstractParser):
+class HarmlessParser(libmat2.abstract.AbstractParser):
""" This is the parser for filetypes that do not contain metadata. """
mimetypes = {'application/xml', 'text/plain'}
diff --git a/libmat2/images.py b/libmat2/images.py
index c84952a..8c172f0 100644
--- a/libmat2/images.py
+++ b/libmat2/images.py
@@ -8,10 +8,10 @@ import gi
gi.require_version('GdkPixbuf', '2.0')
from gi.repository import GdkPixbuf
-from . import abstract
+import libmat2.abstract
-class PNGParser(abstract.AbstractParser):
+class PNGParser(libmat2.abstract.AbstractParser):
mimetypes = {'image/png', }
meta_whitelist = {'SourceFile', 'ExifToolVersion', 'FileName',
'Directory', 'FileSize', 'FileModifyDate',
@@ -41,7 +41,7 @@ class PNGParser(abstract.AbstractParser):
return True
-class GdkPixbufAbstractParser(abstract.AbstractParser):
+class GdkPixbufAbstractParser(libmat2.abstract.AbstractParser):
""" GdkPixbuf can handle a lot of surfaces, so we're rending images on it,
this has the side-effect of removing metadata completely.
"""
diff --git a/libmat2/office.py b/libmat2/office.py
index 749fc7d..1b2a221 100644
--- a/libmat2/office.py
+++ b/libmat2/office.py
@@ -5,10 +5,11 @@ import tempfile
import datetime
import zipfile
-from . import abstract, parser_factory
+import libmat2.abstract
+from . import parser_factory
-class ArchiveBasedAbstractParser(abstract.AbstractParser):
+class ArchiveBasedAbstractParser(libmat2.abstract.AbstractParser):
def _clean_zipinfo(self, zipinfo: zipfile.ZipInfo) -> zipfile.ZipInfo:
zipinfo.compress_type = zipfile.ZIP_DEFLATED
zipinfo.create_system = 3 # Linux
diff --git a/libmat2/parser_factory.py b/libmat2/parser_factory.py
index dbe68b9..3068ab4 100644
--- a/libmat2/parser_factory.py
+++ b/libmat2/parser_factory.py
@@ -4,10 +4,11 @@ import importlib
import pkgutil
from typing import TypeVar
-from . import abstract, unsupported_extensions
+import libmat2.abstract
+from . import unsupported_extensions
-T = TypeVar('T', bound='abstract.AbstractParser')
+T = TypeVar('T', bound='libmat2.abstract.AbstractParser')
# This loads every parser in a dynamic way
for module_loader, name, ispkg in pkgutil.walk_packages('.libmat2'):
@@ -23,7 +24,7 @@ def _get_parsers() -> list:
def __get_parsers(cls):
return cls.__subclasses__() + \
[g for s in cls.__subclasses__() for g in __get_parsers(s)]
- return __get_parsers(abstract.AbstractParser)
+ return __get_parsers(libmat2.abstract.AbstractParser)
def get_parser(filename: str) -> (T, str):
diff --git a/libmat2/pdf.py b/libmat2/pdf.py
index 5b99192..54c420f 100644
--- a/libmat2/pdf.py
+++ b/libmat2/pdf.py
@@ -13,12 +13,12 @@ import gi
gi.require_version('Poppler', '0.18')
from gi.repository import Poppler, GLib
-from . import abstract
+import libmat2.abstract
logging.basicConfig(level=logging.DEBUG)
-class PDFParser(abstract.AbstractParser):
+class PDFParser(libmat2.abstract.AbstractParser):
mimetypes = {'application/pdf', }
meta_list = {'author', 'creation-date', 'creator', 'format', 'keywords',
'metadata', 'mod-date', 'producer', 'subject', 'title',
diff --git a/libmat2/torrent.py b/libmat2/torrent.py
index cb4b5e3..90cd421 100644
--- a/libmat2/torrent.py
+++ b/libmat2/torrent.py
@@ -1,7 +1,7 @@
-from . import abstract
+import libmat2.abstract
-class TorrentParser(abstract.AbstractParser):
+class TorrentParser(libmat2.abstract.AbstractParser):
mimetypes = {'application/x-bittorrent', }
whitelist = {b'announce', b'announce-list', b'info'}
0001-Rename-some-files-to-simplify-packaging.patch
0002-libmat2-__init__.py-Fix-path-to-env.patch
0003-libmat2-Fix-importing-packages-when-installed-in-glo.patch
0002-fix-shebang.patch
0001-autopkgtest-fix-tests.patch
#!/usr/bin/make -f
export DH_VERBOSE=1
%:
dh $@ --with python3
dh $@ --with python3 --buildsystem=pybuild
override_dh_auto_test:
python3 -m unittest discover
dh_auto_test
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
python3 -m unittest discover -v
endif
Tests: test-installed
Depends: @
Restrictions: allow-stderr, needs-recommends
Test-Command: pytest-3
Depends: @,
python3-pytest
#!/bin/sh
# autopkgtest check: Run MAT2 testsuite with installed version outside of
# source tree
set -e
WORKDIR=$(mktemp -d)
cp -prv test/* $WORKDIR
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
python3 -m unittest discover -v