Browse code

optional pymysql support

This allows you to specify MYSQL_DRIVER=PyMySQL and get it in the
environment.

Change-Id: Ic9d75266640b7aa6d7efb6e882d3027e81414059

Sean Dague authored on 2015/05/20 22:37:11
Showing 2 changed files
... ...
@@ -1,7 +1,6 @@
1 1
 # Once we can prebuild wheels before a devstack run, uncomment the skipped libraries
2 2
 cryptography
3 3
 # lxml # still install from from packages
4
-MySQL-python
5 4
 # netifaces # still install from packages
6 5
 #numpy    # slowest wheel by far, stop building until we are actually using the output
7 6
 posix-ipc
... ...
@@ -11,6 +11,13 @@
11 11
 MY_XTRACE=$(set +o | grep xtrace)
12 12
 set +o xtrace
13 13
 
14
+MYSQL_DRIVER=${MYSQL_DRIVER:-MySQL-python}
15
+# Force over to pymysql driver by default if we are using it.
16
+if is_service_enabled mysql; then
17
+    if [[ "$MYSQL_DRIVER" == "PyMySQL" ]]; then
18
+        SQLALCHEMY_DATABASE_DRIVER=${SQLALCHEMY_DATABASE_DRIVER:-"pymysql"}
19
+    fi
20
+fi
14 21
 
15 22
 register_database mysql
16 23
 
... ...
@@ -155,8 +162,10 @@ EOF
155 155
 
156 156
 function install_database_python_mysql {
157 157
     # Install Python client module
158
-    pip_install_gr MySQL-python
159
-    ADDITIONAL_VENV_PACKAGES+=",MySQL-python"
158
+    pip_install_gr $MYSQL_DRIVER
159
+    if [[ "$MYSQL_DRIVER" == "MySQL-python" ]]; then
160
+        ADDITIONAL_VENV_PACKAGES+=",MySQL-python"
161
+    fi
160 162
 }
161 163
 
162 164
 function database_connection_url_mysql {