Skip to content

Commit 58d57c7

Browse files
dumoladiroiban
andauthored
Python 3.10 update. (#39)
* Only build generic Linux packages. * Only build x64 Windows packages. * Try with cryptography 39.0.2 wheels. * Retry Windows matrix. * Use linux instead of lnx for Linux packages. * Use latest OpenSSL 1.1.1 sources for Python's ssl module. * Check for cryptography's OpenSSL version everywhere. * Fixed cryptography's OpenSSL version to check for. * Try fixing Safety errors. * Updated all Python modules to latest version. * Try building on CentOS 6.10. * Disable OpenSSL tests for now. * Updated macOS deps. * Try CentOS 7. * Revert "Try CentOS 7." This reverts commit 861817c. * Revert "Try building on CentOS 6.10." This reverts commit 9d2551e. * Use a get-pip.py that still works on CentOS 5. * Build the generic Linux version on Ubuntu 18.04. * Forward port the latest cleanups from python-package. * Also clean up on Windows. * Put include/ back after packing the distributable. * Also remove ssl/ if found, e.g. on macOS. * Re-enabled OpenSSL 1.1.x self tests. * Re-enabled x86 Windows build. * Run the macOS build from the beginning. * Changes after own review. * Removed subprocess32. * Python 3.10. * Updated libffi to version 3.4.4. * Run the checks in all PRs. * Updated Python version patching. * Disabled readline for macOS too. * Updated xz and SQLite to latest versions. * Changes after own review. * One small correction in a comment. * Updated cryptography to newly-released 40.0.1. * Updated OpenSSL version to check for. * Check for cffi module too. * Build and check for PyNaCl module. * Syntax fix for cffi check. * Collect PyNaCl when building. * Added charset-normalizer, markupsafe, pywin32. * Update src/chevah-python-test/test_python_binary_dist.py * Enable debug * Apply suggestions from code review * Update src/Python-Windows/chevahbs * Update src/Python-Windows/chevahbs * fix 3.10 path * Update src/Python-Windows/chevahbs * enable debug * Update src/Python-Windows/chevahbs * Update test_python_binary_dist.py * Apply suggestions from code review * Apply suggestions from code review * Update .github/workflows/bare.yaml * Update src/Python-Windows/chevahbs * The -3 check is no longer needed. * Removed Windows matrix from bare workflow. * Renamed docker workflow job. * Updated Python to version 3.10.11. * Updated Python to version 3.10.11 (bis). * Actually remove the build path for 32bit Windows packages. * Document why MarkupSafe is pinned to an older version. * Try -latest in the bare workflow. * Better document supported Linux distributions. * Build generic Linux on Amazon 2 with glibc 2.26. * Lower case yum parameter. * Use gcc 10.4 instead of 7.2 for building the generic Linux package. * Link gcc 10.4 in the default path. * Back to using gcc 7.2 on Amazon Linux 2. * Try building an ARM64 package. * Try building an ARM64 package, take 2. * Removed ARM64 job. * Try building on Apple Silicon. * Removed third-party action from the macos-m1 job. * Replaced third-party action with out fork for the other jobs. * Changes after own review. --------- Co-authored-by: Adi Roiban <adiroiban@gmail.com>
1 parent 564325e commit 58d57c7

18 files changed

+151
-1068
lines changed

.github/workflows/bare.yaml

+28-15
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@
22
# GitHub actions for building and testing on bare hardware.
33
# Typically, Windows and macOS builds are done this way.
44
# Look for the Linux builds in the "docker" workflow.
5-
#
6-
# Don't use `-latest` for runners, pin specific OS versions instead. More at
7-
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners.
85

96
name: Bare
107

118
on:
129
push:
1310
branches: [ main ]
14-
1511
pull_request:
16-
branches: [ main ]
1712

1813
concurrency:
1914
group: bare-${{ github.ref }}
@@ -30,13 +25,7 @@ env:
3025
jobs:
3126
windows:
3227
# The type of runner that the job will run on
33-
runs-on: ${{ matrix.runs-on }}
34-
if: github.event.inputs.job == '' || github.event.inputs.job == 'windows'
35-
strategy:
36-
# Workflow won't be cancelled at the first failed job.
37-
fail-fast: false
38-
matrix:
39-
runs-on: [ windows-2022, windows-2019 ]
28+
runs-on: windows-latest
4029
timeout-minutes: 15
4130

4231
# Steps represent a sequence of tasks that will be executed as part of the job
@@ -74,7 +63,7 @@ jobs:
7463
# Command line debugging through Tmate. v3 works on Windows too.
7564
- name: Tmate debug on failure
7665
if: failure() && env.TMATE_DEBUG == 'yes'
77-
uses: mxschmitt/action-tmate@v3
66+
uses: chevah/action-tmate@v3
7867
with:
7968
limit-access-to-actor: true
8069

@@ -97,7 +86,7 @@ jobs:
9786
9887
9988
macos:
100-
runs-on: macos-10.15
89+
runs-on: macos-latest
10190
timeout-minutes: 30
10291
steps:
10392
- uses: actions/checkout@v2
@@ -137,6 +126,30 @@ jobs:
137126
138127
- name: Tmate debug on failure
139128
if: failure() && env.TMATE_DEBUG == 'yes'
140-
uses: mxschmitt/action-tmate@v3
129+
uses: chevah/action-tmate@v3
141130
with:
142131
limit-access-to-actor: true
132+
133+
134+
macos-m1:
135+
runs-on: m1
136+
timeout-minutes: 30
137+
steps:
138+
- uses: actions/checkout@v2
139+
with:
140+
fetch-depth: 2
141+
142+
- name: Build Pythia
143+
run: ./build.sh build
144+
145+
- name: Test Pythia
146+
run: ./build.sh test
147+
148+
- name: Upload testing package
149+
run: |
150+
mkdir -pv ~/.ssh/
151+
touch priv_key
152+
chmod 600 priv_key
153+
echo "${{ secrets.SFTPPLUS_BIN_PRIV_KEY }}" > priv_key
154+
echo "${{ secrets.SFTPPLUS_BIN_HOST_KEY }}" > ~/.ssh/known_hosts
155+
./publish_dist.sh ; rm priv_key

.github/workflows/docker.yaml

+10-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
push:
1111
branches: [ main ]
1212
pull_request:
13-
branches: [ main ]
1413

1514
concurrency:
1615
group: docker-${{ github.ref }}
@@ -24,14 +23,14 @@ env:
2423
# Using a job name that doesn't contain the OS name, to minimize the risk of
2524
# confusion with the OS names of the containers, which are the relevant ones.
2625
jobs:
27-
latest:
26+
linux:
2827
runs-on: ubuntu-latest
2928
container: ${{ matrix.container }}
3029
strategy:
3130
fail-fast: false
3231
matrix:
33-
# Alpine 3.12 has musl 1.1.24, Ubuntu 18.04 has glibc 2.27.
34-
container: [ 'alpine:3.12', 'ubuntu:18.04' ]
32+
# Alpine 3.12 has musl 1.1.24, Amazon 2 has glibc 2.26.
33+
container: [ 'alpine:3.12', 'amazonlinux:2' ]
3534
timeout-minutes: 30
3635
steps:
3736

@@ -45,6 +44,12 @@ jobs:
4544
curl --output /usr/local/bin/paxctl https://bin.chevah.com:20443/third-party-stuff/alpine/paxctl-3.12
4645
chmod +x /usr/local/bin/paxctl
4746
47+
- name: Amazon setup
48+
if: startsWith(matrix.container, 'amazonlinux')
49+
run: |
50+
yum -y upgrade
51+
yum -y install git-core gcc make m4 patch tar unzip perl perl-Test-Simple
52+
4853
- name: Ubuntu setup
4954
if: startsWith(matrix.container, 'ubuntu')
5055
run: |
@@ -84,7 +89,7 @@ jobs:
8489
# Not working on Alpine (not supported) and CentOS 5 (glibc too old).
8590
- name: Tmate debug on failure
8691
if: failure() && env.TMATE_DEBUG == 'yes'
87-
uses: mxschmitt/action-tmate@v3
92+
uses: chevah/action-tmate@v3
8893
with:
8994
sudo: false
9095
limit-access-to-actor: true

README.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ Note that compat tests are currently only working on the ``python2.7`` branch.
2121
Supported platforms
2222
-------------------
2323

24-
* Windows Server 2012 R2 and newer (x86 and x64)
25-
* macOS 10.13 and newer (Intel Macs only)
26-
* all glibc-based Linux distributions (glibc 2.17+)
24+
* Windows Server 2012 R2 and newer
25+
* macOS 10.13 and newer (both Intel and Apple Silicon)
26+
* Red Hat Enterprise Linux 8 and newer (including clones)
27+
* Ubuntu 18.04 LTS and newer
28+
* Amazon Linux 2 and newer
2729
* Alpine Linux 3.12 and newer.
2830

2931
Platforms that should work, but are not regularly tested:
3032

33+
* all glibc-based Linux distributions (glibc 2.26+)
3134
* all musl-based Linux distributions (musl 1.1.24+)
3235
* FreeBSD 12 and newer
3336
* OpenBSD 6.7 and newer

build.conf

+21-8
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,40 @@ BUILD_DIR="build"
55
DIST_DIR="dist"
66

77
# Python and lib versions.
8-
PYTHON_BUILD_VERSION="3.8.6"
9-
LIBFFI_VERSION="3.4.2"
8+
PYTHON_BUILD_VERSION="3.10.11"
9+
LIBFFI_VERSION="3.4.4"
1010
ZLIB_VERSION="1.2.13"
1111
BZIP2_VERSION="1.0.8"
12-
XZ_VERSION="5.2.5"
12+
XZ_VERSION="5.4.1"
1313
# Statically build the BSD libedit on selected platforms to get the
1414
# readline module available without linking to the GPL-only readline libs.
15+
# If there's a need to reenable this, our libedit patch for Python 3.9 was
16+
# https://github.com/chevah/pythia/pull/5/commits/09c128154d23feb6b1a7cb5a8d79.
17+
# A newer patch is available at https://github.com/python/cpython/issues/57710.
1518
LIBEDIT_VERSION="20170329-3.1"
1619
OPENSSL_VERSION="1.1.1t"
1720
# To match the unusual naming scheme for SQLite downloads, eliminate dots from
18-
# the regular SQLite version, then add 3 zeros. E.g. "3.33.0" -> "3330000".
21+
# the regular version, then add zeros where missing. E.g. "3.41.1" -> "3410100".
1922
# When updating this, also update the year in src/sqlite/chevahbs, if needed.
20-
SQLITE_VERSION="3380300"
23+
# To check for a SHA3-256 signature: openssl dgst -sha3-256 file.tar.gz.
24+
SQLITE_VERSION="3410100"
2125
# These are used by get-pip.py.
2226
PIP_VERSION="23.0.1"
23-
SETUPTOOLS_VERSION="67.6.0"
27+
SETUPTOOLS_VERSION="67.6.1"
2428

2529
# Python modules versions to be used everywhere possible.
2630
# Latest cryptography/bcrypt require Rust, use only wheels for them.
2731
CFFI_VERSION="1.15.1"
28-
CRYPTOGRAPHY_VERSION="39.0.2"
32+
CRYPTOGRAPHY_VERSION="40.0.1"
33+
PYNACL_VERSION="1.5.0"
2934
BCRYPT_VERSION="4.0.1"
3035
PSUTIL_VERSION="5.9.4"
3136
SETPROCTITLE_VERSION="1.3.2"
37+
# Version 1.1.1 pinned since it works on both py2 and py3.
38+
MARKUPSAFE_VERSION="1.1.1"
39+
# Version 2.0.11 pinned since it works on both py2 and py3.
40+
CHARSETNORMALIZER_VERSION="2.0.11"
41+
PYWIN32_VERSION="306"
3242

3343
# pycparser is explicitly installed to work around setuptools auto dependencies.
3444
PYCPARSER_VERSION="2.21"
@@ -41,17 +51,20 @@ BUILD_LIBFFI="no"
4151
BUILD_ZLIB="no"
4252
BUILD_BZIP2="yes"
4353
BUILD_XZ="no"
44-
BUILD_LIBEDIT="yes"
54+
BUILD_LIBEDIT="no"
4555
BUILD_OPENSSL="no"
4656
BUILD_SQLITE="yes"
4757

4858
# List of default Python modules installed using pip.
4959
PIP_LIBRARIES="\
5060
cffi==${CFFI_VERSION} \
5161
cryptography==${CRYPTOGRAPHY_VERSION} \
62+
PyNaCl==${PYNACL_VERSION} \
5263
bcrypt==${BCRYPT_VERSION} \
5364
psutil==${PSUTIL_VERSION} \
5465
setproctitle==${SETPROCTITLE_VERSION}
66+
MarkupSafe==${MARKUPSAFE_VERSION} \
67+
charset-normalizer==${CHARSETNORMALIZER_VERSION} \
5568
"
5669
PIP_ARGS="\
5770
--index-url=${PIP_INDEX_URL} \

functions_build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ download_sources(){
6666
echo "## Unpacking archive ${archive_filename}... ##"
6767
execute $ZIP_CMD "$archive_filename" -d ../../build/
6868
;;
69-
exe|amd64*|win32*)
69+
exe|amd64*)
7070
# No need to use ../../build/"$project_name"-"$project_ver"/ here.
7171
echo " Nothing to unpack in build/ for ${archive_filename}."
7272
;;

