[Git][reproducible-builds/diffoscope][master] Fix "... not available in path" messages when looking for Java decompilers; we...

Chris Lamb gitlab at salsa.debian.org
Mon Jul 13 11:37:59 UTC 2020



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
eb79175f by Chris Lamb at 2020-07-13T12:36:01+01:00
Fix "... not available in path" messages when looking for Java decompilers; we were using the Python class name (eg. "<class 'diffoscope.comparators.java.Javap'>") over the actual command we looked for (eg. "javap").

- - - - -


1 changed file:

- diffoscope/comparators/java.py


Changes:

=====================================
diffoscope/comparators/java.py
=====================================
@@ -34,13 +34,15 @@ logger = logging.getLogger(__name__)
 
 
 class ProcyonDecompiler(Command):
+    TOOL = "procyon"
+
     def __init__(self, path, *args, **kwargs):
         super().__init__(path, *args, **kwargs)
         self.real_path = os.path.realpath(path)
 
-    @tool_required("procyon")
+    @tool_required(TOOL)
     def cmdline(self):
-        return ["procyon", "-ec", self.path]
+        return [self.TOOL, "-ec", self.path]
 
     def filter(self, line):
         if re.match(r"^(//)", line.decode("utf-8")):
@@ -49,14 +51,16 @@ class ProcyonDecompiler(Command):
 
 
 class Javap(Command):
+    TOOL = "javap"
+
     def __init__(self, path, *args, **kwargs):
         super().__init__(path, *args, **kwargs)
         self.real_path = os.path.realpath(path)
 
-    @tool_required("javap")
+    @tool_required(TOOL)
     def cmdline(self):
         return [
-            "javap",
+            self.TOOL,
             "-verbose",
             "-constants",
             "-s",
@@ -93,10 +97,10 @@ class ClassFile(File):
                     break
             except RequiredToolNotFound:
                 logger.debug(
-                    "Unable to find %s. Falling back...", decompiler.__name__
+                    "Unable to find %s. Falling back...", decompiler.TOOL,
                 )
 
         if not diff:
-            raise RequiredToolNotFound(self.decompilers[-1])
+            raise RequiredToolNotFound(self.decompilers[-1].TOOL)
 
         return diff



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/eb79175fbf39a24fd9acd0366ee7a1b0209e8472

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/eb79175fbf39a24fd9acd0366ee7a1b0209e8472
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/20200713/b5c1a329/attachment.htm>


More information about the rb-commits mailing list