Skip to content

Commit 6771ac3

Browse files
committed
windows: support building CPython 3.10
1 parent 774b41c commit 6771ac3

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

.github/workflows/windows.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
py:
4242
- 'cpython-3.8'
4343
- 'cpython-3.9'
44+
- 'cpython-3.10'
4445
vcvars:
4546
- 'vcvars32.bat'
4647
- 'vcvars64.bat'
@@ -94,6 +95,12 @@ jobs:
9495
path: dist/*
9596

9697
install-only:
98+
strategy:
99+
fail-fast: false
100+
matrix:
101+
version:
102+
- '3.9'
103+
- '3.10'
97104
needs:
98105
- build
99106
runs-on: 'ubuntu-20.04'
@@ -110,7 +117,7 @@ jobs:
110117
- name: Download Python
111118
uses: actions/download-artifact@v2
112119
with:
113-
name: cpython-3.9-vcvars64.bat
120+
name: 'cpython-${{ matrix.version }}-vcvars64.bat'
114121

115122
- name: Repack Distribution
116123
run: |
@@ -119,5 +126,5 @@ jobs:
119126
- name: Upload Distribution
120127
uses: actions/upload-artifact@v2
121128
with:
122-
name: cpython-install-only
129+
name: 'cpython-install-only-${{ matrix.version }}'
123130
path: cpython-*.tar.gz

cpython-windows/build.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,17 @@ def hack_project_files(
887887
br'<ClInclude Include="$(lzmaDir)windows\vs2017\config.h" />',
888888
)
889889

890+
# Our logic for rewriting extension projects gets confused by _sqlite.vcxproj not
891+
# having a `<PreprocessorDefinitions>` line in 3.10+. So adjust that.
892+
try:
893+
static_replace_in_file(
894+
pcbuild_path / "_sqlite3.vcxproj",
895+
br"<AdditionalIncludeDirectories>$(sqlite3Dir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>",
896+
b"<AdditionalIncludeDirectories>$(sqlite3Dir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r\n <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>",
897+
)
898+
except NoSearchStringError:
899+
pass
900+
890901
# Our custom OpenSSL build has applink.c in a different location
891902
# from the binary OpenSSL distribution. Update it.
892903
ssl_proj = pcbuild_path / "_ssl.vcxproj"
@@ -1710,6 +1721,7 @@ def collect_python_build_artifacts(
17101721
"_testinternalcapi",
17111722
"_testmultiphase",
17121723
"xxlimited",
1724+
"xxlimited_35",
17131725
}
17141726

17151727
other_projects = {"pythoncore"}
@@ -2398,7 +2410,7 @@ def main():
23982410
parser = argparse.ArgumentParser()
23992411
parser.add_argument(
24002412
"--python",
2401-
choices={"cpython-3.8", "cpython-3.9"},
2413+
choices={"cpython-3.8", "cpython-3.9", "cpython-3.10"},
24022414
default="cpython-3.9",
24032415
help="Python distribution to build",
24042416
)

src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ const PE_ALLOWED_LIBRARIES: &[&str] = &[
9999
"libffi-7.dll",
100100
"libssl-1_1.dll",
101101
"libssl-1_1-x64.dll",
102+
"python3.dll",
102103
"python38.dll",
103104
"python39.dll",
105+
"python310.dll",
104106
"sqlite3.dll",
105107
"tcl86t.dll",
106108
"tk86t.dll",

0 commit comments

Comments
 (0)