os_quirks.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ case $OS in
1313
# But not all are from pypi.org. Wheels copied from other places:
1414
# * "setproctitle" from https://www.lfd.uci.edu/~gohlke/pythonlibs/
1515
export BUILD_BZIP2="no"
16-
export BUILD_LIBEDIT="no"
1716
export BUILD_SQLITE="no"
17+
PIP_LIBRARIES="$PIP_LIBRARIES \
18+
pywin32==${PYWIN32_VERSION} \
19+
"
1820
# On Windows, only one of the installers is downloaded.
1921
export SHA_CMD="$SHA_CMD --ignore-missing"
2022
;;
@@ -32,7 +34,6 @@ case $OS in
3234
export BUILD_LIBFFI="yes"
3335
export BUILD_ZLIB="yes"
3436
export BUILD_XZ="yes"
35-
export BUILD_LIBEDIT="no"
3637
export BUILD_OPENSSL="yes"
3738
;;
3839
macos)

pythia.sh

+5-25
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ARCH='not-detected-yet'
8686
PYTHON_CONFIGURATION='NOT-YET-DEFINED'
8787
PYTHON_VERSION='not.defined.yet'
8888
PYTHON_PLATFORM='unknown-os-and-arch'
89-
PYTHON_NAME='python3.8'
89+
PYTHON_NAME='python3.10'
9090
BINARY_DIST_URI='https://github.com/chevah/pythia/releases/download'
9191
PIP_INDEX_URL='https://pypi.org/simple'
9292
BASE_REQUIREMENTS=''
@@ -106,7 +106,7 @@ check_source_folder() {
106106
# Called to trigger the entry point in the virtual environment.
107107
# Can be overwritten in pythia.conf
108108
execute_venv() {
109-
${PYTHON_BIN} $PYTHON3_CHECK -c 'from paver.tasks import main; main()' "$@"
109+
${PYTHON_BIN} -c 'from paver.tasks import main; main()' "$@"
110110
}
111111

112112

@@ -626,12 +626,12 @@ check_glibc_version(){
626626
local supported_glibc2_version
627627

628628
# Supported minimum minor glibc 2.X versions for various arches.
629-
# For x64, we build on Ubuntu 18.04 with glibc 2.27.
630-
# For arm64, we build on Ubuntu 16.04 with glibc 2.23.
629+
# For x64, we build on Amazon 2 with glibc 2.26.
630+
# For arm64, we used to build on Ubuntu 16.04 with glibc 2.23.
631631
# Beware we haven't normalized arch names yet.
632632
case "$ARCH" in
633633
"amd64"|"x86_64"|"x64")
634-
supported_glibc2_version=27
634+
supported_glibc2_version=26
635635
;;
636636
"aarch64"|"arm64")
637637
supported_glibc2_version=23
@@ -782,17 +782,6 @@ detect_os() {
782782
;;
783783
"amd64"|"x86_64")
784784
ARCH="x64"
785-
case "$OS" in
786-
win)
787-
# 32bit build on Windows 2019, 64bit otherwise.
788-
# Should work with a l10n pack too (tested with French).
789-
win_ver=$(systeminfo.exe | head -n 3 | tail -n 1 \
790-
| cut -d ":" -f 2)
791-
if [[ "$win_ver" =~ "Microsoft Windows Server 2019" ]]; then
792-
ARCH="x86"
793-
fi
794-
;;
795-
esac
796785
;;
797786
"aarch64")
798787
ARCH="arm64"
@@ -839,15 +828,6 @@ if [ "$COMMAND" == "deps" ] ; then
839828
install_base_deps
840829
fi
841830

