Skip to content

Commit ed852a6

Browse files
authored
Merge branch 'main' into try-shorten-cross-compile-command
2 parents 3f0903c + 420e4a5 commit ed852a6

File tree

6 files changed

+51
-66
lines changed

6 files changed

+51
-66
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
25+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"]
2626
architecture: ["x64", "x86"]
2727

2828
steps:
@@ -97,7 +97,8 @@ jobs:
9797
strategy:
9898
fail-fast: false
9999
matrix:
100-
python-version: ["3.10", "3.11", "3.12", "3.13"]
100+
# pythonarm64 NuGet's has no download for Python ~=3.9.11
101+
python-version: ["3.9.10", "3.10", "3.11", "3.12", "3.13", "3.14-dev"]
101102
steps:
102103
- uses: actions/checkout@v4
103104

@@ -196,7 +197,7 @@ jobs:
196197
strategy:
197198
fail-fast: false
198199
matrix:
199-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
200+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"]
200201
steps:
201202
- uses: actions/checkout@v4
202203
- uses: actions/setup-python@v5

CHANGES.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Notable changes in recent builds.
1+
Notable changes in recent builds.
22

33
Maintained by hand, so what's "notable" is subjective! Contributors are
44
encouraged to add entries for their work.

build_env.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This describes how to setup the build environment for pywin32.
44

