Skip to content
GitLab
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
Reproducible Builds
diffoscope
Compare revisions
e3790cc8190c9a76db59adea0f4d67f22a814079...45b44dc86a204b5bc045b9939e77916b2467016f
Commits (3)
Bump minimum version of Black to 20.8b1. (Re: #972518)
· 2fbd283f
Chris Lamb
authored
Oct 20, 2020
2fbd283f
Update tests to support 4.11.1. (Closes: #972518)
· 0be16053
Chris Lamb
authored
Oct 20, 2020
0be16053
Move test_ocaml to the assert_diff helper.
· 45b44dc8
Chris Lamb
authored
Oct 20, 2020
45b44dc8
Hide whitespace changes
Inline
Side-by-side
diffoscope/comparators/deb.py
View file @
45b44dc8
...
...
@@ -137,8 +137,10 @@ class DebFile(File):
return
None
if
not
hasattr
(
self
,
"_control"
):
control_file
=
self
.
as_container
.
control_tar
.
as_container
.
lookup_file
(
"./control"
control_file
=
(
self
.
as_container
.
control_tar
.
as_container
.
lookup_file
(
"./control"
)
)
if
control_file
:
with
open
(
control_file
.
path
,
"rb"
)
as
f
:
...
...
diffoscope/comparators/elf.py
View file @
45b44dc8
...
...
@@ -554,8 +554,10 @@ class ElfContainer(DecompilableContainer):
debug_file_path
=
"./usr/lib/debug/.build-id/{0}/{1}.debug"
.
format
(
build_id
[:
2
],
build_id
[
2
:]
)
debug_file
=
dbgsym_package
.
as_container
.
data_tar
.
as_container
.
lookup_file
(
debug_file_path
debug_file
=
(
dbgsym_package
.
as_container
.
data_tar
.
as_container
.
lookup_file
(
debug_file_path
)
)
if
not
debug_file
:
logger
.
debug
(
...
...
diffoscope/comparators/java.py
View file @
45b44dc8
...
...
@@ -96,7 +96,8 @@ class ClassFile(File):
# Save our exception
last_exc
=
exc
logger
.
debug
(
"Unable to find %s. Falling back..."
,
decompiler
,
"Unable to find %s. Falling back..."
,
decompiler
,
)
# Re-raise the last exception we would have raised from the previous
...
...
diffoscope/comparators/lz4.py
View file @
45b44dc8
...
...
@@ -47,7 +47,9 @@ class Lz4Container(Archive):
logger
.
debug
(
"lz4 extracting to %s"
,
dest_path
)
with
open
(
dest_path
,
"wb"
)
as
fp
:
subprocess
.
check_call
(
[
"lz4"
,
"-d"
,
"-c"
,
self
.
source
.
path
],
stdout
=
fp
,
stderr
=
None
,
[
"lz4"
,
"-d"
,
"-c"
,
self
.
source
.
path
],
stdout
=
fp
,
stderr
=
None
,
)
return
dest_path
...
...
diffoscope/comparators/utils/file.py
View file @
45b44dc8
...
...
@@ -267,13 +267,17 @@ class File(metaclass=abc.ABCMeta):
)
logger
.
debug
(
"Instantiating a %s for %s"
,
formatted_class
,
self
.
name
,
"Instantiating a %s for %s"
,
formatted_class
,
self
.
name
,
)
try
:
self
.
_as_container
=
klass
(
self
)
logger
.
debug
(
"Returning a %s for %s"
,
formatted_class
,
self
.
name
,
"Returning a %s for %s"
,
formatted_class
,
self
.
name
,
)
return
self
.
_as_container
except
RequiredToolNotFound
as
exc
:
...
...
@@ -286,8 +290,10 @@ class File(metaclass=abc.ABCMeta):
infix
=
type
(
self
).
DESCRIPTION
except
AttributeError
:
infix
=
"this file format"
msg
=
"Format-specific differences are supported for {}."
.
format
(
infix
msg
=
(
"Format-specific differences are supported for {}."
.
format
(
infix
)
)
self
.
_comments
.
append
(
exc
.
get_comment
(
msg
))
...
...
@@ -460,7 +466,8 @@ class File(metaclass=abc.ABCMeta):
def
cmp_external
(
self
,
other
):
return
(
subprocess
.
call
(
(
"cmp"
,
"-s"
,
self
.
path
,
other
.
path
),
close_fds
=
True
,
(
"cmp"
,
"-s"
,
self
.
path
,
other
.
path
),
close_fds
=
True
,
)
==
0
)
...
...
diffoscope/comparators/zst.py
View file @
45b44dc8
...
...
@@ -47,7 +47,9 @@ class ZstContainer(Archive):
logger
.
debug
(
"zstd extracting to %s"
,
dest_path
)
with
open
(
dest_path
,
"wb"
)
as
fp
:
subprocess
.
check_call
(
[
"zstd"
,
"-d"
,
"-c"
,
self
.
source
.
path
],
stdout
=
fp
,
stderr
=
None
,
[
"zstd"
,
"-d"
,
"-c"
,
self
.
source
.
path
],
stdout
=
fp
,
stderr
=
None
,
)
return
dest_path
...
...
setup.py
View file @
45b44dc8
...
...
@@ -47,8 +47,13 @@ setup(
packages
=
find_packages
(
exclude
=
[
"tests"
,
"tests.*"
]),
tests_require
=
[
"pytest"
],
cmdclass
=
{
"test"
:
PyTest
},
entry_points
=
{
"console_scripts"
:
[
"diffoscope=diffoscope.main:main"
],},
install_requires
=
[
"python-magic"
,
"libarchive-c"
,],
entry_points
=
{
"console_scripts"
:
[
"diffoscope=diffoscope.main:main"
],
},
install_requires
=
[
"python-magic"
,
"libarchive-c"
,
],
extras_require
=
{
"distro_detection"
:
[
"distro"
],
"cmdline"
:
[
"argcomplete"
,
"progressbar"
],
...
...
tests/comparators/test_ocaml.py
View file @
45b44dc8
...
...
@@ -24,7 +24,7 @@ from diffoscope.comparators.ocaml import OcamlInterfaceFile
from
diffoscope.comparators.binary
import
FilesystemFile
from
diffoscope.comparators.utils.specialize
import
specialize
from
..utils.data
import
get_data
from
..utils.data
import
assert_diff
from
..utils.tools
import
skip_unless_tool_is_at_least
from
..utils.nonexisting
import
assert_non_existing
...
...
@@ -57,7 +57,7 @@ def ocaml_version():
return
out
.
decode
(
"utf-8"
).
split
()[
-
1
]
@skip_unless_tool_is_at_least
(
"ocamlobjinfo"
,
ocaml_version
,
"4.
08
.1"
)
@skip_unless_tool_is_at_least
(
"ocamlobjinfo"
,
ocaml_version
,
"4.
11
.1"
)
def
test_identification
(
cmi1
):
assert
isinstance
(
cmi1
,
OcamlInterfaceFile
)
...
...
@@ -67,18 +67,17 @@ def differences(cmi1, cmi2):
return
cmi1
.
compare
(
cmi2
).
details
@skip_unless_tool_is_at_least
(
"ocamlobjinfo"
,
ocaml_version
,
"4.
08
.1"
)
@skip_unless_tool_is_at_least
(
"ocamlobjinfo"
,
ocaml_version
,
"4.
11
.1"
)
def
test_no_differences
(
cmi1
):
difference
=
cmi1
.
compare
(
cmi1
)
assert
difference
is
None
@skip_unless_tool_is_at_least
(
"ocamlobjinfo"
,
ocaml_version
,
"4.
08
.1"
)
@skip_unless_tool_is_at_least
(
"ocamlobjinfo"
,
ocaml_version
,
"4.
11
.1"
)
def
test_diff
(
differences
):
expected_diff
=
get_data
(
"ocaml_expected_diff"
)
assert
differences
[
0
].
unified_diff
==
expected_diff
assert_diff
(
differences
[
0
],
"ocaml_expected_diff"
)
@skip_unless_tool_is_at_least
(
"ocamlobjinfo"
,
ocaml_version
,
"4.
08
.1"
)
@skip_unless_tool_is_at_least
(
"ocamlobjinfo"
,
ocaml_version
,
"4.
11
.1"
)
def
test_compare_non_existing
(
monkeypatch
,
cmi1
):
assert_non_existing
(
monkeypatch
,
cmi1
,
has_null_source
=
False
)
tests/data/ocaml_expected_diff
View file @
45b44dc8
...
...
@@ -2,7 +2,7 @@
-Unit name: Test1
+Unit name: Test2
Interfaces imported:
-
4bf3070814d7fb8e8d365d95481f8cad
Test1
+
333f54d1aae1264e7ad64cbb437cbc4f
Test2
ad45f251bbf98d3a0bf3b883546ecfc8
Stdlib
a2b1a9d869fd05813beb35645bd9cd94
CamlinternalFormatBasics
-
3e47d8b00458748ef1a9311764531b2c
Test1
+
de7049745527b20997c517c338bb83cb
Test2
c21c5d26416461b543321872a551ea0d
Stdlib
3a3ca1838627f7762f49679ce0278ad1
CamlinternalFormatBasics
tests/test_source.py
View file @
45b44dc8
...
...
@@ -242,7 +242,7 @@ def black_version():
return
out
.
decode
(
"utf-8"
).
rsplit
(
" "
,
1
)[
-
1
]
@skip_unless_tool_is_at_least
(
"black"
,
black_version
,
"
19.10b0
"
)
@skip_unless_tool_is_at_least
(
"black"
,
black_version
,
"
20.8b1
"
)
def
test_code_is_black_clean
():
output
=
subprocess
.
check_output
(
(
"black"
,
"--diff"
,
"."
),
stderr
=
subprocess
.
PIPE
...
...