842-
case $COMMAND in
843-
test_ci|test_py3)
844-
PYTHON3_CHECK='-3'
845-
;;
846-
*)
847-
PYTHON3_CHECK=''
848-
;;
849-
esac
850-
851831
set +e
852832
execute_venv "$@"
853833
exit_code=$?

src/Python-Windows/chevahbs

+3-5
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,16 @@ INSTALL_DIR=$3/lib
1818

1919
# Construct the relevant download link for the Windows version.
2020
EXT="amd64.zip"
21-
if [ "$ARCH" = "x86" ]; then
22-
EXT="win32.zip"
23-
fi
2421
ARCHIVE="python-${VER}.${EXT}"
2522
LINK="https://www.python.org/ftp/python/${VER}/python-${VER}-embed-${EXT}"
2623

27-
# Download without unpacking (amd64.zip/win32.zip EXTs are treated specially).
24+
# Download without unpacking (amd64.zip extension is treated specially).
2825
download_sources $NAME $VER $LINK $EXT
2926

3027
# Installation consists of unpacking the ZIP'ed embeddable distribution.
3128
echo "## Extracting ZIP archive to ${INSTALL_DIR}... ##"
3229
execute unzip -q "$ARCHIVE" -d "${INSTALL_DIR}"
3330

3431
echo "## Adding site-packages to python*._pth file... ##"
35-
echo "lib\\site-packages" >> ${INSTALL_DIR}/python38._pth
32+
echo "import site" >> ${INSTALL_DIR}/python310._pth
33+
echo "site.main()" >> ${INSTALL_DIR}/python310._pth

