AMBARI-12912. Python Wrapper Can Choose Two Different Python Versions (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/bb877b81 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/bb877b81 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/bb877b81 Branch: refs/heads/branch-2.1 Commit: bb877b81ad7eea4921274eb66c6b973d34dd649a Parents: 2d9612e Author: Andrew Onishuk <aonis...@hortonworks.com> Authored: Fri Aug 28 12:28:24 2015 +0300 Committer: Andrew Onishuk <aonis...@hortonworks.com> Committed: Fri Aug 28 12:28:24 2015 +0300 ---------------------------------------------------------------------- ambari-common/src/main/unix/ambari-python-wrap | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/bb877b81/ambari-common/src/main/unix/ambari-python-wrap ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/unix/ambari-python-wrap b/ambari-common/src/main/unix/ambari-python-wrap index b9cf3b6..efc073b 100755 --- a/ambari-common/src/main/unix/ambari-python-wrap +++ b/ambari-common/src/main/unix/ambari-python-wrap @@ -22,16 +22,20 @@ export PYTHONPATH=/usr/lib/python2.6/site-packages:/usr/lib/python2.6/site-packa # reset settings unset PYTHON -# checking for preferable python versions -if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then - PYTHON=/usr/bin/python2.7 +# checking for default Python 2 +if [ -a /usr/bin/python2 ] && [ -z "$PYTHON" ]; then + PYTHON=/usr/bin/python2 fi if [ -a /usr/bin/python2.6 ] && [ -z "$PYTHON" ]; then PYTHON=/usr/bin/python2.6 fi -# if no preferable python versions found, try to use system one +if [ -a /usr/bin/python2.7 ] && [ -z "$PYTHON" ]; then + PYTHON=/usr/bin/python2.7 +fi + +# if no preferable python versions found, try to use system one. Hoping it's Python 2 if [[ -z "$PYTHON" ]]; then PYTHON=/usr/bin/python fi