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

Merge Debian buster support & hub fix

Testing
This commit is contained in:
Jean-Baptiste 2020-05-01 22:34:38 +02:00 committed by GitHub
commit 737440a004
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 37 additions and 23 deletions

View file

@ -56,7 +56,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory # Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data') 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: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -56,7 +56,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory # Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data') 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: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -56,7 +56,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory # Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data') 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: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -59,7 +59,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory # Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data') 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: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -59,7 +59,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory # Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data') 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: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -66,7 +66,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory # Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data') 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: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -67,7 +67,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory # Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data') 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: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name

View file

@ -68,7 +68,7 @@ BASE_DIR = '__FINALPATH__'
# Data directory # Data directory
DATA_DIR = os.path.join(BASE_DIR, 'data') 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: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # 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 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 # 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 # Needed for OAuth/OpenID
buffer-size = 8192 buffer-size = 8192

View file

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

View file

@ -15,6 +15,15 @@ pkg_dependencies="libxml2-dev libxslt-dev libfreetype6-dev \
# Weblate's version for PIP and settings file # Weblate's version for PIP and settings file
current_version="3.8" 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 # PERSONAL HELPERS
#================================================= #=================================================
@ -31,6 +40,7 @@ weblate_fill_settings() {
ynh_replace_string "__FINALPATH__" "$final_path" "$settings" ynh_replace_string "__FINALPATH__" "$final_path" "$settings"
ynh_replace_string "__GITHUBUSER__" "$github_account" "$settings" ynh_replace_string "__GITHUBUSER__" "$github_account" "$settings"
ynh_replace_string "__REDIS_DB__" "$redis_db" "$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' # root install as an empty PATHURL to prevent '//static'
if [ "$path_url" == "/" ] if [ "$path_url" == "/" ]

View file

@ -85,7 +85,7 @@ fi
#================================================= #=================================================
# Edit specific content from nginx configuration # 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" != "/" ] if [ "$old_path" == "/" ] && [ "$new_path" != "/" ]
then 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) key=$(ynh_string_random 24)$(ynh_string_random 24)$(ynh_string_random 2)
redis_db=$(ynh_redis_get_free_db) 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" cp "../conf/settings_history/settings.$current_version.py" "$settings"
weblate_fill_settings "$settings" weblate_fill_settings "$settings"
@ -262,6 +262,8 @@ cp ../conf/uwsgi.ini "$finaluwsgiini"
ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini" ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini"
ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini" ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini"
ynh_replace_string "__APP__" "$app" "$finaluwsgiini" ynh_replace_string "__APP__" "$app" "$finaluwsgiini"
ynh_replace_string "__PYTHONPATH__" "$weblate_pypath" "$finaluwsgiini"
# root install doesn't require uwsgi to handle script names # root install doesn't require uwsgi to handle script names

View file

@ -59,7 +59,7 @@ ynh_restore_file "$final_path"
ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1 ynh_script_progression --message="Recreating the dedicated system user..." --time --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create "$app" "/home/$app" ynh_system_user_create "$app" "$final_path"
# Allow bash for our user, so he can use hub # Allow bash for our user, so he can use hub
chsh --shell /bin/bash "$app" chsh --shell /bin/bash "$app"

View file

@ -140,7 +140,7 @@ ynh_install_app_dependencies "$pkg_dependencies"
ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1
# Create a system user # Create a system user
ynh_system_user_create "$app" "/home/$app" ynh_system_user_create "$app" "$final_path"
chsh --shell /bin/bash "$app" chsh --shell /bin/bash "$app"
#================================================= #=================================================
@ -154,6 +154,8 @@ cp ../conf/uwsgi.ini "$finaluwsgiini"
ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini" ynh_replace_string "__FINALPATH__" "$final_path" "$finaluwsgiini"
ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini" ynh_replace_string "__PATH__" "$path_url" "$finaluwsgiini"
ynh_replace_string "__APP__" "$app" "$finaluwsgiini" ynh_replace_string "__APP__" "$app" "$finaluwsgiini"
ynh_replace_string "__PYTHONPATH__" "$weblate_pypath" "$finaluwsgiini"
# root install doesn't require uwsgi to handle script names # 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 ynh_script_progression --message="Create weblate configuration file..." --time --weight=1
# save old settings file # 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" 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 # 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 # SETUP CRON