[Reproducible-commits] [debbindiff] 01/06: Use find_executable from distutils.spawn instead of hand-rolled version

Jérémy Bobbio lunar at moszumanska.debian.org
Thu Mar 19 20:56:48 UTC 2015


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

lunar pushed a commit to branch master
in repository debbindiff.

commit c5aa7939d9e06281eb2523bd312f5eb4de0f2547
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Wed Mar 18 16:04:12 2015 +0000

    Use find_executable from distutils.spawn instead of hand-rolled version
---
 debbindiff/comparators/utils.py | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/debbindiff/comparators/utils.py b/debbindiff/comparators/utils.py
index d7a1580..1d735cc 100644
--- a/debbindiff/comparators/utils.py
+++ b/debbindiff/comparators/utils.py
@@ -18,6 +18,8 @@
 # along with debbindiff.  If not, see <http://www.gnu.org/licenses/>.
 
 from contextlib import contextmanager
+# The following would be shutil.which in Python 3.3
+from distutils.spawn import find_executable
 import hashlib
 import re
 import os
@@ -78,14 +80,10 @@ def binary_fallback(original_function):
 def tool_required(filename):
     def wrapper(original_function):
         def tool_check(*args):
-            if 'PATH' not in os.environ:
+            if not find_executable(filename):
+                logger.info("Tool '%s' not found." % filename)
                 return []
-            for path in os.environ['PATH'].split(os.pathsep):
-                f = os.path.join(path, filename)
-                if os.path.isfile(f):
-                    return original_function(*args)
-            logger.info("Tool '%s' not found." % filename)
-            return []
+            return original_function(*args)
         return tool_check
     return wrapper
 

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



More information about the Reproducible-commits mailing list