Use trueorfalse to normalize the values for USE_PYTHON3
Install 3.5 instead of 3.4 When USE_PYTHON3 is specified.
Also, since not many packages are classified correctly, fallback
to looking for just "Programming Language :: Python :: 3" and
log a message for the package to highlight the problem.
Also special case some services that are *almost* ready
Depends-On: Id48e1b328230fcdf97ed1cb4b97f4c3f9cf6eb8a
Depends-On: Ib7d9aa0e0b74a936002e0eea0b3af05102b06a62
Change-Id: I243ea4b76f0d5ef57a03b5b0798a05468ee6de9b
| ... | ... |
@@ -76,6 +76,27 @@ function get_python_versions_for_package {
|
| 76 | 76 |
| grep 'Language' | cut -f5 -d: | grep '\.' | tr '\n' ' ' |
| 77 | 77 |
} |
| 78 | 78 |
|
| 79 |
+# Check for python3 classifier in local directory |
|
| 80 |
+function check_python3_support_for_package_local {
|
|
| 81 |
+ local name=$1 |
|
| 82 |
+ cd $name |
|
| 83 |
+ set +e |
|
| 84 |
+ classifier=$(python setup.py --classifiers \ |
|
| 85 |
+ | grep 'Programming Language :: Python :: 3$') |
|
| 86 |
+ set -e |
|
| 87 |
+ echo $classifier |
|
| 88 |
+} |
|
| 89 |
+ |
|
| 90 |
+# Check for python3 classifier on pypi |
|
| 91 |
+function check_python3_support_for_package_remote {
|
|
| 92 |
+ local name=$1 |
|
| 93 |
+ set +e |
|
| 94 |
+ classifier=$(curl -s -L "https://pypi.python.org/pypi/$name/json" \ |
|
| 95 |
+ | grep '"Programming Language :: Python :: 3"') |
|
| 96 |
+ set -e |
|
| 97 |
+ echo $classifier |
|
| 98 |
+} |
|
| 99 |
+ |
|
| 79 | 100 |
# Wrapper for ``pip install`` to set cache and proxy environment variables |
| 80 | 101 |
# Uses globals ``OFFLINE``, ``PIP_VIRTUAL_ENV``, |
| 81 | 102 |
# ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``, |
| ... | ... |
@@ -123,9 +144,39 @@ function pip_install {
|
| 123 | 123 |
# default pip |
| 124 | 124 |
local package_dir=${!#}
|
| 125 | 125 |
local python_versions |
| 126 |
- if [[ -d "$package_dir" ]]; then |
|
| 126 |
+ |
|
| 127 |
+ # Special case some services that have experimental |
|
| 128 |
+ # support for python3 in progress, but don't claim support |
|
| 129 |
+ # in their classifier |
|
| 130 |
+ echo "Check python version for : $package_dir" |
|
| 131 |
+ if [[ ${package_dir##*/} == "nova" || ${package_dir##*/} == "glance" || ${package_dir##*/} == "cinder" ]]; then
|
|
| 132 |
+ echo "Using $PYTHON3_VERSION version to install $package_dir" |
|
| 133 |
+ sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" |
|
| 134 |
+ cmd_pip=$(get_pip_command $PYTHON3_VERSION) |
|
| 135 |
+ elif [[ -d "$package_dir" ]]; then |
|
| 127 | 136 |
python_versions=$(get_python_versions_for_package $package_dir) |
| 128 | 137 |
if [[ $python_versions =~ $PYTHON3_VERSION ]]; then |
| 138 |
+ echo "Using $PYTHON3_VERSION version to install $package_dir" |
|
| 139 |
+ sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" |
|
| 140 |
+ cmd_pip=$(get_pip_command $PYTHON3_VERSION) |
|
| 141 |
+ else |
|
| 142 |
+ # The package may not have yet advertised python3.5 |
|
| 143 |
+ # support so check for just python3 classifier and log |
|
| 144 |
+ # a warning. |
|
| 145 |
+ python3_classifier=$(check_python3_support_for_package_local $package_dir) |
|
| 146 |
+ if [[ ! -z "$python3_classifier" ]]; then |
|
| 147 |
+ echo "Using $PYTHON3_VERSION version to install $package_dir" |
|
| 148 |
+ sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" |
|
| 149 |
+ cmd_pip=$(get_pip_command $PYTHON3_VERSION) |
|
| 150 |
+ fi |
|
| 151 |
+ fi |
|
| 152 |
+ else |
|
| 153 |
+ # Check pypi as we don't have the package on disk |
|
| 154 |
+ package=$(echo $package_dir | grep -o '^[.a-zA-Z0-9_-]*') |
|
| 155 |
+ python3_classifier=$(check_python3_support_for_package_remote $package) |
|
| 156 |
+ if [[ ! -z "$python3_classifier" ]]; then |
|
| 157 |
+ echo "Using $PYTHON3_VERSION version to install $package" |
|
| 158 |
+ sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" |
|
| 129 | 159 |
cmd_pip=$(get_pip_command $PYTHON3_VERSION) |
| 130 | 160 |
fi |
| 131 | 161 |
fi |
| ... | ... |
@@ -71,7 +71,15 @@ function install_apache_wsgi {
|
| 71 | 71 |
# Apache installation, because we mark it NOPRIME |
| 72 | 72 |
if is_ubuntu; then |
| 73 | 73 |
# Install apache2, which is NOPRIME'd |
| 74 |
- install_package apache2 libapache2-mod-wsgi |
|
| 74 |
+ install_package apache2 |
|
| 75 |
+ if python3_enabled; then |
|
| 76 |
+ if is_package_installed libapache2-mod-wsgi; then |
|
| 77 |
+ uninstall_package libapache2-mod-wsgi |
|
| 78 |
+ fi |
|
| 79 |
+ install_package libapache2-mod-wsgi-py3 |
|
| 80 |
+ else |
|
| 81 |
+ install_package libapache2-mod-wsgi |
|
| 82 |
+ fi |
|
| 75 | 83 |
elif is_fedora; then |
| 76 | 84 |
sudo rm -f /etc/httpd/conf.d/000-* |
| 77 | 85 |
install_package httpd mod_wsgi |
| ... | ... |
@@ -81,7 +81,11 @@ 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 |
- (cd $HORIZON_DIR; python manage.py compilemessages) |
|
| 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 |
|
| 85 | 89 |
|
| 86 | 90 |
# ``local_settings.py`` is used to override horizon default settings. |
| 87 | 91 |
local local_settings=$HORIZON_DIR/openstack_dashboard/local/local_settings.py |
| ... | ... |
@@ -162,7 +166,11 @@ function install_django_openstack_auth {
|
| 162 | 162 |
git_clone_by_name "django_openstack_auth" |
| 163 | 163 |
# Compile message catalogs before installation |
| 164 | 164 |
_prepare_message_catalog_compilation |
| 165 |
- (cd $dir; python setup.py compile_catalog) |
|
| 165 |
+ if python3_enabled; then |
|
| 166 |
+ (cd $dir; python${PYTHON3_VERSION} setup.py compile_catalog)
|
|
| 167 |
+ else |
|
| 168 |
+ (cd $dir; python setup.py compile_catalog) |
|
| 169 |
+ fi |
|
| 166 | 170 |
setup_dev_lib "django_openstack_auth" |
| 167 | 171 |
fi |
| 168 | 172 |
# if we aren't using this library from git, then we just let it |
| ... | ... |
@@ -101,12 +101,12 @@ if [[ -r $RC_DIR/.localrc.password ]]; then |
| 101 | 101 |
fi |
| 102 | 102 |
|
| 103 | 103 |
# Control whether Python 3 should be used. |
| 104 |
-export USE_PYTHON3=${USE_PYTHON3:-False}
|
|
| 104 |
+export USE_PYTHON3=$(trueorfalse False USE_PYTHON3) |
|
| 105 | 105 |
|
| 106 | 106 |
# When Python 3 is supported by an application, adding the specific |
| 107 | 107 |
# version of Python 3 to this variable will install the app using that |
| 108 | 108 |
# version of the interpreter instead of 2.7. |
| 109 |
-export PYTHON3_VERSION=${PYTHON3_VERSION:-3.4}
|
|
| 109 |
+export PYTHON3_VERSION=${PYTHON3_VERSION:-3.5}
|
|
| 110 | 110 |
|
| 111 | 111 |
# Just to be more explicit on the Python 2 version to use. |
| 112 | 112 |
export PYTHON2_VERSION=${PYTHON2_VERSION:-2.7}
|