[diffoscope] 01/01: comparators/ppu: unbreak ppu_version detection

Mattia Rizzolo mattia at debian.org
Tue Aug 30 15:02:19 CEST 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository diffoscope.

commit 8c9156c338ba34bf81647505444e242c1e1dc1d0
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Tue Aug 30 12:56:57 2016 +0000

    comparators/ppu: unbreak ppu_version detection
---
 diffoscope/comparators/ppu.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/diffoscope/comparators/ppu.py b/diffoscope/comparators/ppu.py
index 2af4bc0..7b24311 100644
--- a/diffoscope/comparators/ppu.py
+++ b/diffoscope/comparators/ppu.py
@@ -69,12 +69,16 @@ class PpuFile(File):
                     subprocess.check_output(['ppudump', file.path], shell=False, stderr=subprocess.STDOUT)
                     PpuFile.ppu_version = ppu_version
                 except subprocess.CalledProcessError as e:
-                    error = e.output.decode('utf-8')
+                    error = e.output.decode('utf-8', errors='ignore')
                     m = re.search('Expecting PPU version ([0-9]+)', error)
-                    if not m:
-                        PpuFile.ppu_version = None
-                        logger.debug('Unable to read PPU version')
-                    PpuFile.ppu_version = m.group(1)
+                    try:
+                        PpuFile.ppu_version = m.group(1)
+                    except AttributeError:
+                        if m is None:
+                            PpuFile.ppu_version = None
+                            logger.debug('Unable to read PPU version')
+                        else:
+                            raise
                 except OSError:
                     PpuFile.ppu_version = None
                     logger.debug('Unable to read PPU version')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list