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

Use pipupgrade to update all python package

This commit is contained in:
Josué Tille 2020-03-25 14:17:54 +01:00
parent fc866e8adf
commit 48d0e3a6e7
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF

View file

@ -136,6 +136,13 @@ then
if [ -n "$(uname -m | grep arm)" ] if [ -n "$(uname -m | grep arm)" ]
then then
# Fix multi-instance support
for f in $(ls $final_path/bin); do
if ! [[ $f =~ "__" ]]; then
ynh_replace_special_string --match_string='#!/opt/yunohost/matrix-synapse' --replace_string='#!'$final_path --target_file=$final_path/bin/*
fi
done
# Clean old file, sometimes it could make some big issues if we don't do this!! # Clean old file, sometimes it could make some big issues if we don't do this!!
ynh_secure_remove --file=$final_path/bin ynh_secure_remove --file=$final_path/bin
ynh_secure_remove --file=$final_path/lib ynh_secure_remove --file=$final_path/lib
@ -152,8 +159,17 @@ then
# We set all necessary environement variable to create a python virtualenvironnement. # We set all necessary environement variable to create a python virtualenvironnement.
source $final_path/bin/activate source $final_path/bin/activate
pip3 install --upgrade setuptools wheel pip3 install --upgrade setuptools wheel pipupgrade
pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2 pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2
# Some pip package could be outdated and pip wont upgrade it automatically.
# This could be a security issue when some package have a vulnerability.
# It was by example the case with Twisted.
# Actually there are no official way to upgrade all package
# This problem is documented here : https://github.com/pypa/pip/issues/4551
# One best way is actually to use pipupgrade
pipupgrade --yes --pip-path /tmp/matrix-synapse/bin/pip
pip3 install --upgrade matrix-synapse==$upstream_version matrix-synapse-ldap3 pip3 install --upgrade matrix-synapse==$upstream_version matrix-synapse-ldap3
# This function was defined when we called "source $final_path/bin/activate". With this function we undo what "$final_path/bin/activate" does # This function was defined when we called "source $final_path/bin/activate". With this function we undo what "$final_path/bin/activate" does