1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00

Simplify call to venv

This commit is contained in:
Josué Tille 2024-02-21 08:20:16 +01:00
parent 7bf8d068b7
commit 606a38b59d
No known key found for this signature in database
GPG key ID: 5F259226AD51F2F5
3 changed files with 6 additions and 38 deletions

View file

@ -42,21 +42,11 @@ install_sources() {
test -e $code_dir/bin/python3 || python3 -m venv $code_dir test -e $code_dir/bin/python3 || python3 -m venv $code_dir
# Install synapse in virtualenv # Install synapse in virtualenv
local pip3=$code_dir/bin/pip3
# We set all necessary environement variable to create a python virtualenvironnement. $pip3 install --upgrade setuptools wheel pip
u_arg='u' $pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2
set +$u_arg; $pip3 install --upgrade -r $YNH_APP_BASEDIR/conf/requirement_$(lsb_release --codename --short).txt
source $code_dir/bin/activate
set -$u_arg;
pip3 install --upgrade setuptools wheel pip
pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2
pip3 install --upgrade -r $YNH_APP_BASEDIR/conf/requirement_$(lsb_release --codename --short).txt
# This function was defined when we called "source $code_dir/bin/activate". With this function we undo what "$code_dir/bin/activate" does
set +$u_arg;
deactivate
set -$u_arg;
fi fi
# Apply patch for LDAP auth if needed # Apply patch for LDAP auth if needed

View file

@ -172,19 +172,8 @@ chown $app:$app -R $install_dir
ynh_script_progression --message="Creating Synapse config..." --weight=3 ynh_script_progression --message="Creating Synapse config..." --weight=3
# Go in virtualenvironnement
u_arg='u'
set +$u_arg;
source $code_dir/bin/activate
set -$u_arg;
# Generate config # Generate config
python -m synapse.app.homeserver --keys-directory /etc/matrix-$app/ --generate-config --server-name $server_name --report-stats=no -c homeserver.yml $code_dir/bin/python -m synapse.app.homeserver --keys-directory /etc/matrix-$app/ --generate-config --server-name $server_name --report-stats=no -c homeserver.yml
# This function was defined when we called "source $code_dir/bin/activate". With this function we undo what "$code_dir/bin/activate" does
set +$u_arg;
deactivate
set -$u_arg;
# Get random values from config # Get random values from config
registration_shared_secret=$(egrep "^registration_shared_secret:" homeserver.yml | cut -d'"' -f2) registration_shared_secret=$(egrep "^registration_shared_secret:" homeserver.yml | cut -d'"' -f2)

View file

@ -364,19 +364,8 @@ if [ -z "$registration_shared_secret" ] || [ "$form_secret" == "form_secret: " ]
then then
ynh_script_progression --message="Generating synapse secret..." --weight=1 ynh_script_progression --message="Generating synapse secret..." --weight=1
# Go in virtualenvironnement
u_arg='u'
set +$u_arg;
source $code_dir/bin/activate
set -$u_arg;
# Generate config and keys # Generate config and keys
python -m synapse.app.homeserver --keys-directory /etc/matrix-$app/ --generate-config --generate-keys --server-name $server_name --report-stats=no -c homeserver.yml $code_dir/bin/python -m synapse.app.homeserver --keys-directory /etc/matrix-$app/ --generate-config --generate-keys --server-name $server_name --report-stats=no -c homeserver.yml
# This function was defined when we called "source $code_dir/bin/activate". With this function we undo what "$code_dir/bin/activate" does
set +$u_arg;
deactivate
set -$u_arg;
# Get random values from config # Get random values from config
registration_shared_secret=$(egrep "^registration_shared_secret:" homeserver.yml | cut -d'"' -f2) registration_shared_secret=$(egrep "^registration_shared_secret:" homeserver.yml | cut -d'"' -f2)