Skip to content

Commit 2fb45fd

Browse files
committed
Shorten --config-setting=--build-option commands
1 parent 8258348 commit 2fb45fd

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ jobs:
114114
run: pip install --upgrade build
115115

116116
- name: Obtain ARM64 library files
117-
run: python .github\workflows\download-arm64-libs.py .\arm64libs
117+
run: python .github\workflows\download-arm64-libs.py ./arm64libs
118118

119119
- name: Build wheels
120-
run: python -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=-L.\arm64libs --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64
120+
run: python -m build --wheel --config-setting=--build-option="build_ext -L./arm64libs --plat-name=win-arm64 build --plat-name=win-arm64 bdist_wheel --plat-name=win-arm64"
121121

122122
- uses: actions/upload-artifact@v4
123123
with:
@@ -157,7 +157,8 @@ jobs:
157157
with:
158158
version: "0.8.4"
159159
- run: ruff format --check
160-
- run: | # Too many files to fit in a single command, also exclude vendored Scintilla and MAPIStubLibrary
160+
# Too many files to fit in a single command, also exclude vendored Scintilla and MAPIStubLibrary
161+
- run: |
161162
clang-format --Werror --dry-run $(git ls-files '*.cpp' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
162163
if ($LastExitCode -ne 0) { exit $LastExitCode }
163164
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')

build_env.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,32 +137,31 @@ configuration, please [open an issue](https://github.com/mhammond/pywin32/issues
137137
- Follow the `For Visual Studio XXXX` instructions above and pick the optional ARM64 build tools
138138

139139
- Download prebuilt Python ARM64 binaries to a temporary location on your machine. You will need this location in a later step.
140+
- This script downloads a Python ARM64 build [from NuGet](https://www.nuget.org/packages/pythonarm64/#versions-tab) that matches the version you used to run it.
140141

141142
```shell
142-
python .github\workflows\download-arm64-libraries.py "<temporary path>"
143+
python .github\workflows\download-arm64-libs.py ./arm64libs
143144
```
144145

145-
- This script downloads a Python ARM64 build [from NuGet](https://www.nuget.org/packages/pythonarm64/#versions-tab) that matches the version you used to run it.
146146
- Setup the cross-compilation environment:
147147

148148
```shell
149149
"C:\Program Files (x86)\Microsoft Visual Studio\XXXX\BuildTools\vc\Auxiliary\Build\vcvarsall.bat" x86_arm64
150150
```
151151

152-
- Update `setuptools` and set the following environment variables to ensure it is used:
152+
- Set the following environment variables to ensure it is used by `setuptools`:
153153

154154
```shell
155155
set DISTUTILS_USE_SDK=1
156156
```
157157

158158
- Build the extensions, passing the directory from earlier. You may optionally add the `bdist_wheel` command to generate a wheel.
159+
- If you are not using an initialized build environment, you will need to specify the `build_ext`, `build` and `bdist_wheel` commands and pass `--plat-name win-arm64` to *each* of them separately. Otherwise you may get a mixed platform build and/or linker errors.
159160

160161
```shell
161-
python -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=-L.\arm64libs --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64
162+
python -m build --wheel --config-setting=--build-option="build_ext -L./arm64libs --plat-name=win-arm64 bdist_wheel --plat-name=win-arm64"
162163
```
163164

164-
- If you are not using an initialized build environment, you will need to specify the `build_ext`, `build` and `bdist_wheel` commands and pass `--plat-name win-arm64` to *each* of them separately. Otherwise you may get a mixed platform build and/or linker errors.
165-
166165
- Copy the built wheel to the target machine and install directly:
167166

168167
```shell

make_all.bat

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ py -3.13-32 -m build --wheel
2626
py -3.13 -m build --wheel
2727

2828
rem Check /build_env.md#build-environment to make sure you have all the required ARM64 components installed
29-
py -3.10 -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64
30-
py -3.11 -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64
31-
py -3.12 -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64
32-
py -3.13 -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64
29+
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"
30+
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"
31+
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"
32+
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"
3333

3434
@goto xit
3535
:couldnt_rm

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
1414
For a debug (_d) version, you need a local debug build of Python, but must use
1515
the release version executable for the build. eg:
16-
pip install . -v --config-setting=--build-option=build --config-setting=--build-option=--debug
16+
pip install . -v --config-setting=--build-option="build --debug"
1717
1818
Cross-compilation from x86 to ARM is well supported (assuming installed vs tools etc) - eg:
19-
python -m build --wheel --config-setting=--build-option=build_ext --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=build --config-setting=--build-option=--plat-name=win-arm64 --config-setting=--build-option=bdist_wheel --config-setting=--build-option=--plat-name=win-arm64
19+
python -m build --wheel --config-setting=--build-option="build_ext --plat-name=win-arm64 build --plat-name=win-arm64 bdist_wheel --plat-name=win-arm64"
2020
2121
Some modules require special SDKs or toolkits to build (eg, mapi/exchange),
2222
which often aren't available in CI. The build process treats them as optional -

0 commit comments

Comments
 (0)