src/Python-Windows/sha512.sum

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
3b463ef64397326ffd5f20009be6c1304a3bd8646e5bf05c0a8be5ed4aabe7b0a5a6133e962f538292e6290a04fbe07b1caa6c09c54d012b0d07b7f025772921 *Python-3.8.6.amd64.zip
2-
fb270ce1f1d0bcb95e6c192a35dda276005f74e3c9d89a3a8f799296e9a1db925155437be977a3f3181c25eb522025895563d2333bc6606353bc024b51379107 *Python-3.8.6.win32.zip
1+
40cbc98137cc7768e3ea498920ddffd0b3b30308bfd7bbab2ed19d93d2e89db6b4430c7b54a0f17a594e8e10599537a643072e08cfd1a38c284f8703879dcc17 *Python-3.10.11.amd64.zip

src/Python/chevahbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ chevahbs_configure() {
6969
execute cp Modules/getbuildinfo.c Modules/getbuildinfo.c.orig
7070
# Don't use 'sed -i' here, it's not supported on macOS 10.13.
7171
execute sed -e \
72-
s/gitid\ =\ \"default\"/gitid\ =\ \"$PYTHIA_VERSION\"/g \
72+
s/gitid\ =\ \"main\"/gitid\ =\ \"$PYTHIA_VERSION\"/g \
7373
Modules/getbuildinfo.c.orig > Modules/getbuildinfo.c
7474
execute ./configure --prefix="" $CONFIG_ARGS
7575
}

