Skip to content

Commit 086936c

Browse files
committed
Allow Windows x64 wheels to be built with python -m build (pytorch#6888)
1 parent e521879 commit 086936c

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: ""
@@ -232,23 +242,41 @@ jobs:
232242
${CONDA_RUN} ${ENV_SCRIPT} python setup.py clean
233243
fi
234244
fi
235-
- name: Build the wheel (bdist_wheel) X64
245+
- name: Set PYTORCH_VERSION on x64
236246
if: inputs.architecture == 'x64'
237247
working-directory: ${{ inputs.repository }}
238-
env:
239-
ENV_SCRIPT: ${{ inputs.env-script }}
240-
BUILD_PARAMS: ${{ inputs.wheel-build-params }}
241248
run: |
242249
source "${BUILD_ENV_FILE}"
243-
244250
if [[ "$CU_VERSION" == "cpu" ]]; then
245251
# CUDA and CPU are ABI compatible on the CPU-only parts, so strip
246252
# in this case
247253
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
248254
else
249255
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//')"
250256
fi
251-
257+
- name: Build the wheel (python-build-package) X64
258+
if: ${{ inputs.build-platform == 'python-build-package' && inputs.architecture == 'x64' }}
259+
working-directory: ${{ inputs.repository }}
260+
env:
261+
ENV_SCRIPT: ${{ inputs.env-script }}
262+
BUILD_PARAMS: ${{ inputs.wheel-build-params }}
263+
run: |
264+
source "${BUILD_ENV_FILE}"
265+
${CONDA_RUN} python -m pip install build==1.2.2
266+
echo "Successfully installed Python build package"
267+
if [[ -z "${ENV_SCRIPT}" ]]; then
268+
${CONDA_RUN} ${{ inputs.build-command }}
269+
else
270+
${CONDA_RUN} ${ENV_SCRIPT} ${{ inputs.build-command }}
271+
fi
272+
- name: Build the wheel (setup-py) X64
273+
if: ${{ inputs.build-platform == 'setup-py' && inputs.architecture == 'x64' }}
274+
working-directory: ${{ inputs.repository }}
275+
env:
276+
ENV_SCRIPT: ${{ inputs.env-script }}
277+
BUILD_PARAMS: ${{ inputs.wheel-build-params }}
278+
run: |
279+
source "${BUILD_ENV_FILE}"
252280
if [[ -z "${ENV_SCRIPT}" ]]; then
253281
${CONDA_RUN} python setup.py bdist_wheel
254282
else

0 commit comments

Comments
 (0)