diff options
author | Aditya Mandaleeka <adityamandaleeka@users.noreply.github.com> | 2016-08-31 12:01:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-31 12:01:28 -0700 |
commit | b73fad38425cd52008d830f7207f81873415e1a5 (patch) | |
tree | 7022ae8e362822ca9abc5d1d1524420f8c91f506 /build.sh | |
parent | fd5a96d96fdcc4a1a439b211d15ceca3a110a1eb (diff) | |
download | coreclr-b73fad38425cd52008d830f7207f81873415e1a5.tar.gz coreclr-b73fad38425cd52008d830f7207f81873415e1a5.tar.bz2 coreclr-b73fad38425cd52008d830f7207f81873415e1a5.zip |
Avoid using 'which' for verifying prereqs (#6994)
* Use hash instead of which in build.sh
* Use hash instead of which in init-tools.sh.
* Use hash instead of which in gen-buildsys-clang.sh.
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -1,15 +1,12 @@ #!/usr/bin/env bash # resolve python-version to use -if [ "$PYTHON" == "" ] ; then - if which python >/dev/null 2>&1 - then +if [ "$PYTHON" == "" ]; then + if hash python 2>/dev/null; then PYTHON=python - elif which python2 >/dev/null 2>&1 - then + elif hash python2 2>/dev/null; then PYTHON=python2 - elif which python2.7 >/dev/null 2>&1 - then + elif hash python2.7 2>/dev/null; then PYTHON=python2.7 else echo "Unable to locate build-dependency python2.x!" 1>&2 @@ -19,8 +16,7 @@ fi # validate python-dependency # useful in case of explicitly set option. -if ! which $PYTHON > /dev/null 2>&1 -then +if ! hash $PYTHON 2>/dev/null; then echo "Unable to locate build-dependency python2.x ($PYTHON)!" 1>&2 exit 1 fi @@ -153,9 +149,9 @@ build_coreclr() if [ $__UseNinja == 1 ]; then generator="ninja" buildFile="build.ninja" - if which ninja >/dev/null 2>&1; then + if hash ninja 2>/dev/null; then buildTool="ninja" - elif which ninja-build >/dev/null 2>&1; then + elif hash ninja-build 2>/dev/null; then buildTool="ninja-build" else echo "Unable to locate ninja!" 1>&2 |