Skip to content

Commit

Permalink
Merge pull request #31 from mcdonnnj/improvement/adjust_python_instal…
Browse files Browse the repository at this point in the history
…lation_on_linux_runners

Only install Python from `deadsnakes` on Ubuntu versions prior to 22.04
  • Loading branch information
JarLob authored Nov 17, 2024
2 parents e80931f + 7cf72c7 commit 16aa0b3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions monitor/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,16 @@ if [ "$RUNNER_OS" = "macOS" ]; then

elif [ "$RUNNER_OS" = "Linux" ]; then

# ubuntu 22.04 and later install python 3.10 or later by default
python_package="python3"

# install python 3.10, otherwise ubuntu 20.04 installs 3.8 and we won't get the latest mitmproxy with important bug fixes
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt install -y python3.10-venv
if (( "$(lsb_release --short --release | cut --delimiter='.' --fields=1)" < 22 )); then
sudo add-apt-repository ppa:deadsnakes/ppa -y
python_package="python3.10"
fi

sudo apt install -y "$python_package"-venv

# create mitmproxyuser, otherwise proxy won't intercept local trafic from the same user
sudo useradd --create-home mitmproxyuser
Expand All @@ -125,7 +132,7 @@ elif [ "$RUNNER_OS" = "Linux" ]; then
git clone -b main https://github.com/mitmproxy/mitmproxy.git && \
cd mitmproxy && \
git checkout 5353df5f1eeaf5fc36d9b5f7024199c888aed116 && \
python3.10 -m venv venv && \
"$(command -v python3.10 || command -v python3)" -m venv venv && \
venv/bin/pip install -e ".[dev]" '

sudo cp mitm_plugin.py /home/mitmproxyuser/mitm_plugin.py
Expand Down

0 comments on commit 16aa0b3

Please sign in to comment.