No point in duplicating our own version when snakeoil provides it.
---
 catalyst/main.py    | 12 +++++++++---
 catalyst/support.py | 13 -------------
 2 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/catalyst/main.py b/catalyst/main.py
index 65e34ef..03c13c0 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -10,6 +10,8 @@ import argparse
 import os
 import sys
 
+from snakeoil import process
+
 __selfpath__ = os.path.abspath(os.path.dirname(__file__))
 
 from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS,
@@ -20,7 +22,7 @@ import catalyst.config
 import catalyst.util
 from catalyst.defaults import confdefaults, option_messages
 from catalyst.hash_utils import HashMap, HASH_DEFINITIONS
-from catalyst.support import CatalystError, find_binary
+from catalyst.support import CatalystError
 from catalyst.version import get_version
 
 
@@ -283,7 +285,9 @@ def main():
 
                # Then check for any programs that the hash func requires.
                for digest in digests:
-                       if find_binary(hash_map.hash_map[digest].cmd) == None:
+                       try:
+                               
process.find_binary(hash_map.hash_map[digest].cmd)
+                       except process.CommandNotFound:
                                # In auto mode, just ignore missing support.
                                if skip_missing:
                                        digests.remove(digest)
@@ -309,7 +313,9 @@ def main():
                        print
                        print "Catalyst aborting...."
                        sys.exit(2)
-               if 
find_binary(hash_map.hash_map[conf_values["hash_function"]].cmd) == None:
+               try:
+                       
process.find_binary(hash_map.hash_map[conf_values["hash_function"]].cmd)
+               except process.CommandNotFound:
                        print
                        print "hash_function="+conf_values["hash_function"]
                        print "\tThe 
"+hash_map.hash_map[conf_values["hash_function"]].cmd + \
diff --git a/catalyst/support.py b/catalyst/support.py
index a26e49c..1207d36 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -64,19 +64,6 @@ def warn(msg):
        print "!!! catalyst: "+msg
 
 
-def find_binary(myc):
-       """look through the environmental path for an executable file named 
whatever myc is"""
-       # this sucks. badly.
-       p=os.getenv("PATH")
-       if p == None:
-               return None
-       for x in p.split(":"):
-               #if it exists, and is executable
-               if os.path.exists("%s/%s" % (x,myc)) and os.stat("%s/%s" % 
(x,myc))[0] & 0x0248:
-                       return "%s/%s" % (x,myc)
-       return None
-
-
 def cmd(mycmd, myexc="", env=None, debug=False, fail_func=None):
        if env is None:
                env = {}
-- 
2.5.2


Reply via email to