From efc35dd01dcf4692147d103852dc443f1cf9b06e Mon Sep 17 00:00:00 2001 From: Jocelyn Delalande Date: Mon, 2 Apr 2018 00:54:39 +0200 Subject: [PATCH] =?UTF-8?q?Switch=20from=20Python-MySQL=20=E2=86=92=20PySQ?= =?UTF-8?q?L?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even if Python-MySQL is the default lib for `mysql://` scheme with SQLAlchemy, it got no release since 2014, and does not support Py3. PySQL seems to be the current standard. --- scripts/install | 2 +- scripts/upgrade | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 8537242..aa96d73 100755 --- a/scripts/install +++ b/scripts/install @@ -66,7 +66,7 @@ fetch_and_extract /opt/yunohost/ihatemoney/src/ ihatemoney # Prepare venv init_virtualenv sudo /opt/yunohost/ihatemoney/venv/bin/pip install -r /opt/yunohost/ihatemoney/src/requirements.txt -sudo /opt/yunohost/ihatemoney/venv/bin/pip install gunicorn>=19.3.0 MySQL-python +sudo /opt/yunohost/ihatemoney/venv/bin/pip install 'gunicorn>=19.3.0' PyMySQL # Fix permissions fix_permissions /opt/yunohost/ihatemoney/src diff --git a/scripts/upgrade b/scripts/upgrade index 98b06ac..7f05d74 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,7 +55,7 @@ fix_permissions ${INSTALL_DIR}/src-new/ # Upgrade dependencies sudo ${PIP} install -r ${NEW_REQUIREMENTS} -sudo ${PIP} install gunicorn>=19.3.0 MySQL-python +sudo ${PIP} install 'gunicorn>=19.3.0' 'PyMySQL' # Everything went ok ? Let's keep this code. sudo rm -rf ${INSTALL_DIR}/src @@ -95,5 +95,13 @@ then fi + +# MIGRATION: Switch Python-MySQL -> PyMySQL + +# Python-MySQL is no longer maintained and does not support Py3 +sudo sed -i "s@'mysql://@'mysql+pymysql://@g" ${ihatemoney_conf_path} + + + # Restart backend sudo supervisorctl restart budget