1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

use variable for python path for buster

weblate uses Django, which requires to edit a configuration file in the filepath
replace the string value by a varible
This commit is contained in:
Jean-Baptiste Holcroft 2020-05-01 22:09:37 +02:00
parent 4214a1391c
commit 15c2d22385
14 changed files with 35 additions and 21 deletions

View file

@ -56,7 +56,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data')
TTF_PATH = '__FINALPATH__/venv/lib/python3.5/site-packages/weblate/ttf/'
TTF_PATH = '__FINALPATH__/venv/lib/__PYTHONPATH__/site-packages/weblate/ttf/'
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -56,7 +56,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data')
TTF_PATH = '__FINALPATH__/venv/lib/python3.5/site-packages/weblate/ttf/'
TTF_PATH = '__FINALPATH__/venv/lib/__PYTHONPATH__/site-packages/weblate/ttf/'
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -56,7 +56,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data')
TTF_PATH = '__FINALPATH__/venv/lib/python3.5/site-packages/weblate/ttf/'
TTF_PATH = '__FINALPATH__/venv/lib/__PYTHONPATH__/site-packages/weblate/ttf/'
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -59,7 +59,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data')
TTF_PATH = '__FINALPATH__/venv/lib/python3.5/site-packages/weblate/ttf/'
TTF_PATH = '__FINALPATH__/venv/lib/__PYTHONPATH__/site-packages/weblate/ttf/'
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -59,7 +59,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data')
TTF_PATH = '__FINALPATH__/venv/lib/python3.5/site-packages/weblate/ttf/'
TTF_PATH = '__FINALPATH__/venv/lib/__PYTHONPATH__/site-packages/weblate/ttf/'
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -66,7 +66,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data')
TTF_PATH = '__FINALPATH__/venv/lib/python3.5/site-packages/weblate/ttf/'
TTF_PATH = '__FINALPATH__/venv/lib/__PYTHONPATH__/site-packages/weblate/ttf/'
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -67,7 +67,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data')
TTF_PATH = '__FINALPATH__/venv/lib/python3.5/site-packages/weblate/ttf/'
TTF_PATH = '__FINALPATH__/venv/lib/__PYTHONPATH__/site-packages/weblate/ttf/'
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -68,7 +68,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data')
TTF_PATH = '__FINALPATH__/venv/lib/python3.5/site-packages/weblate/ttf/'
TTF_PATH = '__FINALPATH__/venv/lib/__PYTHONPATH__/site-packages/weblate/ttf/'
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -6,7 +6,7 @@ socket = /var/run/__APP__/socket
virtualenv = __FINALPATH__/venv
# http://uwsgi-docs.readthedocs.io/en/latest/Nginx.html#hosting-multiple-apps-in-the-same-process-aka-managing-script-name-and-path-info
mount = __PATH__=__FINALPATH__/venv/lib/python3.5/site-packages/weblate/wsgi.py
mount = __PATH__=__FINALPATH__/venv/lib/__PYTHONPATH__/site-packages/weblate/wsgi.py
# Needed for OAuth/OpenID
buffer-size = 8192
@ -23,4 +23,4 @@ close-on-exec = true
# Do not log some errors caused by client disconnects
ignore-sigpipe = true
ignore-write-errors = true
disable-write-exception = true
disable-write-exception = true

View file

@ -8,7 +8,7 @@
"description": {
"en": "A translation platform using Git and Python"
},
"version": "3.8.0~ynh1",
"version": "3.8.0~ynh2",
"url": "https://weblate.org",
"license": "AGPL-3.0",
"maintainer": {

View file

@ -15,6 +15,15 @@ pkg_dependencies="libxml2-dev libxslt-dev libfreetype6-dev \
# Weblate's version for PIP and settings file
current_version="3.8"
debian_maj_version=$(sed 's/\..*//' /etc/debian_version)
if [ "$debian_maj_version" -eq 9 ] ; then
weblate_pypath="python3.5"
elif [ "$debian_maj_version" -eq 10 ] ; then
weblate_pypath="python3.7"
fi
#=================================================
# PERSONAL HELPERS
#=================================================
@ -31,6 +40,7 @@ weblate_fill_settings() {
ynh_replace_string "__FINALPATH__" "$final_path" "$settings"
ynh_replace_string "__GITHUBUSER__" "$github_account" "$settings"
ynh_replace_string "__REDIS_DB__" "$redis_db" "$settings"
ynh_replace_string "__PYTHONPATH__" "$weblate_pypath" "$settings"
# root install as an empty PATHURL to prevent '//static'
if [ "$path_url" == "/" ]

View file

@ -85,7 +85,7 @@ fi
#=================================================
# Edit specific content from nginx configuration
#=================================================
settings="$final_path/venv/lib/python3.5/site-packages/weblate/settings.py"
settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
if [ "$old_path" == "/" ] && [ "$new_path" != "/" ]
then

View file

@ -207,7 +207,7 @@ admin_mail=$(ynh_user_get_info "$admin" mail)
key=$(ynh_string_random 24)$(ynh_string_random 24)$(ynh_string_random 2)
redis_db=$(ynh_redis_get_free_db)
settings="$final_path/venv/lib/python3.5/site-packages/weblate/settings.py"
settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
cp "../conf/settings_history/settings.$current_version.py" "$settings"
weblate_fill_settings "$settings"
@ -259,9 +259,11 @@ ynh_script_progression --message="Configure uwsgi..." --time --weight=1
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
cp ../conf/uwsgi.ini "$finaluwsgiini"
ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini"
ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini"
ynh_replace_string "__APP__" "$app" "$finaluwsgiini"
ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini"
ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini"
ynh_replace_string "__APP__" "$app" "$finaluwsgiini"
ynh_replace_string "__PYTHONPATH__" "$weblate_pypath" "$finaluwsgiini"
# root install doesn't require uwsgi to handle script names

View file

@ -151,9 +151,11 @@ ynh_script_progression --message="Configure uwsgi..." --time --weight=1
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
cp ../conf/uwsgi.ini "$finaluwsgiini"
ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini"
ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini"
ynh_replace_string "__APP__" "$app" "$finaluwsgiini"
ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini"
ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini"
ynh_replace_string "__APP__" "$app" "$finaluwsgiini"
ynh_replace_string "__PYTHONPATH__" "$weblate_pypath" "$finaluwsgiini"
# root install doesn't require uwsgi to handle script names
@ -190,7 +192,7 @@ ynh_script_progression --message="Install weblate using PIP..." --time --weight=
#=================================================
ynh_script_progression --message="Create weblate configuration file..." --time --weight=1
# save old settings file
settings="$final_path/venv/lib/python3.5/site-packages/weblate/settings.py"
settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
old_settings="$final_path/settings.$previous_version.old.py"
@ -272,7 +274,7 @@ ynh_script_progression --message="Run migration scripts..." --time --weight=1
)
# Recalculate and store the config file checksum into the app settings
ynh_store_file_checksum "$final_path/venv/lib/python3.5/site-packages/weblate/settings.py"
ynh_store_file_checksum "$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
#=================================================
# SETUP CRON