Skip to content

Commit 3c31fdf

Browse files
Python3 version
Signed-off-by: Eugenio Collado <eugeniocollado@eprosima.com>
1 parent 5c24003 commit 3c31fdf

File tree

3 files changed

+45
-4
lines changed

3 files changed

+45
-4
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,20 @@ jobs:
3232
run: |
3333
apt update
3434
export DEBIAN_FRONTEND=noninteractive
35-
apt install -y git python3-pip
35+
apt install -y git python3-pip curl
36+
if python3 -c 'import sys; exit(0 if sys.version_info >= (3, 9) else 1)'; then
37+
echo "Python version is >= 3.9"
38+
else
39+
echo "Python version is < 3.9. Updating to Python 3.9..."
40+
apt install -y software-properties-common
41+
add-apt-repository -y ppa:deadsnakes/ppa
42+
apt update
43+
apt install -y python3.9 python3.9-dev python3.9-distutils
44+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
45+
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
46+
python3 get-pip.py
47+
rm get-pip.py
48+
fi
3649
. $IDF_PATH/export.sh
3750
pip3 install catkin_pkg lark-parser colcon-common-extensions
3851
# This line avoids the error when using Python < 3.7 https://importlib-resources.readthedocs.io/en/latest/
@@ -112,4 +125,4 @@ jobs:
112125
make -f libmicroros.mk clean
113126
cd examples/int32_publisher_embeddedrtps
114127
idf.py set-target ${{ matrix.idf_target }}
115-
idf.py build
128+
idf.py build

.github/workflows/nightly.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,20 @@ jobs:
3737
run: |
3838
apt update
3939
export DEBIAN_FRONTEND=noninteractive
40-
apt install -y git python3-pip
40+
apt install -y git python3-pip curl
41+
if python3 -c 'import sys; exit(0 if sys.version_info >= (3, 9) else 1)'; then
42+
echo "Python version is >= 3.9"
43+
else
44+
echo "Python version is < 3.9. Updating to Python 3.9..."
45+
apt install -y software-properties-common
46+
add-apt-repository -y ppa:deadsnakes/ppa
47+
apt update
48+
apt install -y python3.9 python3.9-dev python3.9-distutils
49+
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
50+
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
51+
python3 get-pip.py
52+
rm get-pip.py
53+
fi
4154
. $IDF_PATH/export.sh
4255
pip3 install catkin_pkg lark-parser empy==3.3.4 colcon-common-extensions
4356
# This line avoids the error when using Python < 3.7 https://importlib-resources.readthedocs.io/en/latest/

docker/install_micro_ros_deps_script.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,22 @@
33
set -eu
44

55
sudo apt update -q
6-
sudo apt install -yq python3-pip
6+
sudo apt install -yq python3-pip curl
7+
8+
if python3 -c 'import sys; exit(0 if sys.version_info >= (3, 9) else 1)'; then
9+
echo "Python version is >= 3.9"
10+
else
11+
echo "Python version is < 3.9. Updating to Python 3.9..."
12+
sudo apt install -y software-properties-common
13+
sudo add-apt-repository -y ppa:deadsnakes/ppa
14+
sudo apt update
15+
sudo apt install -y python3.9 python3.9-dev python3.9-distutils
16+
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
17+
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
18+
python3 get-pip.py
19+
rm get-pip.py
20+
fi
21+
722
source $IDF_PATH/export.sh
823
pip3 install catkin_pkg lark-parser colcon-common-extensions importlib-resources
924

0 commit comments

Comments
 (0)