1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/homeassistant_ynh.git synced 2024-09-03 19:26:16 +02:00
This commit is contained in:
ewilly 2021-11-27 21:57:52 +01:00
parent 04f69bc521
commit 8b2a3b9fd7

View file

@ -100,36 +100,36 @@ myynh_install_dependencies () {
MY_PYTHON="python3" MY_PYTHON="python3"
else else
# Either python already built or to build # Either python already built or to build
ynh_print_info --message="Installing additional dependencies..."
PKG_DEPENDENCIES="${PKG_DEPENDENCIES} tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libbz2-dev libexpat1-dev liblzma-dev wget tar"
ynh_install_app_dependencies "${PKG_DEPENDENCIES}"
if [ $(myynh_version_compare $PY_BUILT_VERSION $python) -le 1 ]; then if [ $(myynh_version_compare $PY_BUILT_VERSION $python) -le 1 ]; then
# Built >= Required # Built >= Required
ynh_print_info --message="Using already used python3 built version..." ynh_print_info --message="Using already used python3 built version..."
MY_PYTHON="/usr/local/bin/python${PY_BUILT_VERSION:0:3}" MY_PYTHON="/usr/local/bin/python${PY_BUILT_VERSION:0:3}"
else else
# APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin ynh_print_info --message="Installing additional dependencies to build python..."
ynh_print_info --message="Building python (may take a while)..." PKG_DEPENDENCIES="${PKG_DEPENDENCIES} tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libbz2-dev libexpat1-dev liblzma-dev wget tar"
# Store current direcotry ynh_install_app_dependencies "${PKG_DEPENDENCIES}"
local MY_DIR=$(pwd) # APT < Minimal & Actual < Minimal => Build & install Python into /usr/local/bin
# Download ynh_print_info --message="Building python (may take a while)..."
wget -O "/tmp/Python-$python.tar.xz" "https://www.python.org/ftp/python/$python/Python-$python.tar.xz" 2>&1 # Store current direcotry
# Extract local MY_DIR=$(pwd)
cd /tmp # Download
tar xf "Python-$python.tar.xz" wget -O "/tmp/Python-$python.tar.xz" "https://www.python.org/ftp/python/$python/Python-$python.tar.xz" 2>&1
# Install # Extract
cd "Python-$python" cd /tmp
./configure --enable-optimizations tar xf "Python-$python.tar.xz"
ynh_exec_warn_less make -j4 # Install
ynh_exec_warn_less make altinstall cd "Python-$python"
# Clean ./configure --enable-optimizations
cd .. ynh_exec_warn_less make -j4
ynh_secure_remove "Python-$python" ynh_exec_warn_less make altinstall
ynh_secure_remove "Python-$python.tar.xz" # Clean
# Set version cd ..
MY_PYTHON="/usr/local/bin/python${python:0:3}" ynh_secure_remove "Python-$python"
# Go back to working directory ynh_secure_remove "Python-$python.tar.xz"
cd $MY_DIR # Set version
MY_PYTHON="/usr/local/bin/python${python:0:3}"
# Go back to working directory
cd $MY_DIR
fi fi
fi fi
# Save python version in settings # Save python version in settings
@ -146,14 +146,14 @@ myynh_install_homeassistant () {
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
exec_as $app -H -s /bin/bash -c " \ exec_as $app -H -s /bin/bash -c " \
echo 'create the virtual environment' \ echo 'create the virtual environment' \
&& $MY_PYTHON -m venv "$final_path" \ && $MY_PYTHON -m venv "$final_path" \
&& echo 'activate the virtual environment' \ && echo 'activate the virtual environment' \
&& source "$final_path/bin/activate" \ && source "$final_path/bin/activate" \
&& echo 'install last version of wheel' \ && echo 'install last version of wheel' \
&& pip --cache-dir "$path/.cache" install --upgrade wheel \ && pip --cache-dir "$path/.cache" install --upgrade wheel \
&& echo 'install Home Assistant' \ && echo 'install Home Assistant' \
&& pip --cache-dir "$path/.cache" install --upgrade $app==$VERSION \ && pip --cache-dir "$path/.cache" install --upgrade $app==$VERSION \
" "
} }