ci: install python on ubuntu

Python is missing from the default ubuntu-22.04 runner image, which prevents git-p4 from working. To install python on ubuntu, we need to provide the correct package names: * On Ubuntu 18.04 (bionic), "/usr/bin/python2" is provided by the "python" package, and "/usr/bin/python3" is provided by the "python3" package. * On Ubuntu 20.04 (focal) and above, "/usr/bin/python2" is provided by the "python2" package which has a different name from bionic, and "/usr/bin/python3" is provided by "python3". Since the "ubuntu-latest" runner image has a higher version, its safe to use "python2" or "python3" package name. Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jiang Xin committed Nov 25, 2022 at 17:59 UTC a69043d51083151c538c3f2da0fc312f8af35edd
2 files changed +4 -4
ci/install-dependencies.sh
+1 -1
@@ -16,7 +16,7 @@ linux-clang|linux-gcc)
16 sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
17 sudo apt-get -q update
18 sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \
19 - $UBUNTU_COMMON_PKGS
19 + $UBUNTU_COMMON_PKGS $PYTHON_PACKAGE
20 case "$jobname" in
21 linux-gcc)
22 sudo apt-get -q -y install gcc-8
ci/lib.sh
+3 -3
@@ -184,13 +184,13 @@ export SKIP_DASHED_BUILT_INS=YesPlease
184
185 case "$jobname" in
186 linux-clang|linux-gcc)
187 + PYTHON_PACKAGE=python2
188 if [ "$jobname" = linux-gcc ]
189 then
190 export CC=gcc-8
190 - MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3"
191 - else
192 - MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python2"
191 + PYTHON_PACKAGE=python3
192 fi
193 + MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/$PYTHON_PACKAGE"
194
195 export GIT_TEST_HTTPD=true
196