[Git][reproducible-builds/diffoscope][master] 2 commits: Update code to reflect version 19.10b0 of the black source code reformatter.

Chris Lamb gitlab at salsa.debian.org
Mon Nov 18 22:27:11 UTC 2019



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
75ea5c39 by Chris Lamb at 2019-11-18T22:26:06Z
Update code to reflect version 19.10b0 of the black source code reformatter.

- - - - -
aefa5a39 by Chris Lamb at 2019-11-18T22:26:54Z
Don't run our meta/self black source code reformatter test for versions earlier than 19.10b0 as it will generate different results.

- - - - -


5 changed files:

- diffoscope/comparators/cbfs.py
- diffoscope/comparators/git.py
- diffoscope/diff.py
- tests/comparators/test_debian.py
- tests/test_source.py


Changes:

=====================================
diffoscope/comparators/cbfs.py
=====================================
@@ -103,9 +103,16 @@ CBFS_MAXIMUM_FILE_SIZE = 24 * 2 ** 20  # 24 MiB
 
 
 def is_header_valid(buf, size, offset=0):
-    magic, version, romsize, bootblocksize, align, cbfs_offset, architecture, pad = struct.unpack_from(
-        '!IIIIIIII', buf, offset
-    )
+    (
+        magic,
+        version,
+        romsize,
+        bootblocksize,
+        align,
+        cbfs_offset,
+        architecture,
+        pad,
+    ) = struct.unpack_from('!IIIIIIII', buf, offset)
     return (
         magic == CBFS_HEADER_MAGIC
         and (


=====================================
diffoscope/comparators/git.py
=====================================
@@ -56,13 +56,20 @@ def parse_entries(f):
 
         pos = f.tell()
 
-        x['ctime'], x['ctime_nano'], x['mtime'], x['mtime_nano'], x['dev'], x[
-            'inode'
-        ], x['mode'], x['uid'], x['gid'], x['size'], x['sha'], x[
-            'flags'
-        ] = struct.unpack(
-            '>LLLLLLLLLL20sH', f.read((4 * 10) + 20 + 2)
-        )
+        (
+            x['ctime'],
+            x['ctime_nano'],
+            x['mtime'],
+            x['mtime_nano'],
+            x['dev'],
+            x['inode'],
+            x['mode'],
+            x['uid'],
+            x['gid'],
+            x['size'],
+            x['sha'],
+            x['flags'],
+        ) = struct.unpack('>LLLLLLLLLL20sH', f.read((4 * 10) + 20 + 2))
 
         x['path'] = f.read(x['flags'] & 0x0FFF)
 


=====================================
diffoscope/diff.py
=====================================
@@ -624,9 +624,12 @@ class SideBySideDiff:
             if m:
                 yield from self.empty_buffer()
                 hunk_data = map(lambda x: x == "" and 1 or int(x), m.groups())
-                self.hunk_off1, self.hunk_size1, self.hunk_off2, self.hunk_size2 = (
-                    hunk_data
-                )
+                (
+                    self.hunk_off1,
+                    self.hunk_size1,
+                    self.hunk_off2,
+                    self.hunk_size2,
+                ) = hunk_data
                 self.line1, self.line2 = self.hunk_off1, self.hunk_off2
                 yield "H", (
                     self.hunk_off1,


=====================================
tests/comparators/test_debian.py
=====================================
@@ -162,7 +162,7 @@ def test_dot_changes_no_differences_exclude_buildinfo(
 
 @skip_unless_module_exists('debian.deb822')
 def test_dot_changes_identical_contents_and_different_files(
-    dot_changes_differences_identical_contents_and_different_files
+    dot_changes_differences_identical_contents_and_different_files,
 ):
     assert dot_changes_differences_identical_contents_and_different_files[0]
     expected_diff = get_data(
@@ -178,7 +178,7 @@ def test_dot_changes_identical_contents_and_different_files(
 
 @skip_unless_module_exists('debian.deb822')
 def test_dot_changes_different_contents_and_identical_files(
-    dot_changes_differences_different_contents_and_identical_files
+    dot_changes_differences_different_contents_and_identical_files,
 ):
     assert dot_changes_differences_different_contents_and_identical_files[0]
     assert dot_changes_differences_different_contents_and_identical_files[1]


=====================================
tests/test_source.py
=====================================
@@ -22,7 +22,7 @@ import glob
 import diffoscope
 import subprocess
 
-from .utils.tools import skip_unless_tools_exist
+from .utils.tools import skip_unless_tool_is_at_least
 
 ALLOWED_TEST_FILES = {
     # Data files we would prefer to generate dynamically
@@ -238,7 +238,15 @@ ALLOWED_TEST_FILES = {
 }
 
 
- at skip_unless_tools_exist('black')
+def black_version():
+    try:
+        out = subprocess.check_output(('black', '--version'))
+    except subprocess.CalledProcessError as e:
+        out = e.output
+    return out.decode('utf-8').rsplit(' ', 1)[-1]
+
+
+ at skip_unless_tool_is_at_least('black', black_version, '19.10b0')
 def test_code_is_black_clean():
     output = subprocess.check_output(
         ('black', '--diff', '.'), stderr=subprocess.PIPE



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/7d6daf7c59e6a2b94da45510307f8fe4f2d172cf...aefa5a39bb5f86f21cb67f94a013aa2c9bc4b69d

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/7d6daf7c59e6a2b94da45510307f8fe4f2d172cf...aefa5a39bb5f86f21cb67f94a013aa2c9bc4b69d
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/20191118/f13e5154/attachment.htm>


More information about the rb-commits mailing list