[diffoscope] 02/03: {config, main}: adds check_parallel on init

Juliana Oliveira jwnx-guest at moszumanska.debian.org
Fri Mar 9 05:11:33 CET 2018


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

jwnx-guest pushed a commit to branch jwnx_parallel_diffoscope
in repository diffoscope.

commit fe90493c2488997a14db873699876a30d6def6ac
Author: Juliana Oliveira <juliana.orod at gmail.com>
Date:   Mon Mar 5 19:19:47 2018 -0300

    {config, main}: adds check_parallel on init
    
    Checks if dill and multiprocess are importable. If they aren't,
    Config().parallel flag will be set to false.
    
    Signed-off-by: Juliana Oliveira <juliana.orod at gmail.com>
---
 diffoscope/config.py | 6 ++++++
 diffoscope/main.py   | 1 +
 2 files changed, 7 insertions(+)

diff --git a/diffoscope/config.py b/diffoscope/config.py
index ff07695..88d6e8c 100644
--- a/diffoscope/config.py
+++ b/diffoscope/config.py
@@ -89,3 +89,9 @@ class Config(object):
         self.check_ge("max_diff_block_lines", "max_page_diff_block_lines")
         self.check_ge("max_report_size", "max_page_size")
         self.check_ge("max_report_size", "max_page_size_child")
+
+    def check_parallel(self):
+        import importlib
+        multiprocess = importlib.util.find_spec("multiprocess")
+        dill = importlib.util.find_spec("dill")
+        self.parallel = (multiprocess and dill)
diff --git a/diffoscope/main.py b/diffoscope/main.py
index 1424119..66acb68 100644
--- a/diffoscope/main.py
+++ b/diffoscope/main.py
@@ -371,6 +371,7 @@ def run_diffoscope(parsed_args):
     Config().exclude_commands = parsed_args.exclude_commands
     Config().exclude_directory_metadata = parsed_args.exclude_directory_metadata
     Config().compute_visual_diffs = PresenterManager().compute_visual_diffs()
+    Config().check_parallel()
     Config().check_constraints()
     tool_prepend_prefix(parsed_args.tool_prefix_binutils, *"ar as ld ld.bfd nm objcopy objdump ranlib readelf strip".split())
     set_path()

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


More information about the diffoscope mailing list