Build each OSX python version in an venv (#852)

Previously only system default versions were built. Now we build
binaries for both 3.9 and 3.10
pull/845/merge
powderluv 2022-05-12 16:39:35 -07:00 committed by GitHub
parent 96f90efd16
commit d872f3e2ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 4 deletions

View File

@ -53,8 +53,8 @@ function run() {
echo ":::: Python version $(python3 --version)" echo ":::: Python version $(python3 --version)"
case "$package" in case "$package" in
torch-mlir) torch-mlir)
clean_wheels torch-mlir $python_version clean_wheels torch_mlir $python_version
build_torch_mlir build_torch_mlir torch_mlir $python_version
run_audit_wheel torch_mlir $python_version run_audit_wheel torch_mlir $python_version
;; ;;
*) *)
@ -67,12 +67,20 @@ function run() {
} }
function build_torch_mlir() { function build_torch_mlir() {
python -m pip install -r $repo_root/requirements.txt --extra-index-url https://download.pytorch.org/whl/nightly/cpu local wheel_basename="$1"
local python_version="$2"
rm -rf $output_dir/build_venv
python${python_version} -m venv $output_dir/build_venv
source $output_dir/build_venv/bin/activate
python${python_version} -m pip install -U pip
python${python_version} -m pip install -r $repo_root/requirements.txt --extra-index-url https://download.pytorch.org/whl/nightly/cpu
CMAKE_GENERATOR=Ninja \ CMAKE_GENERATOR=Ninja \
TORCH_MLIR_PYTHON_PACKAGE_VERSION=${TORCH_MLIR_PYTHON_PACKAGE_VERSION} \ TORCH_MLIR_PYTHON_PACKAGE_VERSION=${TORCH_MLIR_PYTHON_PACKAGE_VERSION} \
MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET \ MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET \
CMAKE_OSX_ARCHITECTURES=$CMAKE_OSX_ARCHITECTURES \ CMAKE_OSX_ARCHITECTURES=$CMAKE_OSX_ARCHITECTURES \
python -m pip wheel -v -w $output_dir $repo_root --extra-index-url https://download.pytorch.org/whl/nightly/cpu python${python_version} -m pip wheel -v -w $output_dir $repo_root --extra-index-url https://download.pytorch.org/whl/nightly/cpu
deactivate
rm -rf $output_dir/build_venv
} }
function clean_wheels() { function clean_wheels() {