Upgrade old Python version in packaging pipeline (#16667)

- Upgrade from Python 3.6 to 3.8 in packaging pipeline.
- Raise build.py minimum required Python version.
This commit is contained in:
Edward Chen 2023-07-17 08:24:47 -07:00 committed by GitHub
parent b8c40b7813
commit df8843c4a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 22 deletions

View file

@ -1,12 +0,0 @@
:: Copyright (c) Microsoft Corporation. All rights reserved.
:: Licensed under the MIT License.
rem This will setup the VC env vars to use the 14.11 (VS2017 ver15.3) toolchain which is supported by CUDA 9.2 prior to running build.py.
rem It currently defaults to amd64 but that could be made configurable if that would be useful to developers running this locally.
@echo off
rem Use 14.11 toolset
call "%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" amd64 -vcvars_ver=14.11
rem Requires a python 3.6 or higher install to be available in your PATH
python %~dp0\tools\ci_build\build.py --build_dir %~dp0\build\Windows %*

View file

@ -2,5 +2,5 @@
:: Licensed under the MIT License.
@echo off
rem Requires a python 3.6 or higher install to be available in your PATH
rem Requires a Python install to be available in your PATH
python "%~dp0\tools\ci_build\build.py" --build_dir "%~dp0\build\Windows" %*

View file

@ -18,5 +18,4 @@ elif [[ "$*" == *"--android"* ]]; then
DIR_OS="Android"
fi
#requires python3.6 or higher
python3 $DIR/tools/ci_build/build.py --build_dir $DIR/build/$DIR_OS "$@"

View file

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

View file

@ -5,7 +5,6 @@ os_major_version=$(cat /etc/redhat-release | tr -dc '0-9.'|cut -d \. -f1)
echo "installing for CentOS version : $os_major_version"
yum install -y centos-release-scl-rh
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
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
pip3 install --upgrade pip
localedef -i en_US -f UTF-8 en_US.UTF-8

View file

@ -45,10 +45,11 @@ tar -zxf /tmp/src/cmake-3.26.3-linux-`uname -m`.tar.gz --strip=1 -C /usr
echo "Installing Ninja"
GetFile https://github.com/ninja-build/ninja/archive/v1.10.0.tar.gz /tmp/src/ninja-linux.tar.gz
tar -zxf ninja-linux.tar.gz
cd ninja-1.10.0
pushd ninja-1.10.0
cmake -Bbuild-cmake -H.
cmake --build build-cmake
mv ./build-cmake/ninja /usr/bin
popd
echo "Installing Node.js"
CPU_ARCH=`uname -m`
@ -62,5 +63,16 @@ fi
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
tar --strip 1 -xf /tmp/src/node-v16.14.2-linux-${NODEJS_ARCH}.tar.gz -C /usr
# The Python version in CentOS 7's python3 package is no longer supported (3.6) so we will build Python from source.
echo "Installing Python"
PYTHON_VERSION="3.8.17"
GetFile https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz /tmp/src/Python-${PYTHON_VERSION}.tgz
tar -zxf Python-${PYTHON_VERSION}.tgz
pushd Python-${PYTHON_VERSION}
./configure
make
make install
popd
cd /
rm -rf /tmp/src

View file

@ -5,7 +5,6 @@ os_major_version=$(cat /etc/redhat-release | tr -dc '0-9.'|cut -d \. -f1)
echo "installing for CentOS version : $os_major_version"
yum install -y centos-release-scl-rh
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
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
pip3 install --upgrade pip
localedef -i en_US -f UTF-8 en_US.UTF-8

View file

@ -45,10 +45,11 @@ tar -zxf /tmp/src/cmake-3.26.3-linux-`uname -m`.tar.gz --strip=1 -C /usr
echo "Installing Ninja"
GetFile https://github.com/ninja-build/ninja/archive/v1.10.0.tar.gz /tmp/src/ninja-linux.tar.gz
tar -zxf ninja-linux.tar.gz
cd ninja-1.10.0
pushd ninja-1.10.0
cmake -Bbuild-cmake -H.
cmake --build build-cmake
mv ./build-cmake/ninja /usr/bin
popd
echo "Installing Node.js"
CPU_ARCH=`uname -m`
@ -62,5 +63,16 @@ fi
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
tar --strip 1 -xf /tmp/src/node-v16.14.2-linux-${NODEJS_ARCH}.tar.gz -C /usr
# The Python version in CentOS 7's python3 package is no longer supported (3.6) so we will build Python from source.
echo "Installing Python"
PYTHON_VERSION="3.8.17"
GetFile https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz /tmp/src/Python-${PYTHON_VERSION}.tgz
tar -zxf Python-${PYTHON_VERSION}.tgz
pushd Python-${PYTHON_VERSION}
./configure
make
make install
popd
cd /
rm -rf /tmp/src