Skip to content

Commit fa0fc38

Browse files
committed
Fix python installation on Ubuntu 20
1 parent 6e67095 commit fa0fc38

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,15 @@ jobs:
165165
curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor > /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg
166166
for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done
167167
apt-get -o Acquire::Retries=$NET_RETRY_COUNT update
168-
apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y g++ python libpython-dev git locales
168+
osver=$(lsb_release -sr | cut -f1 -d.)
169+
pkgs="g++ git xz-utils"
170+
# Ubuntu 22+ has only Python 3 in the repos
171+
if [ -n "$osver" ] && [ "$osver" -ge "20" ]; then
172+
pkgs+=" python-is-python3 libpython3-dev"
173+
else
174+
pkgs+=" python libpython-dev"
175+
fi
176+
apt-get -o Acquire::Retries=$NET_RETRY_COUNT -y -q --no-install-suggests --no-install-recommends install $pkgs
169177
fi
170178
# For jobs not compatible with ccache, use "ccache: no" in the matrix
171179
if [[ "${{ matrix.ccache }}" == "no" ]]; then

0 commit comments

Comments
 (0)