src/Python/disabled_modules.patch

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
diff -ur Python-3.8.6.orig/setup.py Python-3.8.6.disabled_modules/setup.py
2-
--- Python-3.8.6.orig/setup.py 2020-09-23 12:36:32.000000000 +0000
3-
+++ Python-3.8.6.disabled_modules/setup.py 2020-10-30 11:48:50.512622149 +0000
4-
@@ -24,8 +24,16 @@
5-
TEST_EXTENSIONS = True
1+
diff -ur Python-3.10.10/setup.py Python-3.10.10-disabled-modules/setup.py
2+
--- Python-3.10.10/setup.py 2023-02-07 14:05:45.000000000 +0200
3+
+++ Python-3.10.10-disabled-modules/setup.py 2023-03-17 12:41:45.252791918 +0200
4+
@@ -58,7 +58,16 @@
5+
TEST_EXTENSIONS = (sysconfig.get_config_var('TEST_MODULES') == 'yes')
66

77
# This global variable is used to hold the list of modules to be disabled.
88
-DISABLED_MODULE_LIST = []
9-
-
109
+DISABLED_MODULE_LIST = [
1110
+ '_curses',
1211
+ '_curses_panel',
@@ -18,5 +17,5 @@ diff -ur Python-3.8.6.orig/setup.py Python-3.8.6.disabled_modules/setup.py
1817
+ 'readline',
1918
+ ]
2019

21-
def get_platform():
22-
# Cross compiling
20+
# --list-module-names option used by Tools/scripts/generate_module_names.py
21+
LIST_MODULE_NAMES = False

0 commit comments

Comments
 (0)