diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2016-03-03 23:25:22 +0100 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2016-03-05 02:57:15 +0100 |
commit | 2d86263de3a4f53013c0425a54636d14ff9114fd (patch) | |
tree | 2faed3d0305ab0beb00ca216808504c3a6d17182 /tools/distrib/python_wrapper.sh | |
parent | 7db77f84422fec9f1361c100397cfef17f84ca8c (diff) |
Added python_wrapper.sh to take care of finding an appropriate version of python from the system.
Diffstat (limited to 'tools/distrib/python_wrapper.sh')
-rwxr-xr-x | tools/distrib/python_wrapper.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/tools/distrib/python_wrapper.sh b/tools/distrib/python_wrapper.sh new file mode 100755 index 0000000000..347a715c85 --- /dev/null +++ b/tools/distrib/python_wrapper.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +for p in python2.7 python2.6 python2 python not_found ; do + + python=`which $p || echo not_found` + + if [ -x "$python" ] ; then + break + fi + +done + +if [ -x "$python" ] ; then + exec $python $@ +else + echo "No acceptable version of python found on the system" + exit 1 +fi |