Browse code

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

Davanum Srinivas authored on 2017/01/06 06:11:17
Showing 3 changed files
... ...
@@ -87,7 +87,7 @@ function write_clouds_yaml {
87 87
         CA_CERT_ARG="--os-cacert $SSL_BUNDLE_FILE"
88 88
     fi
89 89
     # demo -> devstack
90
-    $TOP_DIR/tools/update_clouds_yaml.py \
90
+    $PYTHON $TOP_DIR/tools/update_clouds_yaml.py \
91 91
         --file $CLOUDS_YAML \
92 92
         --os-cloud devstack \
93 93
         --os-region-name $REGION_NAME \
... ...
@@ -99,7 +99,7 @@ function write_clouds_yaml {
99 99
         --os-project-name demo
100 100
 
101 101
     # alt_demo -> devstack-alt
102
-    $TOP_DIR/tools/update_clouds_yaml.py \
102
+    $PYTHON $TOP_DIR/tools/update_clouds_yaml.py \
103 103
         --file $CLOUDS_YAML \
104 104
         --os-cloud devstack-alt \
105 105
         --os-region-name $REGION_NAME \
... ...
@@ -111,7 +111,7 @@ function write_clouds_yaml {
111 111
         --os-project-name alt_demo
112 112
 
113 113
     # admin -> devstack-admin
114
-    $TOP_DIR/tools/update_clouds_yaml.py \
114
+    $PYTHON $TOP_DIR/tools/update_clouds_yaml.py \
115 115
         --file $CLOUDS_YAML \
116 116
         --os-cloud devstack-admin \
117 117
         --os-region-name $REGION_NAME \
... ...
@@ -81,11 +81,7 @@ function configure_horizon {
81 81
     # Horizon is installed as develop mode, so we can compile here.
82 82
     # Message catalog compilation is handled by Django admin script,
83 83
     # so compiling them after the installation avoids Django installation twice.
84
-    if python3_enabled; then
85
-        (cd $HORIZON_DIR; python${PYTHON3_VERSION} manage.py compilemessages)
86
-    else
87
-        (cd $HORIZON_DIR; python manage.py compilemessages)
88
-    fi
84
+    (cd $HORIZON_DIR; $PYTHON manage.py compilemessages)
89 85
 
90 86
     # ``local_settings.py`` is used to override horizon default settings.
91 87
     local local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py
... ...
@@ -166,11 +162,7 @@ function install_django_openstack_auth {
166 166
         git_clone_by_name "django_openstack_auth"
167 167
         # Compile message catalogs before installation
168 168
         _prepare_message_catalog_compilation
169
-        if python3_enabled; then
170
-            (cd $dir; python${PYTHON3_VERSION} setup.py compile_catalog)
171
-        else
172
-            (cd $dir; python setup.py compile_catalog)
173
-        fi
169
+        (cd $dir; $PYTHON setup.py compile_catalog)
174 170
         setup_dev_lib "django_openstack_auth"
175 171
     fi
176 172
     # if we aren't using this library from git, then we just let it
... ...
@@ -83,6 +83,9 @@ fi
83 83
 
84 84
 if python3_enabled; then
85 85
     install_python3
86
+    export PYTHON=$(which python${PYTHON3_VERSION} 2>/dev/null || which python3 2>/dev/null)
87
+else
88
+    export PYTHON=$(which python 2>/dev/null)
86 89
 fi
87 90
 
88 91
 # Mark end of run