1 |
No point in duplicating our own version when snakeoil provides it. |
2 |
--- |
3 |
catalyst/main.py | 12 +++++++++--- |
4 |
catalyst/support.py | 13 ------------- |
5 |
2 files changed, 9 insertions(+), 16 deletions(-) |
6 |
|
7 |
diff --git a/catalyst/main.py b/catalyst/main.py |
8 |
index 65e34ef..03c13c0 100644 |
9 |
--- a/catalyst/main.py |
10 |
+++ b/catalyst/main.py |
11 |
@@ -10,6 +10,8 @@ import argparse |
12 |
import os |
13 |
import sys |
14 |
|
15 |
+from snakeoil import process |
16 |
+ |
17 |
__selfpath__ = os.path.abspath(os.path.dirname(__file__)) |
18 |
|
19 |
from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS, |
20 |
@@ -20,7 +22,7 @@ import catalyst.config |
21 |
import catalyst.util |
22 |
from catalyst.defaults import confdefaults, option_messages |
23 |
from catalyst.hash_utils import HashMap, HASH_DEFINITIONS |
24 |
-from catalyst.support import CatalystError, find_binary |
25 |
+from catalyst.support import CatalystError |
26 |
from catalyst.version import get_version |
27 |
|
28 |
|
29 |
@@ -283,7 +285,9 @@ def main(): |
30 |
|
31 |
# Then check for any programs that the hash func requires. |
32 |
for digest in digests: |
33 |
- if find_binary(hash_map.hash_map[digest].cmd) == None: |
34 |
+ try: |
35 |
+ process.find_binary(hash_map.hash_map[digest].cmd) |
36 |
+ except process.CommandNotFound: |
37 |
# In auto mode, just ignore missing support. |
38 |
if skip_missing: |
39 |
digests.remove(digest) |
40 |
@@ -309,7 +313,9 @@ def main(): |
41 |
print |
42 |
print "Catalyst aborting...." |
43 |
sys.exit(2) |
44 |
- if find_binary(hash_map.hash_map[conf_values["hash_function"]].cmd) == None: |
45 |
+ try: |
46 |
+ process.find_binary(hash_map.hash_map[conf_values["hash_function"]].cmd) |
47 |
+ except process.CommandNotFound: |
48 |
print |
49 |
print "hash_function="+conf_values["hash_function"] |
50 |
print "\tThe "+hash_map.hash_map[conf_values["hash_function"]].cmd + \ |
51 |
diff --git a/catalyst/support.py b/catalyst/support.py |
52 |
index a26e49c..1207d36 100644 |
53 |
--- a/catalyst/support.py |
54 |
+++ b/catalyst/support.py |
55 |
@@ -64,19 +64,6 @@ def warn(msg): |
56 |
print "!!! catalyst: "+msg |
57 |
|
58 |
|
59 |
-def find_binary(myc): |
60 |
- """look through the environmental path for an executable file named whatever myc is""" |
61 |
- # this sucks. badly. |
62 |
- p=os.getenv("PATH") |
63 |
- if p == None: |
64 |
- return None |
65 |
- for x in p.split(":"): |
66 |
- #if it exists, and is executable |
67 |
- if os.path.exists("%s/%s" % (x,myc)) and os.stat("%s/%s" % (x,myc))[0] & 0x0248: |
68 |
- return "%s/%s" % (x,myc) |
69 |
- return None |
70 |
- |
71 |
- |
72 |
def cmd(mycmd, myexc="", env=None, debug=False, fail_func=None): |
73 |
if env is None: |
74 |
env = {} |
75 |
-- |
76 |
2.5.2 |