-
Notifications
You must be signed in to change notification settings - Fork 195
add support for python 3.10 #1142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
4777f28
add support for python 3.10
arroyc 0bab944
update
arroyc 7c12239
update pip version
arroyc 35260d3
update
arroyc 7a2b5f4
update
arroyc ce4388a
update
arroyc 2a63c72
update
arroyc 179a8d3
remove stretch binary generation for python binaries
arroyc 2bc5459
update
arroyc edceb7c
update
arroyc 861eb32
update stretch based python images
arroyc fe98840
update
arroyc 25171bb
add support for python 3.10
arroyc 5c04bfc
update
arroyc 9aae4c4
update pip version
arroyc e83eaca
update
arroyc 96676f9
update
arroyc 251d55b
update
arroyc 7404597
update
arroyc 0f8a573
remove stretch binary generation for python binaries
arroyc c6c2a73
update
arroyc d6e58a1
update
arroyc 9e61cbb
update stretch based python images
arroyc a51240c
update
arroyc a77f112
update
arroyc 29d20d2
update
arroyc d9bc7e4
update
arroyc 07e344e
update
arroyc 5b4ae70
update to latest
arroyc 7abd736
update
arroyc 4eb8340
remove debug variables and echos
arroyc 3e72ed7
Merge branch 'main' into arroyc/add-python-3.10
qianz2 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| # This file was auto-generated from 'constants.yaml'. Changes may be overridden. | ||
|
|
||
| PIP_VERSION='20.2.3' | ||
| PIP_VERSION='21.2.4' | ||
| PYTHON27_VERSION='2.7.18' | ||
| PYTHON36_VERSION='3.6.15' | ||
| PYTHON37_VERSION='3.7.12' | ||
| PYTHON36_VERSION='3.6.14' | ||
| PYTHON37_VERSION='3.7.11' | ||
| PYTHON38_VERSION='3.8.12' | ||
| PYTHON39_VERSION='3.9.7' | ||
| PYTHON310_VERSION='3.10.0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,160 @@ | ||
| #!/bin/bash | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT license. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| set -ex | ||
| declare -r REPO_DIR=$( cd $( dirname "$0" ) && cd .. && pwd ) | ||
|
|
||
| source $REPO_DIR/build/__pythonVersions.sh | ||
|
|
||
| pythonVersionGPG='' | ||
|
|
||
| version="$1" | ||
|
|
||
| buildPythonfromSource() | ||
| { | ||
| pythonVersion=$PYTHON_VERSION | ||
|
|
||
| if [ ! -z "$1" ]; then | ||
| echo "$1" | ||
| pythonVersion=$1 | ||
| fi | ||
|
|
||
| if [ ! -z "$2" ]; then | ||
| echo "$2" | ||
| gpgKey=$2 | ||
| fi | ||
|
|
||
| wget https://www.python.org/ftp/python/${pythonVersion%%[a-z]*}/Python-$pythonVersion.tar.xz -O /python.tar.xz | ||
| wget https://www.python.org/ftp/python/${pythonVersion%%[a-z]*}/Python-$pythonVersion.tar.xz.asc -O /python.tar.xz.asc | ||
|
|
||
| PYTHON_GET_PIP_URL="https://bootstrap.pypa.io/get-pip.py" | ||
|
|
||
| # for buster and ubuntu we would need following libraries | ||
| apt-get update && \ | ||
| apt-get upgrade -y && \ | ||
| DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
| libssl-dev \ | ||
| libncurses5-dev \ | ||
| libsqlite3-dev \ | ||
| libreadline-dev \ | ||
| libbz2-dev \ | ||
| libgdm-dev \ | ||
| libbluetooth-dev \ | ||
| tk-dev \ | ||
| uuid-dev | ||
|
|
||
| # Try getting the keys 5 times at most | ||
| /tmp/receiveGpgKeys.sh $gpgKey | ||
|
|
||
| gpg --batch --verify /python.tar.xz.asc /python.tar.xz | ||
| tar -xJf /python.tar.xz --strip-components=1 -C . | ||
|
|
||
| INSTALLATION_PREFIX=/opt/python/$PYTHON_VERSION | ||
|
|
||
| if [ "${PYTHON_VERSION::1}" == "2" ]; then | ||
| ./configure \ | ||
| --prefix=$INSTALLATION_PREFIX \ | ||
| --build=$(dpkg-architecture --query DEB_BUILD_GNU_TYPE) \ | ||
| --enable-shared \ | ||
| --enable-unicode=ucs4 | ||
| else | ||
| ./configure \ | ||
| --prefix=$INSTALLATION_PREFIX \ | ||
| --build=$(dpkg-architecture --query DEB_BUILD_GNU_TYPE) \ | ||
| --enable-loadable-sqlite-extensions \ | ||
| --enable-shared \ | ||
| --with-system-expat \ | ||
| --with-system-ffi \ | ||
| --without-ensurepip | ||
| fi | ||
|
|
||
| make -j $(nproc) | ||
|
|
||
| make install | ||
|
|
||
| rm -rf /usr/src/python | ||
| find /usr/local -depth \ | ||
| \( \ | ||
| \( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \ | ||
| -o \( -type f -a \( -name '*.pyc' -o -name '*.pyo' -o -name '*.a' \) \) \ | ||
| \) -exec rm -rf '{}' + \ | ||
|
|
||
| ldconfig | ||
| python3 --version | ||
|
|
||
| # make some useful symlinks that are expected to exist | ||
| cd /usr/local/bin | ||
| ln -s idle3 idle | ||
| ln -s pydoc3 pydoc | ||
| ln -s python3 python | ||
| ln -s python3-config python-config | ||
|
|
||
| PYTHON_GET_PIP_SHA256="c518250e91a70d7b20cceb15272209a4ded2a0c263ae5776f129e0d9b5674309" | ||
|
|
||
| # Install pip | ||
| wget "$PYTHON_GET_PIP_URL" -O get-pip.py | ||
|
|
||
| python3 get-pip.py \ | ||
| --trusted-host pypi.python.org \ | ||
| --trusted-host pypi.org \ | ||
| --trusted-host files.pythonhosted.org \ | ||
| --disable-pip-version-check \ | ||
| --no-cache-dir \ | ||
| --no-warn-script-location | ||
|
|
||
| # Currently only for version '2' of Python, the alias 'python' exists in the 'bin' | ||
| # directory. So to make sure other versions also have this alias, we create the link | ||
| # explicitly here. This is for the scenarios where a user does 'benv python=3.7' and | ||
| # expects the alias 'python' to point to '3.7' rather than '2'. In cases where benv is | ||
| # not passed as an explicit python version, the version '2' is used by default. This is | ||
| # done in the Dockerfile. | ||
| pythonBinDir="$INSTALLATION_PREFIX/bin" | ||
| pythonAliasFile="$pythonBinDir/python" | ||
| if [ ! -e "$pythonAliasFile" ]; then | ||
| IFS='.' read -ra SPLIT_VERSION <<< "$PYTHON_VERSION" | ||
| majorAndMinorParts="${SPLIT_VERSION[0]}.${SPLIT_VERSION[1]}" | ||
| ln -s $pythonBinDir/python$majorAndMinorParts $pythonBinDir/python | ||
| fi | ||
| } | ||
|
|
||
| getPythonGpgByVersion() { | ||
| local versionFile="$1" | ||
| local versionPython="$2" | ||
|
|
||
| while IFS= read -ra VERSION_INFO || [[ -n $VERSION_INFO ]] | ||
| do | ||
| # Ignore whitespace and comments | ||
| if [ -z "$VERSION_INFO" ] || [[ $VERSION_INFO = \#* ]] ; then | ||
| continue | ||
| fi | ||
|
|
||
| arg="$(echo -e "${VERSION_INFO}" | sed -e 's/^[[:space:]]*//')" | ||
| test1=$(echo $arg | cut -d',' -f 1) | ||
| test2=$(echo $arg | cut -d',' -f 2) | ||
|
|
||
| if [ "$versionPython" == "$test1" ];then | ||
| pythonVersionGPG="$test2" | ||
| fi | ||
| done < "$versionFile" | ||
| } | ||
|
|
||
|
|
||
| echo | ||
| echo "Building python 3.10 or newer from source code..." | ||
|
|
||
| getPythonGpgByVersion "/tmp/versionsToBuild.txt" $version | ||
|
|
||
| if [ "$version" == "2.7" ] || [ "$version" == "3.6" ] || \ | ||
| [ "$version" == "3.7" ] || [ "$version" == "3.8" ] || \ | ||
| [ "$version" == "3.9" ] | ||
| then | ||
| source /tmp/oryx/images/installPlatform.sh python $version --dir /opt/python/$version --links false | ||
| else | ||
| buildPythonfromSource $version $pythonVersionGPG | ||
| fi | ||
|
|
||
| pip install --upgrade setuptools pip | ||
| pip install gunicorn debugpy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.