From 51ecf0a869720ae5e8845b95fd2973b2760dcecf Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 5 Jan 2017 16:11:17 -0500 Subject: [PATCH] Introduce a PYTHON env var * $PYTHON will have the path to python runtime to be used * Use $PYTHON to run all the scripts Change-Id: Ib5ab7820fc18cae5e50ea47302b610494197ad47 --- functions-common | 6 +++--- lib/horizon | 12 ++---------- tools/install_prereqs.sh | 3 +++ 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/functions-common b/functions-common index 8d03b88d24..8d32bb4148 100644 --- a/functions-common +++ b/functions-common @@ -87,7 +87,7 @@ function write_clouds_yaml { CA_CERT_ARG="--os-cacert $SSL_BUNDLE_FILE" fi # demo -> devstack - $TOP_DIR/tools/update_clouds_yaml.py \ + $PYTHON $TOP_DIR/tools/update_clouds_yaml.py \ --file $CLOUDS_YAML \ --os-cloud devstack \ --os-region-name $REGION_NAME \ @@ -99,7 +99,7 @@ function write_clouds_yaml { --os-project-name demo # alt_demo -> devstack-alt - $TOP_DIR/tools/update_clouds_yaml.py \ + $PYTHON $TOP_DIR/tools/update_clouds_yaml.py \ --file $CLOUDS_YAML \ --os-cloud devstack-alt \ --os-region-name $REGION_NAME \ @@ -111,7 +111,7 @@ function write_clouds_yaml { --os-project-name alt_demo # admin -> devstack-admin - $TOP_DIR/tools/update_clouds_yaml.py \ + $PYTHON $TOP_DIR/tools/update_clouds_yaml.py \ --file $CLOUDS_YAML \ --os-cloud devstack-admin \ --os-region-name $REGION_NAME \ diff --git a/lib/horizon b/lib/horizon index 4cabbe483c..9c7ec005a2 100644 --- a/lib/horizon +++ b/lib/horizon @@ -81,11 +81,7 @@ function configure_horizon { # Horizon is installed as develop mode, so we can compile here. # Message catalog compilation is handled by Django admin script, # so compiling them after the installation avoids Django installation twice. - if python3_enabled; then - (cd $HORIZON_DIR; python${PYTHON3_VERSION} manage.py compilemessages) - else - (cd $HORIZON_DIR; python manage.py compilemessages) - fi + (cd $HORIZON_DIR; $PYTHON manage.py compilemessages) # ``local_settings.py`` is used to override horizon default settings. local local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py @@ -166,11 +162,7 @@ function install_django_openstack_auth { git_clone_by_name "django_openstack_auth" # Compile message catalogs before installation _prepare_message_catalog_compilation - if python3_enabled; then - (cd $dir; python${PYTHON3_VERSION} setup.py compile_catalog) - else - (cd $dir; python setup.py compile_catalog) - fi + (cd $dir; $PYTHON setup.py compile_catalog) setup_dev_lib "django_openstack_auth" fi # if we aren't using this library from git, then we just let it diff --git a/tools/install_prereqs.sh b/tools/install_prereqs.sh index 8895e1e77c..da59093581 100755 --- a/tools/install_prereqs.sh +++ b/tools/install_prereqs.sh @@ -83,6 +83,9 @@ fi if python3_enabled; then install_python3 + export PYTHON=$(which python${PYTHON3_VERSION} 2>/dev/null || which python3 2>/dev/null) +else + export PYTHON=$(which python 2>/dev/null) fi # Mark end of run