55
Double check the compiler version you need in the [Python wiki](https://wiki.python.org/moin/WindowsCompilers)
6-
but note that Python 3.5 -> 3.13 all use version 14.X of the compiler, which,
6+
but note that Python 3.5+ all use version 14.X of the compiler, which,
77
confusingly, report themselves as V.19XX (eg, note in Python's banner,
88
3.5's "MSC v.1900", even 3.9b4's "MSC v.1924")
99

make_all.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ py -3.12 -m build --wheel
2525
py -3.13-32 -m build --wheel
2626
py -3.13 -m build --wheel
2727

28+
py -3.14-32 -m build --wheel
29+
py -3.14 -m build --wheel
30+
2831
rem Check /build_env.md#build-environment to make sure you have all the required ARM64 components installed
2932
py -3.10 -m build --wheel --config-setting=--build-option="build_ext --plat-name=win-arm64 build --plat-name=win-arm64 bdist_wheel --plat-name=win-arm64"
3033
py -3.11 -m build --wheel --config-setting=--build-option="build_ext --plat-name=win-arm64 build --plat-name=win-arm64 bdist_wheel --plat-name=win-arm64"
3134
py -3.12 -m build --wheel --config-setting=--build-option="build_ext --plat-name=win-arm64 build --plat-name=win-arm64 bdist_wheel --plat-name=win-arm64"
3235
py -3.13 -m build --wheel --config-setting=--build-option="build_ext --plat-name=win-arm64 build --plat-name=win-arm64 bdist_wheel --plat-name=win-arm64"
36+
py -3.14 -m build --wheel --config-setting=--build-option="build_ext --plat-name=win-arm64 build --plat-name=win-arm64 bdist_wheel --plat-name=win-arm64"
3337

3438
@goto xit
3539
:couldnt_rm

pyproject.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
[build-system]
2-
# As of setuptools==74, we no longer need to
3-
# be concerned about distutils calling win32api
4-
# setuptools==76.1 breaks building of .mc files
5-
# win32/src/PythonService.cpp(49): fatal error C1083: Cannot open include file: 'PythonServiceMessages.h': No such file or directory
6-
requires = ["setuptools>=74,<76.1"]
2+
# setuptools==77.0.3 made PEP-639 license deprecations introduced by 77.0.0 into warnings rather than errors
3+
# setuptools==75.4 dropped support for Python 3.8
4+
requires = [
5+
"setuptools >=77.0.3; python_version >='3.9'",
6+
"setuptools <76.1; python_version <'3.9'",
7+
]
78
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 35 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
from collections.abc import MutableSequence
3737
from pathlib import Path
3838
from setuptools import Extension, setup
39+
from setuptools._distutils import ccompiler
3940
from setuptools.command.build import build
40-
from setuptools.command.build_ext import build_ext
4141
from setuptools.modified import newer_group
4242
from tempfile import gettempdir
4343
from typing import TYPE_CHECKING, Iterable
@@ -53,6 +53,21 @@
5353
from distutils._msvccompiler import MSVCCompiler
5454
from distutils.command.install_data import install_data
5555

56+
57+
def my_new_compiler(**kw):
58+
if "compiler" in kw and kw["compiler"] in (None, "msvc"):
59+
return my_compiler()
60+
return orig_new_compiler(**kw)
61+
62+
63+
# No way to cleanly wedge our compiler sub-class in.
64+
orig_new_compiler = ccompiler.new_compiler
65+
ccompiler.new_compiler = my_new_compiler # type: ignore[assignment] # Assuming the caller will always use only kwargs
66+
67+
68+
# This import has to be delayed to AFTER the compiler hack
69+
from setuptools.command.build_ext import build_ext # noqa: E402
70+
5671
build_id_patch = build_id
5772
if not "." in build_id_patch:
5873
build_id_patch += ".0"
@@ -583,6 +598,24 @@ def build_extensions(self):
583598
print("-- compiler.library_dirs:", self.compiler.library_dirs)
584599
raise RuntimeError("Too many extensions skipped, check build environment")
585600

601+
for ext in [*self.extensions, *W32_exe_files]:
602+
# Stamp the version of the built target.
603+
# Do this externally to avoid suddenly dragging in the
604+
# modules needed by this process, and which we will soon try and update.
605+
ext_path = self.get_ext_fullpath(ext.name)
606+
self.spawn(
607+
[
608+
sys.executable,
609+
Path(__file__).parent / "win32" / "Lib" / "win32verstamp.py",
610+
f"--version={pywin32_version}",
611+
"--comments=https://github.com/mhammond/pywin32",
612+
f"--original-filename={os.path.basename(ext_path)}",
613+
"--product=PyWin32",
614+
"--quiet" if "-v" not in sys.argv else "",
615+
ext_path,
616+
]
617+
)
618+
586619
# Not sure how to make this completely generic, and there is no
587620
# need at this stage.
588621
self._build_scintilla()
@@ -856,62 +889,7 @@ def swig_sources(self, sources, ext=None):
856889
return new_sources
857890

858891

859-
def my_new_compiler(**kw):
860-
if "compiler" in kw and kw["compiler"] in (None, "msvc"):
861-
return my_compiler()
862-
return orig_new_compiler(**kw)
863-
864-
865-
# No way to cleanly wedge our compiler sub-class in.
866-
orig_new_compiler = ccompiler.new_compiler
867-
ccompiler.new_compiler = my_new_compiler # type: ignore[assignment] # Assuming the caller will always use only kwargs
868-
869-
870892
class my_compiler(MSVCCompiler):
871-
def link(
872-
self,
873-
target_desc,
874-
objects,
875-
output_filename,
876-
output_dir=None,
877-
libraries=None,
878-
library_dirs=None,
879-
runtime_library_dirs=None,
880-
export_symbols=None,
881-
debug=0,
882-
*args,
883-
**kw,
884-
):
885-
super().link(
886-
target_desc,
887-
objects,
888-
output_filename,
889-
output_dir,
890-
libraries,
891-
library_dirs,
892-
runtime_library_dirs,
893-
export_symbols,
894-
debug,
895-
*args,
896-
**kw,
897-
)
898-
# Here seems a good place to stamp the version of the built
899-
# target. Do this externally to avoid suddenly dragging in the
900-
# modules needed by this process, and which we will soon try and
901-
# update.
902-
args = [
903-
sys.executable,
904-
# NOTE: On Python 3.7, all args must be str
905-
str(Path(__file__).parent / "win32" / "Lib" / "win32verstamp.py"),
906-
f"--version={pywin32_version}",
907-
"--comments=https://github.com/mhammond/pywin32",
908-
f"--original-filename={os.path.basename(output_filename)}",
909-
"--product=PyWin32",
910-
"--quiet" if "-v" not in sys.argv else "",
911-
output_filename,
912-
]
913-
self.spawn(args)
914-
915893
# Work around bpo-36302/bpo-42009 - it sorts sources but this breaks
916894
# support for building .mc files etc :(
917895
def compile(self, sources, **kwargs):
@@ -2030,6 +2008,7 @@ def convert_optional_data_files(files):
20302008
"Programming Language :: Python :: 3.11",
20312009
"Programming Language :: Python :: 3.12",
20322010
"Programming Language :: Python :: 3.13",
2011+
"Programming Language :: Python :: 3.14",
20332012
"Programming Language :: Python :: Implementation :: CPython",
20342013
]
20352014

0 commit comments

Comments
 (0)