2021-05-21 01:10:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# COMMON VARIABLES
|
|
|
|
#=================================================
|
|
|
|
|
2023-06-10 22:38:45 +02:00
|
|
|
pip_dependencies=(
|
2022-06-11 05:03:46 +02:00
|
|
|
'ihatemoney==5.2.0'
|
|
|
|
'gunicorn>=20.0'
|
|
|
|
'PyMySQL>=0.9,<1.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
|
|
|
|
#=================================================
|