Skip to content

Commit 2e84284

Browse files
authored
Allow Windows x64 wheels to be built with python -m build (#6888)
1 parent c6350b8 commit 2e84284

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

.github/workflows/build_wheels_windows.yml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ on:
4747
description: "Name of the actual python package that is imported"
4848
default: ""
4949
type: string
50+
build-platform:
51+
description: Platform to build wheels, choose from 'python-build-package' or 'setup-py'
52+
required: false
53+
type: string
54+
default: 'setup-py'
55+
build-command:
56+
description: The build command to use if build-platform is python-build-package
57+
required: false
58+
default: "python -m build --wheel"
59+
type: string
5060
trigger-event:
5161
description: "Trigger Event in caller that determines whether or not to upload"
5262
default: ""
@@ -224,23 +234,41 @@ jobs:
224234
${CONDA_RUN} ${ENV_SCRIPT} python setup.py clean
225235
fi
226236
fi
227-
- name: Build the wheel (bdist_wheel) X64
237+
- name: Set PYTORCH_VERSION on x64
228238
if: inputs.architecture == 'x64'
229239
working-directory: ${{ inputs.repository }}
230-
env:
231-
ENV_SCRIPT: ${{ inputs.env-script }}
232-
BUILD_PARAMS: ${{ inputs.wheel-build-params }}
233240
run: |
234241
source "${BUILD_ENV_FILE}"
235-
236242
if [[ "$CU_VERSION" == "cpu" ]]; then
237243
# CUDA and CPU are ABI compatible on the CPU-only parts, so strip
238244
# in this case
239245
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
240246
else
241247
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//')"
242248
fi
243-
249+
- name: Build the wheel (python-build-package) X64
250+
if: ${{ inputs.build-platform == 'python-build-package' && inputs.architecture == 'x64' }}
251+
working-directory: ${{ inputs.repository }}
252+
env:
253+
ENV_SCRIPT: ${{ inputs.env-script }}
254+
BUILD_PARAMS: ${{ inputs.wheel-build-params }}
255+
run: |
256+
source "${BUILD_ENV_FILE}"
257+
${CONDA_RUN} python -m pip install build==1.2.2
258+
echo "Successfully installed Python build package"
259+
if [[ -z "${ENV_SCRIPT}" ]]; then
260+
${CONDA_RUN} ${{ inputs.build-command }}
261+
else
262+
${CONDA_RUN} ${ENV_SCRIPT} ${{ inputs.build-command }}
263+
fi
264+
- name: Build the wheel (setup-py) X64
265+
if: ${{ inputs.build-platform == 'setup-py' && inputs.architecture == 'x64' }}
266+
working-directory: ${{ inputs.repository }}
267+
env:
268+
ENV_SCRIPT: ${{ inputs.env-script }}
269+
BUILD_PARAMS: ${{ inputs.wheel-build-params }}
270+
run: |
271+
source "${BUILD_ENV_FILE}"
244272
if [[ -z "${ENV_SCRIPT}" ]]; then
245273
${CONDA_RUN} python setup.py bdist_wheel
246274
else

0 commit comments

Comments
 (0)