[Pkg-privacy-commits] [Git][pkg-privacy-team/mat2][d/0.7.0-2] 6 commits: debian/patches: Add patch to make the Nautilus ext work with Python2.7
Georg Faerber
gitlab at salsa.debian.org
Wed Feb 27 22:09:00 GMT 2019
Georg Faerber pushed to branch d/0.7.0-2 at Privacy Maintainers / mat2
Commits:
e6e64697 by Georg Faerber at 2019-02-27T22:05:33Z
debian/patches: Add patch to make the Nautilus ext work with Python2.7
- - - - -
59864785 by Georg Faerber at 2019-02-27T22:05:39Z
debian/patches: Pull in patch to improve compatibility of archives
While this patch was applied upstream to improve epub compatibility,
which is only to be released in 0.8.0, and so probably won't make it
into Debian buster, it should help with other formats as a side-effect,
too.
- - - - -
609d64da by Georg Faerber at 2019-02-27T22:05:39Z
debian/control: Sort supported file formats in description
- - - - -
1e989b97 by Georg Faerber at 2019-02-27T22:05:39Z
debian/control: Recommend python-nautilus
- - - - -
ec04f25d by Georg Faerber at 2019-02-27T22:05:39Z
debian/mat2.install: Install the Nautilus extension
- - - - -
f70cbc6e by Georg Faerber at 2019-02-27T22:06:31Z
debian/changelog: Debian release 0.7.0-2
- - - - -
6 changed files:
- debian/changelog
- debian/control
- debian/mat2.install
- + debian/patches/0001-nautilus-ext-python2.7.patch
- + debian/patches/0002-archive-formats-mimetype-first.patch
- debian/patches/series
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,24 @@
+mat2 (0.7.0-2) unstable; urgency=medium
+
+ * d/control:
+ - Recommend python-nautilus to make use of the Nautilus extension.
+ - Sort supported file formats in the description alphabetically.
+ * d/mat2.install:
+ - Install the Nautilus extension. (Closes: #910491)
+ * d/patches:
+ - Add patch to make the Nautilus extension work with Python 2.7, as
+ python-nautilus still builds against it in Debian testing. This is an
+ important step to handle the transition from mat to mat2.
+ Thanks a lot for input, comments and review to intrigeri, Daniel Kahn
+ Gillmor, Julien Voisin and Jonas Meurer!
+ - Pull in upstream patch to fix handling of mimetypes in archive-based
+ formats. While this was applied upstream to improve epub compatibility,
+ which is only to be released in 0.8.0, and so probably won't make it
+ into Debian buster, it should help with other formats as a side-effect
+ as well.
+
+ -- Georg Faerber <georg at riseup.net> Wed, 27 Feb 2019 22:06:11 +0000
+
mat2 (0.7.0-1) unstable; urgency=medium
* New upstream release.
=====================================
debian/control
=====================================
@@ -32,6 +32,7 @@ Depends: gir1.2-gdkpixbuf-2.0,
${misc:Depends},
${python3:Depends},
Recommends: bubblewrap,
+ python-nautilus,
Suggests: ffmpeg,
Description: Metadata anonymisation toolkit v2
Metadata consist of information that characterizes data. Metadata are
@@ -54,19 +55,19 @@ Description: Metadata anonymisation toolkit v2
any metadata, or better: use plain-text.
.
Formats supported to some extent are:
+ - Audio Video Interleave (.avi)
+ - Free Lossless Audio Codec (.flac)
+ - Graphics Interchange Format (.gif)
+ - Hypertext Markup Language (.html)
- Portable Network Graphics (PNG)
- JPEG (.jpeg, .jpg, ...)
- - Open Document (.odt, .odx, .ods, ...)
+ - MPEG Audio (.mp3, .mp2, .mp1, .mpa)
+ - MPEG-4 (.mp4)
- Office Openxml (.docx, .pptx, .xlsx, ...)
+ - Ogg Vorbis (.ogg)
+ - Open Document (.odt, .odx, .ods, ...)
- Portable Document Fileformat (.pdf)
- Tape ARchive (.tar, .tar.bz2, .tar.gz)
- - ZIP (.zip)
- - MPEG Audio (.mp3, .mp2, .mp1, .mpa)
- - Ogg Vorbis (.ogg)
- - Free Lossless Audio Codec (.flac)
- Torrent (.torrent)
- - Audio Video Interleave (.avi)
- - MPEG-4 (.mp4)
- Windows Media Video (.wmv)
- - Graphics Interchange Format (.gif)
- - Hypertext Markup Language (.html)
+ - ZIP (.zip)
=====================================
debian/mat2.install
=====================================
@@ -1,2 +1,3 @@
#!/usr/bin/dh-exec
mat2 => /usr/bin/mat2
+nautilus/mat2.py => /usr/share/nautilus-python/extensions/mat2.py
=====================================
debian/patches/0001-nautilus-ext-python2.7.patch
=====================================
@@ -0,0 +1,152 @@
+From: Jonas Meurer <jonas at freesources.org>
+Date: Fri, 22 Feb 2019 22:59:18 +0100
+Subject: Patch nautilus/mat2.py to be a python2 wrapper arount mat2
+
+* Since Debian Buster still ships only Python 2 version of
+ nautilus-python, the only option to use the mat2 nautilus
+ extension is to make it a python2 wrapper around mat2.
+
+Author: Georg Faerber <georg at riseup.net>, Julien Voisin
+ <julien.voisin at dustri.org>
+Forwarded: not-needed
+---
+ nautilus/mat2.py | 51 +++++++++++++++++++++++++++------------------------
+ 1 file changed, 27 insertions(+), 24 deletions(-)
+
+diff --git a/nautilus/mat2.py b/nautilus/mat2.py
+index 562f8a7..d0794d0 100644
+--- a/nautilus/mat2.py
++++ b/nautilus/mat2.py
+@@ -1,5 +1,5 @@
+-#!/usr/bin/env python3
+-
++#!/usr/bin/env python
++# -*- coding: utf-8 -*-
+ """
+ Because writing GUI is non-trivial (cf. https://0xacab.org/jvoisin/mat2/issues/3),
+ we decided to write a Nautilus extensions instead
+@@ -12,34 +12,37 @@ thread, so we'll have to resort to using a `queue` to pass "messages" around.
+
+ # pylint: disable=no-name-in-module,unused-argument,no-self-use,import-error
+
+-import queue
++import Queue as queue
+ import threading
+-from typing import Tuple, Optional, List
+-from urllib.parse import unquote
++from urlparse import unquote
+
+ import gi
+ gi.require_version('Nautilus', '3.0')
+ gi.require_version('Gtk', '3.0')
+ gi.require_version('GdkPixbuf', '2.0')
+ from gi.repository import Nautilus, GObject, Gtk, Gio, GLib, GdkPixbuf
++import subprocess
++import mimetypes
++
+
+-from libmat2 import parser_factory
++def _remove_metadata(fpath):
++ """ This is a simple wrapper around the mat2 cli. """
++ try:
++ return subprocess.check_output(['mat2', fpath])
++ except subprocess.CalledProcessError, e:
++ return e.output
+
+
+-def _remove_metadata(fpath) -> Tuple[bool, Optional[str]]:
+- """ This is a simple wrapper around libmat2, because it's
+- easier and cleaner this way.
+- """
+- parser, mtype = parser_factory.get_parser(fpath)
+- if parser is None:
+- return False, mtype
+- return parser.remove_all(), mtype
++def _guess_mtype(fpath):
++ """ Function to guess the mtype of a given file. """
++ mtype, _ = mimetypes.guess_type(fpath)
++ return mtype
+
+ class Mat2Extension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationWidgetProvider):
+ """ This class adds an item to the right-clic menu in Nautilus. """
+
+ def __init__(self):
+- super().__init__()
++ super(Mat2Extension, self).__init__()
+ self.infobar_hbox = None
+ self.infobar = None
+ self.failed_items = list()
+@@ -61,7 +64,7 @@ class Mat2Extension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationWid
+ self.infobar.get_content_area().pack_start(self.infobar_hbox, True, True, 0)
+ self.infobar.show_all()
+
+- def get_widget(self, uri, window) -> Gtk.Widget:
++ def get_widget(self, uri, window):
+ """ This is the method that we have to implement (because we're
+ a LocationWidgetProvider) in order to show our infobar.
+ """
+@@ -103,7 +106,7 @@ class Mat2Extension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationWid
+ window.show_all()
+
+ @staticmethod
+- def __validate(fileinfo) -> Tuple[bool, str]:
++ def __validate(fileinfo):
+ """ Validate if a given file FileInfo `fileinfo` can be processed.
+ Returns a boolean, and a textreason why"""
+ if fileinfo.get_uri_scheme() != "file" or fileinfo.is_directory():
+@@ -112,7 +115,7 @@ class Mat2Extension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationWid
+ return False, "Not writeable"
+ return True, ""
+
+- def __create_treeview(self) -> Gtk.TreeView:
++ def __create_treeview(self):
+ liststore = Gtk.ListStore(GdkPixbuf.Pixbuf, str, str)
+ treeview = Gtk.TreeView(model=liststore)
+
+@@ -144,7 +147,7 @@ class Mat2Extension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationWid
+ treeview.show_all()
+ return treeview
+
+- def __create_progressbar(self) -> Gtk.ProgressBar:
++ def __create_progressbar(self):
+ """ Create the progressbar used to notify that files are currently
+ being processed.
+ """
+@@ -161,7 +164,7 @@ class Mat2Extension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationWid
+
+ return progressbar
+
+- def __update_progressbar(self, processing_queue, progressbar) -> bool:
++ def __update_progressbar(self, processing_queue, progressbar):
+ """ This method is run via `Glib.add_idle` to update the progressbar."""
+ try:
+ fname = processing_queue.get(block=False)
+@@ -186,7 +189,7 @@ class Mat2Extension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationWid
+ self.infobar.show_all()
+ return True
+
+- def __clean_files(self, files: list, processing_queue: queue.Queue) -> bool:
++ def __clean_files(self, files, processing_queue):
+ """ This method is threaded in order to avoid blocking the GUI
+ while cleaning up the files.
+ """
+@@ -200,8 +203,8 @@ class Mat2Extension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationWid
+ continue
+
+ fpath = unquote(fileinfo.get_uri()[7:]) # `len('file://') = 7`
+- success, mtype = _remove_metadata(fpath)
+- if not success:
++ if _remove_metadata(fpath):
++ mtype = _guess_mtype(fpath)
+ self.failed_items.append((fname, mtype, 'Unsupported/invalid'))
+ processing_queue.put(None) # signal that we processed all the files
+ return True
+@@ -226,7 +229,7 @@ class Mat2Extension(GObject.GObject, Nautilus.MenuProvider, Nautilus.LocationWid
+ """ https://bugzilla.gnome.org/show_bug.cgi?id=784278 """
+ return None
+
+- def get_file_items(self, window, files) -> Optional[List[Nautilus.MenuItem]]:
++ def get_file_items(self, window, files):
+ """ This method is the one allowing us to create a menu item.
+ """
+ # Do not show the menu item if not a single file has a chance to be
=====================================
debian/patches/0002-archive-formats-mimetype-first.patch
=====================================
@@ -0,0 +1,67 @@
+Description: In archive-based formats, the 'mimetype' file comes first
+ While this patch was applied upstream to improve epub compatibility,
+ which is only to be released in 0.8.0, and so probably won't make it
+ into Debian buster, it should help with other formats as a side-effect,
+ too.
+Origin: upstream <https://0xacab.org/jvoisin/mat2/commit/545dccc3527fcdf851b30b072ae6c7222b711777.patch>
+Forwarded: not-needed
+Reviewed-by: Georg Faerber <georg at riseup.net>
+Last-Update: 2019-02-27
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/libmat2/archive.py
++++ b/libmat2/archive.py
+@@ -4,13 +4,14 @@
+ import os
+ import logging
+ import shutil
+-from typing import Dict, Set, Pattern, Union, Any
++from typing import Dict, Set, Pattern, Union, Any, List
+
+ from . import abstract, UnknownMemberPolicy, parser_factory
+
+ # Make pyflakes happy
+ assert Set
+ assert Pattern
++assert List
+ assert Union
+
+
+@@ -115,9 +116,16 @@
+ temp_folder = tempfile.mkdtemp()
+ abort = False
+
++ items = list() # type: List[zipfile.ZipInfo]
++ for item in sorted(zin.infolist(), key=lambda z: z.filename):
++ if item.filename == 'mimetype':
++ items = [item] + items
++ else:
++ items.append(item)
++
+ # Since files order is a fingerprint factor,
+ # we're iterating (and thus inserting) them in lexicographic order.
+- for item in sorted(zin.infolist(), key=lambda z: z.filename):
++ for item in items:
+ if item.filename[-1] == '/': # `is_dir` is added in Python3.6
+ continue # don't keep empty folders
+
+--- a/tests/test_deep_cleaning.py
++++ b/tests/test_deep_cleaning.py
+@@ -83,6 +83,8 @@
+ previous_name = ''
+ for item in zin.infolist():
+ if previous_name == '':
++ if item.filename == 'mimetype':
++ continue
+ previous_name = item.filename
+ continue
+ elif item.filename < previous_name:
+@@ -97,6 +99,8 @@
+ previous_name = ''
+ for item in zin.infolist():
+ if previous_name == '':
++ if item.filename == 'mimetype':
++ continue
+ previous_name = item.filename
+ continue
+ self.assertGreaterEqual(item.filename, previous_name)
=====================================
debian/patches/series
=====================================
@@ -0,0 +1,2 @@
+0002-archive-formats-mimetype-first.patch
+0001-nautilus-ext-python2.7.patch
View it on GitLab: https://salsa.debian.org/pkg-privacy-team/mat2/compare/5c7c1a7d2be9ffdee53184f84feb4bb9b35d27a3...f70cbc6ea71a66dccb659019b8fcb1c839019fde
--
View it on GitLab: https://salsa.debian.org/pkg-privacy-team/mat2/compare/5c7c1a7d2be9ffdee53184f84feb4bb9b35d27a3...f70cbc6ea71a66dccb659019b8fcb1c839019fde
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-privacy-commits/attachments/20190227/57a16eea/attachment-0001.html>
More information about the Pkg-privacy-commits
mailing list