[Git][reproducible-builds/diffoscope][master] 3 commits: Correct "recompile" typo.

Chris Lamb (@lamby) gitlab at salsa.debian.org
Mon Jan 24 23:32:01 UTC 2022



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
3ca5d02e by Chris Lamb at 2022-01-24T15:24:17-08:00
Correct "recompile" typo.

- - - - -
a3abe03d by Chris Lamb at 2022-01-24T15:31:46-08:00
Add test for comparing against non-existent .pyc files.

- - - - -
9ebba4b2 by Chris Lamb at 2022-01-24T15:31:46-08:00
Don't fail if comparing a nonexistent file with a .pyc file (and add test). (Closes: Debian:#1004312)

- - - - -


2 changed files:

- diffoscope/comparators/python.py
- tests/comparators/test_python.py


Changes:

=====================================
diffoscope/comparators/python.py
=====================================
@@ -1,7 +1,7 @@
 #
 # diffoscope: in-depth comparison of files, archives, and directories
 #
-# Copyright © 2021 Chris Lamb <lamby at debian.org>
+# Copyright © 2021‒2022 Chris Lamb <lamby at debian.org>
 # Copyright © 2021 Sergei Trofimovich
 #
 # diffoscope is free software: you can redistribute it and/or modify
@@ -28,6 +28,7 @@ import types
 
 from diffoscope.difference import Difference
 
+from .missing_file import MissingFile
 from .utils.file import File
 
 re_memory_address = re.compile(r" at 0x\w+(?=, )")
@@ -38,6 +39,9 @@ class PycFile(File):
     FILE_TYPE_RE = re.compile(r"^python .*byte-compiled$")
 
     def compare_details(self, other, source=None):
+        if isinstance(other, MissingFile):
+            return []
+
         try:
             return [
                 Difference.from_text(
@@ -49,7 +53,7 @@ class PycFile(File):
                 )
             ]
         except ValueError as exc:
-            self.add_comment("Could not decombile bytecode: {}".format(exc))
+            self.add_comment("Could not decompile bytecode: {}".format(exc))
             return []
 
 


=====================================
tests/comparators/test_python.py
=====================================
@@ -1,7 +1,7 @@
 #
 # diffoscope: in-depth comparison of files, archives, and directories
 #
-# Copyright © 2021 Chris Lamb <lamby at debian.org>
+# Copyright © 2021—2022 Chris Lamb <lamby at debian.org>
 #
 # diffoscope is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@ import sys
 from diffoscope.comparators.python import PycFile
 
 from ..utils.data import assert_diff_startswith, load_fixture
+from ..utils.nonexisting import assert_non_existing
 from ..utils.tools import (
     skipif,
     skip_unless_file_version_is_at_least,
@@ -60,3 +61,9 @@ def test_diff(differences):
         differences[0],
         "pyc_expected_diff",
     )
+
+
+def test_compare_non_existing(monkeypatch, pyc1):
+    assert_non_existing(
+        monkeypatch, pyc1, has_details=False, has_null_source=False
+    )



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/b51a31e9c5d62d40327a870cb8dfdbeed9a4b021...9ebba4b2e333d8bffe0932cefb353ed54c0bfd36

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/b51a31e9c5d62d40327a870cb8dfdbeed9a4b021...9ebba4b2e333d8bffe0932cefb353ed54c0bfd36
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/20220124/bfa58403/attachment.htm>


More information about the rb-commits mailing list