Skip to content

Commit df8843c

Browse files
authored
Upgrade old Python version in packaging pipeline (microsoft#16667)
- Upgrade from Python 3.6 to 3.8 in packaging pipeline. - Raise build.py minimum required Python version.
1 parent b8c40b7 commit df8843c

File tree

8 files changed

+30
-22
lines changed

8 files changed

+30
-22
lines changed

build.amd64.1411.bat

-12
This file was deleted.

build.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
:: Licensed under the MIT License.
33

44
@echo off
5-
rem Requires a python 3.6 or higher install to be available in your PATH
5+
rem Requires a Python install to be available in your PATH
66
python "%~dp0\tools\ci_build\build.py" --build_dir "%~dp0\build\Windows" %*

build.sh

-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ elif [[ "$*" == *"--android"* ]]; then
1818
DIR_OS="Android"
1919
fi
2020

21-
#requires python3.6 or higher
2221
python3 $DIR/tools/ci_build/build.py --build_dir $DIR/build/$DIR_OS "$@"

tools/ci_build/build.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ def __init__(self, message):
4646

4747

4848
def _check_python_version():
49-
# TODO Upgrade this, Python 3.6 is no longer supported. However, some packaging pipelines are still using it.
50-
required_minor_version = 6
49+
required_minor_version = 7
5150
if (sys.version_info.major, sys.version_info.minor) < (3, required_minor_version):
5251
raise UsageError(
5352
f"Invalid Python version. At least Python 3.{required_minor_version} is required. "

tools/ci_build/github/linux/docker/inference/aarch64/default/cpu/scripts/install_centos.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ os_major_version=$(cat /etc/redhat-release | tr -dc '0-9.'|cut -d \. -f1)
55

66
echo "installing for CentOS version : $os_major_version"
77
yum install -y centos-release-scl-rh
8-
yum install -y which gdb redhat-lsb-core expat-devel tar unzip zlib-devel make libunwind bzip2 bzip2-devel java-11-openjdk-devel graphviz devtoolset-10-binutils devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-gcc-gfortran python3 python3-pip
8+
yum install -y which gdb redhat-lsb-core expat-devel tar unzip zlib-devel make libunwind bzip2 bzip2-devel java-11-openjdk-devel graphviz devtoolset-10-binutils devtoolset-10-gcc devtoolset-10-gcc-c++ devtoolset-10-gcc-gfortran
99

10-
pip3 install --upgrade pip
1110
localedef -i en_US -f UTF-8 en_US.UTF-8

tools/ci_build/github/linux/docker/inference/aarch64/default/cpu/scripts/install_deps.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ tar -zxf /tmp/src/cmake-3.26.3-linux-`uname -m`.tar.gz --strip=1 -C /usr
4545
echo "Installing Ninja"
4646
GetFile https://github.com/ninja-build/ninja/archive/v1.10.0.tar.gz /tmp/src/ninja-linux.tar.gz
4747
tar -zxf ninja-linux.tar.gz
48-
cd ninja-1.10.0
48+
pushd ninja-1.10.0
4949
cmake -Bbuild-cmake -H.
5050
cmake --build build-cmake
5151
mv ./build-cmake/ninja /usr/bin
52+
popd
5253

5354
echo "Installing Node.js"
5455
CPU_ARCH=`uname -m`
@@ -62,5 +63,16 @@ fi
6263
GetFile https://nodejs.org/dist/v16.14.2/node-v16.14.2-linux-${NODEJS_ARCH}.tar.gz /tmp/src/node-v16.14.2-linux-${NODEJS_ARCH}.tar.gz
6364
tar --strip 1 -xf /tmp/src/node-v16.14.2-linux-${NODEJS_ARCH}.tar.gz -C /usr
6465

66+
# The Python version in CentOS 7's python3 package is no longer supported (3.6) so we will build Python from source.
67+
echo "Installing Python"
68+
PYTHON_VERSION="3.8.17"
69+
GetFile https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz /tmp/src/Python-${PYTHON_VERSION}.tgz
70+
tar -zxf Python-${PYTHON_VERSION}.tgz
71+
pushd Python-${PYTHON_VERSION}
72+
./configure
73+
make
74+
make install
75+
popd
76+
6577
cd /
6678
rm -rf /tmp/src

tools/ci_build/github/linux/docker/inference/x64/default/cpu/scripts/install_centos.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ os_major_version=$(cat /etc/redhat-release | tr -dc '0-9.'|cut -d \. -f1)
55

66
echo "installing for CentOS version : $os_major_version"
77
yum install -y centos-release-scl-rh
8-
yum install -y which gdb redhat-lsb-core expat-devel tar unzip zlib-devel make libunwind bzip2 bzip2-devel java-11-openjdk-devel graphviz devtoolset-11-binutils devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-gcc-gfortran python3 python3-pip
8+
yum install -y which gdb redhat-lsb-core expat-devel tar unzip zlib-devel make libunwind bzip2 bzip2-devel java-11-openjdk-devel graphviz devtoolset-11-binutils devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-gcc-gfortran
99

10-
pip3 install --upgrade pip
1110
localedef -i en_US -f UTF-8 en_US.UTF-8

tools/ci_build/github/linux/docker/inference/x64/default/cpu/scripts/install_deps.sh

+13-1
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ tar -zxf /tmp/src/cmake-3.26.3-linux-`uname -m`.tar.gz --strip=1 -C /usr
4545
echo "Installing Ninja"
4646
GetFile https://github.com/ninja-build/ninja/archive/v1.10.0.tar.gz /tmp/src/ninja-linux.tar.gz
4747
tar -zxf ninja-linux.tar.gz
48-
cd ninja-1.10.0
48+
pushd ninja-1.10.0
4949
cmake -Bbuild-cmake -H.
5050
cmake --build build-cmake
5151
mv ./build-cmake/ninja /usr/bin
52+
popd
5253

5354
echo "Installing Node.js"
5455
CPU_ARCH=`uname -m`
@@ -62,5 +63,16 @@ fi
6263
GetFile https://nodejs.org/dist/v16.14.2/node-v16.14.2-linux-${NODEJS_ARCH}.tar.gz /tmp/src/node-v16.14.2-linux-${NODEJS_ARCH}.tar.gz
6364
tar --strip 1 -xf /tmp/src/node-v16.14.2-linux-${NODEJS_ARCH}.tar.gz -C /usr
6465

66+
# The Python version in CentOS 7's python3 package is no longer supported (3.6) so we will build Python from source.
67+
echo "Installing Python"
68+
PYTHON_VERSION="3.8.17"
69+
GetFile https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz /tmp/src/Python-${PYTHON_VERSION}.tgz
70+
tar -zxf Python-${PYTHON_VERSION}.tgz
71+
pushd Python-${PYTHON_VERSION}
72+
./configure
73+
make
74+
make install
75+
popd
76+
6577
cd /
6678
rm -rf /tmp/src

0 commit comments

Comments
 (0)