mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
Handle Python version change on upgrade
Whispers: Actually that is to handle Jessie → Strech upgrade, that switches from Py 3.4 to 3.5.
This commit is contained in:
parent
7fa78ed925
commit
87df116166
3 changed files with 18 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
location PATHTOCHANGE/static/ {
|
||||
alias /opt/yunohost/ihatemoney/venv/lib/python3.4/site-packages/ihatemoney/static/;
|
||||
alias /opt/yunohost/ihatemoney/venv/lib/pythonPYTHON_VERSION/site-packages/ihatemoney/static/;
|
||||
}
|
||||
location PATHTOCHANGE {
|
||||
# Force https.
|
||||
|
|
|
@ -42,8 +42,11 @@ init_virtualenv () {
|
|||
configure_nginx () {
|
||||
local domain=$1
|
||||
local path=$2
|
||||
local python_version="$(readlink /usr/bin/python3|sed s/.*python//)"
|
||||
|
||||
|
||||
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||
sed -i "s@PYTHON_VERSION@$python_version@g" ../conf/nginx.conf
|
||||
# Fix double-slash for domain-root install
|
||||
sed -i "s@location //@location /@" ../conf/nginx.conf
|
||||
sudo install -o root -g root -m644 \
|
||||
|
|
|
@ -19,6 +19,8 @@ path=$(ynh_app_setting_get $app path)
|
|||
is_public=$(ynh_app_setting_get "$app" is_public)
|
||||
|
||||
VENV_PY_VERSION=$(echo ${INSTALL_DIR}/venv/bin/python*.*|sed 's/.*python//')
|
||||
SYSTEM_PY_VERSION=$(readlink /usr/bin/python3|sed s/.*python//)
|
||||
|
||||
# Source local utils
|
||||
source _common.sh
|
||||
|
||||
|
@ -67,6 +69,18 @@ fi
|
|||
|
||||
|
||||
|
||||
# MIGRATION: minor Py version has changed ? rebuilt venv
|
||||
|
||||
# Useful for Py 3.4 → 3.5, Jessie → Stretch, ynh 2.x → 3.x
|
||||
if [[ "$VENV_PY_VERSION" != '2.7' ]] && [[ "$VENV_PY_VERSION" != "$SYSTEM_PY_VERSION" ]]
|
||||
then
|
||||
sudo mv ${INSTALL_DIR}/venv ${INSTALL_DIR}/venv-old
|
||||
init_virtualenv
|
||||
|
||||
# the static path changed
|
||||
configure_nginx "$domain" "$path"
|
||||
fi
|
||||
|
||||
#-------------------------------UPGRADE-------------------------
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue