aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/distrib
diff options
context:
space:
mode:
authorGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-03-18 09:34:09 -0700
committerGravatar Jan Tattermusch <jtattermusch@users.noreply.github.com>2016-03-18 09:34:09 -0700
commit47277bc12775fdf96648668cabcab4321a004c38 (patch)
tree4b3776d60335654805817cc1cd7c28284a1ca142 /tools/distrib
parent3924afbf9c354888e2d13a9399299ef49e923894 (diff)
parent6ada8a4ba56b0ffa1ee7302115f4fbd01b8d39d4 (diff)
Merge pull request #5574 from nicolasnoble/python2
Adding a python_wrapper.sh script to call in an appropriate python2 interpreter
Diffstat (limited to 'tools/distrib')
-rwxr-xr-xtools/distrib/python_wrapper.sh47
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