Skip to content

Commit

Permalink
[Packaging] Bump embedded Python to 3.8 for deb packages (#20869)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiasli committed Feb 17, 2022
1 parent f8ea47c commit 92a4d5e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
16 changes: 10 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -761,31 +761,35 @@ jobs:
vmImage: 'ubuntu-20.04'
strategy:
matrix:
# https://wiki.ubuntu.com/Releases
Xenial:
# 16.04
deb_system: ubuntu
distro: xenial
Trusty:
deb_system: ubuntu
distro: trusty
Bionic:
# 18.04
deb_system: ubuntu
distro: bionic
Focal:
# 20.04
deb_system: ubuntu
distro: focal
Hirsute:
# 21.04
deb_system: ubuntu
distro: hirsute
Jessie:
deb_system: debian
distro: jessie

# https://wiki.debian.org/DebianReleases
Stretch:
# 9
deb_system: debian
distro: stretch
Buster:
# 10
deb_system: debian
distro: buster
Bullseye:
# 11
deb_system: debian
distro: bullseye
steps:
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-get update
RUN apt-get install -y libssl-dev libffi-dev python3-dev debhelper zlib1g-dev wget

# Download Python source code
ARG python_version="3.6.10"
ARG python_version="3.8.12"
ENV PYTHON_SRC_DIR=/usr/src/python
RUN mkdir -p ${PYTHON_SRC_DIR} && \
wget -qO- https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz \
Expand Down
7 changes: 4 additions & 3 deletions scripts/release/debian/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ set -exv
ls -Rl /mnt/artifacts

WORKDIR=`cd $(dirname $0); cd ../../../; pwd`
PYTHON_VERSION="3.6.10"
PYTHON_VERSION="3.8.12"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Update APT packages
apt-get update
apt-get install -y libssl-dev libffi-dev python3-dev debhelper zlib1g-dev
# uuid-dev is used to build _uuid module: https://github.com/python/cpython/pull/3796
apt-get install -y libssl-dev libffi-dev python3-dev debhelper zlib1g-dev uuid-dev
apt-get install -y wget

# Download Python source code
Expand All @@ -33,7 +34,7 @@ $PYTHON_SRC_DIR/*/configure --srcdir $PYTHON_SRC_DIR/* --prefix $WORKDIR/python_
make
make install

$WORKDIR/python_env/bin/python3 -m pip install --upgrade pip==21.0.1
$WORKDIR/python_env/bin/python3 -m pip install --upgrade pip

export PATH=$PATH:$WORKDIR/python_env/bin

Expand Down
6 changes: 3 additions & 3 deletions scripts/release/debian/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Azure CLI
Copyright (c) Microsoft Corporation
All rights reserved.
All rights reserved.
MIT License
Expand All @@ -90,7 +90,7 @@ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
EOM

# TODO: Instead of "_ssl.cpython-36m-x86_64-linux-gnu.so" only, find all .so files with "find debian/azure-cli/opt/az -type f -name '*.so'"
# TODO: Instead of "_ssl.cpython-38-x86_64-linux-gnu.so" only, find all .so files with "find debian/azure-cli/opt/az -type f -name '*.so'"

cat > $debian_dir/rules << EOM
#!/usr/bin/make -f
Expand All @@ -110,7 +110,7 @@ ${TAB}echo "\043!/usr/bin/env bash\nbin_dir=\140cd \"\044(dirname \"\044BASH_SOU
${TAB}chmod 0755 debian/azure-cli/usr/bin/az
${TAB}mkdir -p debian/azure-cli/etc/bash_completion.d/
${TAB}cat ${completion_script} > debian/azure-cli/etc/bash_completion.d/azure-cli
${TAB}dpkg-shlibdeps -v --warnings=7 -Tdebian/azure-cli.substvars -dDepends -edebian/azure-cli/opt/az/bin/python3 debian/azure-cli/opt/az/lib/python3.6/lib-dynload/_ssl.cpython-36m-x86_64-linux-gnu.so
${TAB}dpkg-shlibdeps -v --warnings=7 -Tdebian/azure-cli.substvars -dDepends -edebian/azure-cli/opt/az/bin/python3 debian/azure-cli/opt/az/lib/python3.8/lib-dynload/_ssl.cpython-38-x86_64-linux-gnu.so
override_dh_strip:
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/debian/test_deb_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import sys
import subprocess

root_dir = '/opt/az/lib/python3.6/site-packages/azure/cli/command_modules'
root_dir = '/opt/az/lib/python3.8/site-packages/azure/cli/command_modules'
mod_list = [mod for mod in sorted(os.listdir(root_dir)) if os.path.isdir(os.path.join(root_dir, mod)) and mod != '__pycache__']

pytest_base_cmd = '/opt/az/bin/python3 -m pytest -x -v --boxed -p no:warnings --log-level=WARN'
Expand Down

0 comments on commit 92a4d5e

Please sign in to comment.