[Reproducible-commits] [debbindiff] 01/01: Do not create HTML file if there's no differences

Jérémy Bobbio lunar at moszumanska.debian.org
Tue Sep 30 15:40:21 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 a079b4e36c269671af649273412654da9ae760c6
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Tue Sep 30 17:39:42 2014 +0200

    Do not create HTML file if there's no differences
    
    At the request of Holger, we just don't create the HTML file if there is no
    differences to report.
---
 debbindiff.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/debbindiff.py b/debbindiff.py
index 03a6708..3d04e4b 100755
--- a/debbindiff.py
+++ b/debbindiff.py
@@ -30,7 +30,7 @@ from debbindiff.presenters.html import output_html
 def create_parser():
     parser = argparse.ArgumentParser(description='Highlight differences between two builds of Debian packages')
     parser.add_argument('--debug', dest='debug', action='store_true', default=False)
-    parser.add_argument('--html', metavar='output', dest='html_output', type=argparse.FileType('w'))
+    parser.add_argument('--html', metavar='output', dest='html_output')
     parser.add_argument('file1', help='first file to compare')
     parser.add_argument('file2', help='second file to compare')
     return parser
@@ -41,9 +41,9 @@ def main():
     if parsed_args.debug:
         logger.setLevel(logging.DEBUG)
     differences = debbindiff.comparators.compare_files(parsed_args.file1, parsed_args.file2)
-    if parsed_args.html_output:
+    if len(differences) > 0 and parsed_args.html_output:
         def print_func(*args, **kwargs):
-            kwargs['file'] = parsed_args.html_output
+            kwargs['file'] = open(parsed_args.html_output, 'w')
             print(*args, **kwargs)
         output_html(differences, print_func=print_func)
     if len(differences) > 0:

-- 
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