mirror of
https://github.com/YunoHost-Apps/django-for-runners_ynh.git
synced 2024-09-03 18:26:16 +02:00
commit
0e5a5ce242
3 changed files with 14 additions and 13 deletions
|
@ -31,7 +31,7 @@ services = ["__APP__"]
|
||||||
type = "boolean"
|
type = "boolean"
|
||||||
yes = "1"
|
yes = "1"
|
||||||
no = "0"
|
no = "0"
|
||||||
help = "Should be never enabled in production!"
|
help = "Enable DEBUG mode? (Should be never enabled in production!)"
|
||||||
bind = "debug_enabled:/home/yunohost.app/__APP__/settings.py"
|
bind = "debug_enabled:/home/yunohost.app/__APP__/settings.py"
|
||||||
|
|
||||||
[main.config.log_level]
|
[main.config.log_level]
|
||||||
|
|
|
@ -86,13 +86,11 @@ myynh_install_python() {
|
||||||
if $(dpkg --compare-versions $py_built_version ge $python)
|
if $(dpkg --compare-versions $py_built_version ge $python)
|
||||||
then
|
then
|
||||||
# Built >= Required
|
# Built >= Required
|
||||||
ynh_print_info --message="Using already used python3 built version..."
|
|
||||||
|
|
||||||
py_app_version="/usr/local/bin/python${py_built_version%.*}"
|
py_app_version="/usr/local/bin/python${py_built_version%.*}"
|
||||||
|
ynh_print_info --message="Using already used python3 built version: $py_app_version"
|
||||||
else
|
else
|
||||||
# APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin
|
# APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin
|
||||||
ynh_print_info --message="Building python (may take a while)..."
|
ynh_print_info --message="Building $python (may take a while)..."
|
||||||
|
|
||||||
# Store current direcotry
|
# Store current direcotry
|
||||||
local MY_DIR=$(pwd)
|
local MY_DIR=$(pwd)
|
||||||
|
@ -126,21 +124,25 @@ myynh_install_python() {
|
||||||
fi
|
fi
|
||||||
# Save python version in settings
|
# Save python version in settings
|
||||||
ynh_app_setting_set --app=$app --key=python --value="$python"
|
ynh_app_setting_set --app=$app --key=python --value="$python"
|
||||||
|
|
||||||
|
# Print some version information:
|
||||||
|
ynh_print_info --message="Python version: $($py_app_version -VV)"
|
||||||
|
ynh_print_info --message="Pip version: $($py_app_version -m pip -V)"
|
||||||
}
|
}
|
||||||
#==================================================================================
|
#==================================================================================
|
||||||
#==================================================================================
|
#==================================================================================
|
||||||
|
|
||||||
myynh_setup_python_venv() {
|
myynh_setup_python_venv() {
|
||||||
# Always recreate everything fresh with current python version
|
# Install Python if needed:
|
||||||
ynh_secure_remove "$data_dir/venv"
|
|
||||||
|
|
||||||
myynh_install_python --python="$py_required_version"
|
myynh_install_python --python="$py_required_version"
|
||||||
|
|
||||||
# Create a virtualenv with python installed by myynh_install_python():
|
# Create a virtualenv with python installed by myynh_install_python():
|
||||||
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
|
# Skip pip because of: https://github.com/YunoHost/issues/issues/1960
|
||||||
$py_app_version -m venv --without-pip "$data_dir/venv"
|
ynh_exec_as $app $py_app_version -m venv --clear --upgrade-deps "$data_dir/venv"
|
||||||
|
|
||||||
chown -c -R "$app:" "$data_dir"
|
# Print some version information:
|
||||||
|
ynh_print_info --message="venv Python version: $($data_dir/venv/bin/python3 -VV)"
|
||||||
|
ynh_print_info --message="venv Pip version: $($data_dir/venv/bin/python3 -m pip -V)"
|
||||||
|
|
||||||
# run source in a 'sub shell'
|
# run source in a 'sub shell'
|
||||||
(
|
(
|
||||||
|
@ -148,8 +150,7 @@ myynh_setup_python_venv() {
|
||||||
source "$data_dir/venv/bin/activate"
|
source "$data_dir/venv/bin/activate"
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -x
|
set -x
|
||||||
ynh_exec_as $app $data_dir/venv/bin/python3 -m ensurepip
|
ynh_exec_as $app $data_dir/venv/bin/pip3 install --upgrade pip wheel setuptools
|
||||||
ynh_exec_as $app $data_dir/venv/bin/pip3 install --upgrade wheel pip setuptools
|
|
||||||
ynh_exec_as $app $data_dir/venv/bin/pip3 install --no-deps -r "$data_dir/requirements.txt"
|
ynh_exec_as $app $data_dir/venv/bin/pip3 install --no-deps -r "$data_dir/requirements.txt"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring $app main directory..."
|
ynh_script_progression --message="Restoring $app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
ynh_restore_file --origin_path="$data_dir"
|
ynh_restore_file --origin_path="$data_dir"
|
||||||
|
|
Loading…
Reference in a new issue