diff --git a/conf/settings_history/settings.3.2.2.py b/conf/settings_history/settings.3.2.2.py index ffbe881..67dd6bc 100644 --- a/conf/settings_history/settings.3.2.2.py +++ b/conf/settings_history/settings.3.2.2.py @@ -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 diff --git a/conf/settings_history/settings.3.3.py b/conf/settings_history/settings.3.3.py index 3f69df4..4683a5b 100644 --- a/conf/settings_history/settings.3.3.py +++ b/conf/settings_history/settings.3.3.py @@ -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 diff --git a/conf/settings_history/settings.3.4.py b/conf/settings_history/settings.3.4.py index 6edec99..30e4d44 100644 --- a/conf/settings_history/settings.3.4.py +++ b/conf/settings_history/settings.3.4.py @@ -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 diff --git a/conf/settings_history/settings.3.5.1.py b/conf/settings_history/settings.3.5.1.py index 00fd17f..ca6f682 100644 --- a/conf/settings_history/settings.3.5.1.py +++ b/conf/settings_history/settings.3.5.1.py @@ -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 diff --git a/conf/settings_history/settings.3.5.py b/conf/settings_history/settings.3.5.py index 00fd17f..ca6f682 100644 --- a/conf/settings_history/settings.3.5.py +++ b/conf/settings_history/settings.3.5.py @@ -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 diff --git a/conf/settings_history/settings.3.6.1.py b/conf/settings_history/settings.3.6.1.py index ff77791..b231714 100644 --- a/conf/settings_history/settings.3.6.1.py +++ b/conf/settings_history/settings.3.6.1.py @@ -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 diff --git a/conf/settings_history/settings.3.7.py b/conf/settings_history/settings.3.7.py index 83343d6..cfe7067 100644 --- a/conf/settings_history/settings.3.7.py +++ b/conf/settings_history/settings.3.7.py @@ -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 diff --git a/conf/settings_history/settings.3.8.py b/conf/settings_history/settings.3.8.py index 19c6901..cf43ac2 100644 --- a/conf/settings_history/settings.3.8.py +++ b/conf/settings_history/settings.3.8.py @@ -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 diff --git a/conf/uwsgi.ini b/conf/uwsgi.ini index 33549a3..ca9a11f 100644 --- a/conf/uwsgi.ini +++ b/conf/uwsgi.ini @@ -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 \ No newline at end of file +disable-write-exception = true diff --git a/manifest.json b/manifest.json index 0a8693f..7f842ea 100644 --- a/manifest.json +++ b/manifest.json @@ -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": { diff --git a/scripts/_common.sh b/scripts/_common.sh index c8f2733..dc56bb5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -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" == "/" ] diff --git a/scripts/change_url b/scripts/change_url index 40996aa..e93dee2 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -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 diff --git a/scripts/install b/scripts/install index 98bd281..0aad39b 100755 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/upgrade b/scripts/upgrade index cc50c78..1430346 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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