1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
--- a/run-escript.in
+++ b/run-escript.in
@@ -57,7 +57,7 @@
cd "$CURDIR"
else
# name does not contain / therefore we are using
- tscriptdir=$(which $0)
+ tscriptdir=$(command -v $0)
if [ $? -ne 0 ]
then
die "Unable to determine script directory!"
@@ -210,7 +210,7 @@
#
WITH_VISIT=$(get_buildvar visit)
if [ "$WITH_VISIT" = "1" ]; then
- VISIT_BIN=$(which visit 2>/dev/null)
+ VISIT_BIN=$(command -v visit 2>/dev/null)
if [ $? -eq 0 ]; then
VISIT_PY_PATH=$($VISIT_BIN -env | grep LIBPATH | cut -d= -f2)
EXTRA_PYTHONPATH=$EXTRA_PYTHONPATH:$VISIT_PY_PATH
@@ -387,7 +387,7 @@
if [ ! -z "$DO_VALGRIND" ]
then
- VALGRIND_BIN=$(which valgrind 2>/dev/null)
+ VALGRIND_BIN=$(command -v valgrind 2>/dev/null)
if [ $? -eq 0 ]; then
LOGDIR=$ESCRIPT_ROOT/valgrind_logs
[ -d $LOGDIR ] || mkdir $LOGDIR
@@ -469,7 +469,7 @@
if [ "$MPI_FLAVOUR" = "OPENMPI" ]
then
- if [ -z `which rsh``which ssh` ]
+ if [ -z `command -v rsh``command -v ssh` ]
then
AGENTOVERRIDE="--gmca plm_rsh_agent /bin/false"
fi
--- a/site_scons/dependencies.py
+++ b/site_scons/dependencies.py
@@ -33,6 +33,15 @@
REQUIRED_BOOST = (1, 46)
+def which(cmd):
+ hits = []
+ paths = os.environ['PATH'].split(os.pathsep)
+ for path in paths:
+ hit = os.path.join(path, cmd)
+ if os.path.isfile(hit):
+ hits.append(hit)
+ return hits
+
def CheckComplexAcos(context):
context.Message('Checking for working complex std::acos()... ')
result = context.TryRun("""
@@ -750,13 +759,10 @@
except OSError:
pass
else:
- which = Popen(['which', 'gmsh'], stdout=PIPE)
- path,_ = which.communicate()
- path = path.decode()
- if which.wait() == 0:
- cmd = ['ldd', path[:-1]]
- if env['IS_OSX']:
- cmd = ['otool','-L', path[:-1]]
+ path = which('gmsh')
+ cmd = ['ldd', path]
+ if env['IS_OSX']:
+ cmd = ['otool','-L', path]
try:
p=Popen(cmd, stdout=PIPE)
gmshlibs,_ = p.communicate()
|