[Reproducible-commits] [debbindiff] 10/10: Add support for comparing .mo files
Jérémy Bobbio
lunar at moszumanska.debian.org
Mon Sep 29 22:35:20 UTC 2014
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository debbindiff.
commit d9d75376add1ae3490cb74b33ae2885c49f97cd0
Author: Jérémy Bobbio <lunar at debian.org>
Date: Tue Sep 30 00:34:10 2014 +0200
Add support for comparing .mo files
---
debbindiff/comparators/__init__.py | 2 ++
debbindiff/comparators/gettext.py | 33 +++++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/debbindiff/comparators/__init__.py b/debbindiff/comparators/__init__.py
index dd14a61..30941ab 100644
--- a/debbindiff/comparators/__init__.py
+++ b/debbindiff/comparators/__init__.py
@@ -27,6 +27,7 @@ from debbindiff.comparators.bzip2 import compare_bzip2_files
from debbindiff.comparators.changes import compare_changes_files
from debbindiff.comparators.deb import compare_deb_files, compare_md5sums_files
from debbindiff.comparators.elf import compare_elf_files
+from debbindiff.comparators.gettext import compare_mo_files
from debbindiff.comparators.gzip import compare_gzip_files
from debbindiff.comparators.haskell import compare_hi_files
from debbindiff.comparators.text import compare_text_files
@@ -58,6 +59,7 @@ COMPARATORS = [
(None, r'\.changes$', compare_changes_files),
(None, r'\.(p_)?hi$', compare_hi_files),
(None, r'\/\./md5sums$', compare_md5sums_files),
+ (None, r'\.mo$', compare_mo_files),
(r'^application/x-xz(;|$)', r'\.xz$', compare_xz_files),
(r'^application/x-tar(;|$)', r'\.tar$', compare_tar_files),
(r'^application/x-debian-package(;|$)', r'\.deb$', compare_deb_files),
diff --git a/debbindiff/comparators/gettext.py b/debbindiff/comparators/gettext.py
new file mode 100644
index 0000000..4a65915
--- /dev/null
+++ b/debbindiff/comparators/gettext.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+#
+# debbindiff: highlight differences between two builds of Debian packages
+#
+# Copyright © 2014 Jérémy Bobbio <lunar at debian.org>
+#
+# debdindiff is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# debbindiff is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with debbindiff. If not, see <http://www.gnu.org/licenses/>.
+
+import subprocess
+from debbindiff.comparators.utils import binary_fallback
+from debbindiff.difference import Difference
+
+def msgunfmt(path):
+ return subprocess.check_output(['msgunfmt', path], shell=False)
+
+ at binary_fallback
+def compare_mo_files(path1, path2, source=None):
+ mo1 = msgunfmt(path1)
+ mo2 = msgunfmt(path2)
+ if mo1 != mo2:
+ return [Difference(mo1.splitlines(1), mo2.splitlines(1), path1, path2, source='msgunfmt')]
+ return []
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debbindiff.git
More information about the Reproducible-commits
mailing list