Skip to content

Commit

Permalink
Allow installation on Ubuntu 24.04 (#2893)
Browse files Browse the repository at this point in the history
Ubuntu 24.04 is not allowing the overwriting of system python packages. In such cases it is recommended to  create virtual environment and activate it to avoid conflicts with the python packages coming from the OS.
  • Loading branch information
slaff authored Oct 24, 2024
1 parent 3892590 commit 2c08c85
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Tools/export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ if [ -z "$SMING_HOME" ]; then
fi

# Common

# Python Virtual Environment
if [ -f ~/.venvs/Sming/bin/activate ]; then
source ~/.venvs/Sming/bin/activate
fi

export PYTHON=${PYTHON:=$(which python3)}

# Esp8266
Expand Down
13 changes: 12 additions & 1 deletion Tools/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ check_for_installed_files() {
fi
}

install_venv() {
echo
echo "!!! Trying to install Python Virtual Environment !!!"
mkdir -p ~/.venvs/
python3 -m venv ~/.venvs/Sming
source ~/.venvs/Sming/bin/activate
eval "$1"
}

# Installers put downloaded archives here
DOWNLOADS="downloads"
mkdir -p $DOWNLOADS
Expand Down Expand Up @@ -243,7 +252,9 @@ if [ -f "/usr/bin/clang-format-8" ]; then
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-8 100
fi

python3 -m pip install --upgrade pip protobuf -r "$SMING_HOME/../Tools/requirements.txt"
PYTHON_INSTALL_CMD="python3 -m pip install --upgrade pip -r \"$SMING_HOME/../Tools/requirements.txt\""

eval "$PYTHON_INSTALL_CMD" || $PKG_INSTALL python3-venv && install_venv "$PYTHON_INSTALL_CMD"


install() {
Expand Down
1 change: 1 addition & 0 deletions Tools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
protobuf
pyserial
jsonschema
kconfiglib
Expand Down

0 comments on commit 2c08c85

Please sign in to comment.