[Git][reproducible-builds/diffoscope][master] 5 commits: Improve debugging output when instantantiating our Comparator object types.
Chris Lamb
gitlab at salsa.debian.org
Wed Aug 28 10:04:12 UTC 2019
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
1647da86 by Chris Lamb at 2019-08-28T09:29:46Z
Improve debugging output when instantantiating our Comparator object types.
- - - - -
ffa22f85 by Chris Lamb at 2019-08-28T09:33:42Z
Avoid a lack of space between "... with return code 1." and "Standard output".
Gbp-Dch: ignore
- - - - -
8eb9e391 by Chris Lamb at 2019-08-28T09:54:59Z
Correct a reference to `parser.diff`; `diff` in this context is a Python function in the module.
- - - - -
eb028094 by Chris Lamb at 2019-08-28T09:56:07Z
Ensure that all of our artificially-created subprocess.CalledProcessError instances have `output` instances that are bytes objects, not str.
- - - - -
2f101b8b by Chris Lamb at 2019-08-28T09:59:48Z
Add the containing module name to the (eg.) "Using StaticLibFile for ..." debugging messages.
- - - - -
4 changed files:
- diffoscope/comparators/utils/file.py
- diffoscope/comparators/utils/specialize.py
- diffoscope/diff.py
- diffoscope/feeders.py
Changes:
=====================================
diffoscope/comparators/utils/file.py
=====================================
@@ -234,9 +234,15 @@ class File(object, metaclass=abc.ABCMeta):
if hasattr(self, '_other_file'):
return self._other_file.__class__.CONTAINER_CLASS(self)
return None
+
+ def type_name(klass):
+ return "{}.{}".format(klass.__module__, klass.__name__)
+
if not hasattr(self, '_as_container'):
logger.debug(
- 'instantiating %s for %s', self.__class__.CONTAINER_CLASS, self
+ 'Instantiating a %s for %s',
+ type_name(self.__class__.CONTAINER_CLASS),
+ self.name,
)
try:
self._as_container = self.__class__.CONTAINER_CLASS(self)
@@ -244,8 +250,8 @@ class File(object, metaclass=abc.ABCMeta):
return None
logger.debug(
"Returning a %s for %s",
- self._as_container.__class__.__name__,
- self,
+ type_name(self._as_container.__class__),
+ self.name,
)
return self._as_container
@@ -467,10 +473,10 @@ class File(object, metaclass=abc.ABCMeta):
re.sub(
r'^',
' ',
- val.decode('utf-8'),
+ val.decode('utf-8').strip(),
flags=re.MULTILINE,
),
- ).strip()
+ )
# Truncate output
max_len = 250
=====================================
diffoscope/comparators/utils/specialize.py
=====================================
@@ -37,7 +37,7 @@ def try_recognize(file, cls, recognizes):
return False
# Found a match; perform type magic
- logger.debug("Using %s for %s", cls.__name__, file.name)
+ logger.debug("Using %s.%s for %s", cls.__module__, cls.__name__, file.name)
new_cls = type(cls.__name__, (cls, type(file)), {})
file.__class__ = new_cls
=====================================
diffoscope/diff.py
=====================================
@@ -190,7 +190,9 @@ def run_diff(fifo1, fifo2, end_nl_q1, end_nl_q2):
)
if not parser.success and p.returncode not in (0, 1):
- raise subprocess.CalledProcessError(p.returncode, cmd, output=diff)
+ raise subprocess.CalledProcessError(
+ p.returncode, cmd, output=parser.diff.encode('utf-8')
+ )
if p.returncode == 0:
return None
=====================================
diffoscope/feeders.py
=====================================
@@ -102,7 +102,7 @@ def from_command(command):
'\n[…]' if len(command.stdout) > 1 else '',
)
raise subprocess.CalledProcessError(
- returncode, command.cmdline(), output=output
+ returncode, command.cmdline(), output=output.encode('utf-8')
)
return end_nl
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/31c2df528be7f4fc18b4254e8b458c109654b75d...2f101b8b1b75f55e762370f453faee6524d6a92a
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/31c2df528be7f4fc18b4254e8b458c109654b75d...2f101b8b1b75f55e762370f453faee6524d6a92a
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20190828/cb2ad981/attachment.html>
More information about the rb-commits
mailing list