Skip to content

Commit 5a67c68

Browse files
authored
Fix Release Pipeline for distutils (#598)
1 parent 536446a commit 5a67c68

11 files changed

+29
-27
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ jobs:
2626
- x64
2727
- x86
2828
python:
29-
- cp37-cp37m
3029
- cp38-cp38
3130
- cp39-cp39
3231
permissions:
@@ -52,7 +51,6 @@ jobs:
5251
- x86
5352
- aarch64
5453
python:
55-
- cp37-cp37m
5654
- cp38-cp38
5755
- cp39-cp39
5856
- cp310-cp310
@@ -85,7 +83,6 @@ jobs:
8583
- x64
8684
- aarch64
8785
python:
88-
- cp37-cp37m
8986
- cp38-cp38
9087
- cp39-cp39
9188
- cp310-cp310

codebuild/cd/manylinux-x64-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ phases:
1212
build:
1313
commands:
1414
- echo Build started on `date`
15-
- /opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
16-
- auditwheel repair --plat manylinux1_x86_64 dist/awscrt-*cp37-cp37m-linux_x86_64.whl
1715
- /opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
1816
- auditwheel repair --plat manylinux1_x86_64 dist/awscrt-*cp38-cp38-linux_x86_64.whl
1917
- /opt/python/cp39-cp39/bin/python setup.py sdist bdist_wheel

codebuild/cd/manylinux-x86-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ phases:
1212
build:
1313
commands:
1414
- echo Build started on `date`
15-
- /opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
16-
- auditwheel repair --plat manylinux1_i686 dist/awscrt-*cp37-cp37m-linux_i686.whl
1715
- /opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
1816
- auditwheel repair --plat manylinux1_i686 dist/awscrt-*cp38-cp38-linux_i686.whl
1917
- /opt/python/cp39-cp39/bin/python setup.py sdist bdist_wheel

continuous-delivery/build-wheels-manylinux2014-aarch64.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ set -ex
44

55
/opt/python/cp39-cp39/bin/python ./continuous-delivery/update-version.py
66

7-
/opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
8-
auditwheel repair --plat manylinux2014_aarch64 dist/awscrt-*cp37*.whl
9-
107
/opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
118
auditwheel repair --plat manylinux2014_aarch64 dist/awscrt-*cp38*.whl
129

@@ -23,6 +20,10 @@ auditwheel repair --plat manylinux2014_aarch64 dist/awscrt-*cp311*.whl
2320
# The 3.11 wheel uses the stable ABI, so it works with newer versions too.
2421

2522
# We are using the Python 3.13 stable ABI from Python 3.13 onwards because of deprecated functions.
23+
# Manylinux images don't contain setuptools from Python 3.13, so we need to install it.
24+
# Install in a custom location due to access issues.
25+
/opt/python/cp313-cp313/bin/python -m pip install --target ./local -r requirements-dev.txt
26+
export PYTHONPATH=./local:$PYTHONPATH
2627
/opt/python/cp313-cp313/bin/python setup.py sdist bdist_wheel
2728
auditwheel repair --plat manylinux2014_aarch64 dist/awscrt-*cp313*.whl
2829

continuous-delivery/build-wheels-manylinux2014-x86_64.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ set -ex
44

55
/opt/python/cp39-cp39/bin/python ./continuous-delivery/update-version.py
66

7-
/opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
8-
auditwheel repair --plat manylinux2014_x86_64 dist/awscrt-*cp37*.whl
9-
107
/opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
118
auditwheel repair --plat manylinux2014_x86_64 dist/awscrt-*cp38*.whl
129

@@ -23,6 +20,10 @@ auditwheel repair --plat manylinux2014_x86_64 dist/awscrt-*cp311*.whl
2320
# The 3.11 wheel uses the stable ABI, so it works with newer versions too.
2421

2522
# We are using the Python 3.13 stable ABI from Python 3.13 onwards because of deprecated functions.
23+
# Manylinux images don't contain setuptools from Python 3.13, so we need to install it.
24+
# Install in a custom location due to access issues.
25+
/opt/python/cp313-cp313/bin/python -m pip install --target ./local -r requirements-dev.txt
26+
export PYTHONPATH=./local:$PYTHONPATH
2627
/opt/python/cp313-cp313/bin/python setup.py sdist bdist_wheel
2728
auditwheel repair --plat manylinux2014_x86_64 dist/awscrt-*cp313*.whl
2829

continuous-delivery/build-wheels-musllinux-1-1-aarch64.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ set -ex
44

55
/opt/python/cp39-cp39/bin/python ./continuous-delivery/update-version.py
66

7-
/opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
8-
auditwheel repair --plat musllinux_1_1_aarch64 dist/awscrt-*cp37*.whl
9-
107
/opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
118
auditwheel repair --plat musllinux_1_1_aarch64 dist/awscrt-*cp38*.whl
129

@@ -23,6 +20,10 @@ auditwheel repair --plat musllinux_1_1_aarch64 dist/awscrt-*cp311*.whl
2320
# The 3.11 wheel uses the stable ABI, so it works with newer versions too.
2421

2522
# We are using the Python 3.13 stable ABI from Python 3.13 onwards because of deprecated functions.
23+
# Manylinux images don't contain setuptools from Python 3.13, so we need to install it.
24+
# Install in a custom location due to access issues.
25+
/opt/python/cp313-cp313/bin/python -m pip install --target ./local -r requirements-dev.txt
26+
export PYTHONPATH=./local:$PYTHONPATH
2627
/opt/python/cp313-cp313/bin/python setup.py sdist bdist_wheel
2728
auditwheel repair --plat musllinux_1_1_aarch64 dist/awscrt-*cp313*.whl
2829

continuous-delivery/build-wheels-musllinux-1-1-x86_64.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ set -ex
44

55
/opt/python/cp39-cp39/bin/python ./continuous-delivery/update-version.py
66

7-
/opt/python/cp37-cp37m/bin/python setup.py sdist bdist_wheel
8-
auditwheel repair --plat musllinux_1_1_x86_64 dist/awscrt-*cp37*.whl
9-
107
/opt/python/cp38-cp38/bin/python setup.py sdist bdist_wheel
118
auditwheel repair --plat musllinux_1_1_x86_64 dist/awscrt-*cp38*.whl
129

@@ -23,6 +20,10 @@ auditwheel repair --plat musllinux_1_1_x86_64 dist/awscrt-*cp311*.whl
2320
# The 3.11 wheel uses the stable ABI, so it works with newer versions too.
2421

2522
# We are using the Python 3.13 stable ABI from Python 3.13 onwards because of deprecated functions.
23+
# Manylinux images don't contain setuptools from Python 3.13, so we need to install it.
24+
# Install in a custom location due to access issues.
25+
/opt/python/cp313-cp313/bin/python -m pip install --target ./local -r requirements-dev.txt
26+
export PYTHONPATH=./local:$PYTHONPATH
2627
/opt/python/cp313-cp313/bin/python setup.py sdist bdist_wheel
2728
auditwheel repair --plat musllinux_1_1_x86_64 dist/awscrt-*cp313*.whl
2829

continuous-delivery/build-wheels-osx.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ set -ex
55

66
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 ./continuous-delivery/update-version.py
77

8-
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 setup.py sdist bdist_wheel
98
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3 setup.py sdist bdist_wheel
109
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 setup.py sdist bdist_wheel
1110
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 setup.py sdist bdist_wheel

continuous-delivery/build-wheels-win32.bat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11

22
"C:\Program Files (x86)\Python39-32\python.exe" .\continuous-delivery\update-version.py || goto error
33

4-
"C:\Program Files (x86)\Python37-32\python.exe" setup.py sdist bdist_wheel || goto error
54
"C:\Program Files (x86)\Python38-32\python.exe" setup.py sdist bdist_wheel || goto error
65
"C:\Program Files (x86)\Python39-32\python.exe" setup.py sdist bdist_wheel || goto error
76
"C:\Program Files (x86)\Python310-32\python.exe" setup.py sdist bdist_wheel || goto error

continuous-delivery/build-wheels-win64.bat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"C:\Program Files\Python39\python.exe" continuous-delivery\update-version.py || goto error
22

3-
"C:\Program Files\Python37\python.exe" setup.py sdist bdist_wheel || goto error
43
"C:\Program Files\Python38\python.exe" setup.py sdist bdist_wheel || goto error
54
"C:\Program Files\Python39\python.exe" setup.py sdist bdist_wheel || goto error
65
"C:\Program Files\Python310\python.exe" setup.py sdist bdist_wheel || goto error

setup.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0.
3-
43
import codecs
5-
import distutils.ccompiler
64
import glob
75
import os
86
import os.path
@@ -78,6 +76,7 @@ def determine_generator_args():
7876
if sys.platform == 'win32':
7977
try:
8078
# See which compiler python picks
79+
import distutils.ccompiler
8180
compiler = distutils.ccompiler.new_compiler()
8281
compiler.initialize()
8382

@@ -305,8 +304,12 @@ def run(self):
305304
class bdist_wheel_abi3(bdist_wheel):
306305
def get_tag(self):
307306
python, abi, plat = super().get_tag()
308-
if python.startswith("cp") and sys.version_info >= (3, 11):
309-
# on CPython, our wheels are abi3 and compatible back to 3.11
307+
# on CPython, our wheels are abi3 and compatible back to 3.11
308+
if python.startswith("cp") and sys.version_info >= (3, 13):
309+
# 3.13 deprecates PyWeakref_GetObject(), adds alternative
310+
return "cp313", "abi3", plat
311+
elif python.startswith("cp") and sys.version_info >= (3, 11):
312+
# 3.11 is the first stable ABI that has everything we need
310313
return "cp311", "abi3", plat
311314

312315
return python, abi, plat
@@ -326,6 +329,11 @@ def awscrt_ext():
326329
libraries.reverse()
327330

328331
if sys.platform == 'win32':
332+
# distutils is deprecated in Python 3.10 and removed in 3.12. However, it still works because Python defines a compatibility interface as long as setuptools is installed.
333+
# We don't have an official alternative for distutils.ccompiler as of September 2024. See: https://github.com/pypa/setuptools/issues/2806
334+
# Once that issue is resolved, we can migrate to the official solution.
335+
# For now, restrict distutils to Windows only, where it's needed.
336+
import distutils.ccompiler
329337
# the windows apis being used under the hood. Since we're static linking we have to follow the entire chain down
330338
libraries += ['Secur32', 'Crypt32', 'Advapi32', 'NCrypt', 'BCrypt', 'Kernel32', 'Ws2_32', 'Shlwapi']
331339
# Ensure that debug info is in the obj files, and that it is linked into the .pyd so that
@@ -374,7 +382,7 @@ def awscrt_ext():
374382
# rare cases where that didn't happen, so let's be explicit.
375383
extra_link_args += ['-pthread']
376384

377-
if distutils.ccompiler.get_default_compiler() != 'msvc':
385+
if sys.platform != 'win32' or distutils.ccompiler.get_default_compiler() != 'msvc':
378386
extra_compile_args += ['-Wno-strict-aliasing', '-std=gnu99']
379387

380388
# treat warnings as errors in development mode

0 commit comments

Comments
 (0)