Skip to content

Commit

Permalink
Allow build package to build M1 wheels (#5729)
Browse files Browse the repository at this point in the history
This PR enable the build of M1 wheels to rely on `python -m build`
instead of `python setup.py`. The default is still `python setup.py`.
This is the same as #5071 and
#5076 that were landed for
linux wheels.

We need this for torchcodec to support M1 wheels
pytorch/torchcodec#230

CC @scotts @atalman
  • Loading branch information
NicolasHug authored Oct 1, 2024
1 parent a73eb0b commit 9aa668e
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion .github/workflows/build_wheels_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ on:
description: "Name of the actual python package that is imported"
default: ""
type: string
build-platform:
description: Platform to build wheels, choose from 'python-build-package' or 'setup-py'
required: false
type: string
default: 'setup-py'
build-command:
description: The build command to use if build-platform is python-build-package
required: false
default: "python -m build --wheel"
type: string
env-var-script:
description: "Script that sets Domain-Specific Environment Variables"
default: ""
Expand Down Expand Up @@ -156,7 +166,27 @@ jobs:
# shellcheck disable=SC1090
source "${BUILD_ENV_FILE}"
${CONDA_RUN} python3 setup.py clean
- name: Build the wheel (bdist_wheel)
- name: Build the wheel (python-build-package)
if: ${{ inputs.build-platform == 'python-build-package' }}
working-directory: ${{ inputs.repository }}
shell: bash -l {0}
run: |
set -euxo pipefail
# shellcheck disable=SC1090
source "${BUILD_ENV_FILE}"
if [[ "${{ inputs.package-name }}" = "torchaudio" ]]; then
export USE_OPENMP="0"
fi
PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//')"
export PYTORCH_VERSION
${CONDA_RUN} python -m pip install build
echo "Successfully installed Python build package"
${CONDA_RUN} ${{ inputs.build-command }}
- name: Build the wheel (setup-py)
if: ${{ inputs.build-platform == 'setup-py' }}
working-directory: ${{ inputs.repository }}
run: |
set -euxo pipefail
Expand Down

0 comments on commit 9aa668e

Please sign in to comment.