2021-05-21 01:10:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# COMMON VARIABLES
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# dependencies used by the app
|
|
|
|
pkg_dependencies=(
|
|
|
|
python3-dev
|
|
|
|
python3-venv
|
|
|
|
libffi-dev
|
|
|
|
libssl-dev
|
|
|
|
)
|
|
|
|
|
|
|
|
pip_dependencies=(
|
|
|
|
'setuptools>=18.5'
|
|
|
|
'gunicorn>=19.3.0'
|
|
|
|
'PyMySQL>=0.9,<0.10'
|
|
|
|
'SQLAlchemy<1.4'
|
2022-03-13 16:02:11 +01:00
|
|
|
'ihatemoney==4.1.5'
|
2022-03-13 16:02:38 +01:00
|
|
|
'markupsafe==2.0.1'
|
2021-05-21 01:10:01 +02:00
|
|
|
)
|
2017-06-17 17:28:57 +02:00
|
|
|
|
2021-05-21 01:10:01 +02:00
|
|
|
### Constants
|
2017-06-19 09:35:17 +02:00
|
|
|
|
2021-05-21 01:10:01 +02:00
|
|
|
#=================================================
|
|
|
|
# PERSONAL HELPERS
|
|
|
|
#=================================================
|
2017-06-19 09:35:17 +02:00
|
|
|
|
2021-05-21 01:10:01 +02:00
|
|
|
__ynh_python_venv_setup() {
|
|
|
|
local -A args_array=( [d]=venv_dir= [p]=packages= )
|
|
|
|
local venv_dir
|
|
|
|
local packages
|
|
|
|
ynh_handle_getopts_args "$@"
|
2017-06-19 09:35:17 +02:00
|
|
|
|
2021-05-21 01:10:01 +02:00
|
|
|
python3 -m venv --system-site-packages "$venv_dir"
|
2018-12-18 19:23:09 +01:00
|
|
|
|
2021-05-21 01:10:01 +02:00
|
|
|
IFS=" " read -r -a pip_packages <<< "$packages"
|
|
|
|
"$venv_dir/bin/python3" -m pip install --upgrade pip "${pip_packages[@]}"
|
2018-02-17 00:20:10 +01:00
|
|
|
}
|
|
|
|
|
2021-05-21 01:10:01 +02:00
|
|
|
__ynh_python_venv_get_site_packages_dir() {
|
|
|
|
local -A args_array=( [d]=venv_dir= )
|
|
|
|
local venv_dir
|
|
|
|
ynh_handle_getopts_args "$@"
|
2018-12-20 08:07:30 +01:00
|
|
|
|
2021-05-21 01:10:01 +02:00
|
|
|
"$venv_dir/bin/python3" -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])'
|
2018-12-20 08:07:30 +01:00
|
|
|
}
|
|
|
|
|
2018-12-18 18:24:07 +01:00
|
|
|
|
2021-05-21 01:10:01 +02:00
|
|
|
#=================================================
|
|
|
|
# EXPERIMENTAL HELPERS
|
|
|
|
#=================================================
|
2018-06-24 01:24:15 +02:00
|
|
|
|
2021-05-21 01:10:01 +02:00
|
|
|
#=================================================
|
|
|
|
# FUTURE OFFICIAL HELPERS
|
|
|
|
#=================================================
|