Skip to content

Commit

Permalink
Tools: use venv on Archlinux to fix install
Browse files Browse the repository at this point in the history
  • Loading branch information
khancyr authored and peterbarker committed Aug 23, 2023
1 parent be74f7b commit 2b8a605
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ jobs:
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
source ~/.bashrc
source $HOME/venv-ardupilot/bin/activate || true
git config --global --add safe.directory /__w/ardupilot/ardupilot
./waf configure
./waf rover
Expand All @@ -128,6 +129,7 @@ jobs:
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
source ~/.bashrc
source $HOME/venv-ardupilot/bin/activate || true
case ${{matrix.os}} in
*"archlinux"*)
export PATH=/opt/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH
Expand Down
25 changes: 20 additions & 5 deletions Tools/environment_install/install-prereqs-arch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,25 @@ function maybe_prompt_user() {
fi
}

sudo usermod -a -G uucp $USER
sudo usermod -a -G uucp "$USER"

sudo pacman -Sy --noconfirm --needed $BASE_PKGS $SITL_PKGS $PX4_PKGS
pip3 -q install --user -U $PYTHON_PKGS

python3 -m venv "$HOME"/venv-ardupilot

# activate it:
SOURCE_LINE="source $HOME/venv-ardupilot/bin/activate"
$SOURCE_LINE

if [[ -z "${DO_PYTHON_VENV_ENV}" ]] && maybe_prompt_user "Make ArduPilot venv default for python [N/y]?" ; then
DO_PYTHON_VENV_ENV=1
fi

if [[ $DO_PYTHON_VENV_ENV -eq 1 ]]; then
echo "$SOURCE_LINE" >> ~/.bashrc
fi

pip3 -q install -U $PYTHON_PKGS

(
cd /usr/lib/ccache
Expand All @@ -78,7 +93,7 @@ exportline="export PATH=$OPT/$ARM_ROOT/bin:\$PATH";
if ! grep -Fxq "$exportline" ~/.bashrc ; then
if maybe_prompt_user "Add $OPT/$ARM_ROOT/bin to your PATH [N/y]?" ; then
echo "$exportline" >> ~/.bashrc
. ~/.bashrc
. "$HOME/.bashrc"
else
echo "Skipping adding $OPT/$ARM_ROOT/bin to PATH."
fi
Expand All @@ -88,15 +103,15 @@ exportline2="export PATH=$CWD/$ARDUPILOT_TOOLS:\$PATH";
if ! grep -Fxq "$exportline2" ~/.bashrc ; then
if maybe_prompt_user "Add $CWD/$ARDUPILOT_TOOLS to your PATH [N/y]?" ; then
echo "$exportline2" >> ~/.bashrc
. ~/.bashrc
. "$HOME/.bashrc"
else
echo "Skipping adding $CWD/$ARDUPILOT_TOOLS to PATH."
fi
fi

SCRIPT_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
(
cd $SCRIPT_DIR
cd "$SCRIPT_DIR"
git submodule update --init --recursive
)

Expand Down

0 comments on commit 2b8a605

Please sign in to comment.