[Reproducible-commits] [diffoscope] 13/21: XXX
Joachim Breitner
nomeata at moszumanska.debian.org
Thu Dec 3 15:05:05 UTC 2015
This is an automated email from the git hooks/post-receive script.
nomeata pushed a commit to branch pu/parallel2
in repository diffoscope.
commit 6132da8356b0841b76d38bd17f726a7222fcf823
Author: Jérémy Bobbio <lunar at debian.org>
Date: Thu Nov 19 15:00:59 2015 +0000
XXX
---
diffoscope/comparators/device.py | 6 +++---
diffoscope/comparators/symlink.py | 6 +++---
diffoscope/difference.py | 24 ++++++++++++------------
3 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/diffoscope/comparators/device.py b/diffoscope/comparators/device.py
index 6416f50..4b3e99a 100644
--- a/diffoscope/comparators/device.py
+++ b/diffoscope/comparators/device.py
@@ -58,6 +58,6 @@ class Device(File):
super().cleanup()
def compare(self, other, source=None):
- with open(self.path) as my_content, \
- open(other.path) as other_content:
- return Difference.from_text_readers(my_content, other_content, self.name, other.name, source=source, comment="device")
+ my_content = open(self.path)
+ other_content = open(other.path)
+ return Difference.from_text_readers(my_content, other_content, self.name, other.name, source=source, comment="device")
diff --git a/diffoscope/comparators/symlink.py b/diffoscope/comparators/symlink.py
index f9b4664..a3e4d97 100644
--- a/diffoscope/comparators/symlink.py
+++ b/diffoscope/comparators/symlink.py
@@ -55,6 +55,6 @@ class Symlink(File):
def compare(self, other, source=None):
logger.debug('my_content %s', self.path)
- with open(self.path) as my_content, \
- open(other.path) as other_content:
- return Difference.from_text_readers(my_content, other_content, self.name, other.name, source=source, comment="symlink")
+ my_content = open(self.path)
+ other_content = open(other.path)
+ return Difference.from_text_readers(my_content, other_content, self.name, other.name, source=source, comment="symlink")
diff --git a/diffoscope/difference.py b/diffoscope/difference.py
index e871358..35e835a 100644
--- a/diffoscope/difference.py
+++ b/diffoscope/difference.py
@@ -241,14 +241,16 @@ def make_feeder_from_text_reader(in_file, filter=lambda text_buf: text_buf):
return make_feeder_from_raw_reader(in_file, encoding_filter)
-def make_feeder_from_command(command):
+def make_feeder_from_command(command, suppress_errrors):
def feeder(out_file):
- end_nl = make_feeder_from_raw_reader(command.stdout, command.filter)(out_file)
- if command.poll() is None:
- command.terminate()
- returncode = command.wait()
- if returncode not in (0, -signal.SIGTERM):
- raise subprocess.CalledProcessError(returncode, command.cmdline(), output=command.stderr.getvalue())
+ end_nl = True
+ with suppress(*suppress_errrors):
+ end_nl = make_feeder_from_raw_reader(command.stdout, command.filter)(out_file)
+ if command.poll() is None:
+ command.terminate()
+ returncode = command.wait()
+ if returncode not in (0, -signal.SIGTERM):
+ raise subprocess.CalledProcessError(returncode, command.cmdline(), output=command.stderr.getvalue())
return end_nl
return feeder
@@ -335,19 +337,17 @@ class Difference(object):
feeder1 = empty_file_feeder()
else:
command1 = cls(path1, *command_args)
- feeder1 = make_feeder_from_command(command1)
+ feeder1 = make_feeder_from_command(command1, suppress_errors)
command2 = None
if path2 == '/dev/null':
feeder2 = empty_file_feeder()
else:
command2 = cls(path2, *command_args)
- feeder2 = make_feeder_from_command(command2)
+ feeder2 = make_feeder_from_command(command2, suppress_errors)
if 'source' not in kwargs:
source_cmd = command1 or command2
kwargs['source'] = ' '.join(map(lambda x: '{}' if x == source_cmd.path else x, source_cmd.cmdline()))
- difference = None
- with suppress(*suppress_errors):
- difference = Difference.from_feeder(feeder1, feeder2, path1, path2, *args, **kwargs)
+ difference = Difference.from_feeder(feeder1, feeder2, path1, path2, *args, **kwargs)
if command1 and command1.stderr_content:
difference.add_comment('stderr from `%s`:' % ' '.join(command1.cmdline()))
difference.add_comment(command1.stderr_content)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the Reproducible-commits
mailing list