diff --git a/.evergreen/build-mac.sh b/.evergreen/build-mac.sh index 2dd02a0fb..270c92b59 100755 --- a/.evergreen/build-mac.sh +++ b/.evergreen/build-mac.sh @@ -8,22 +8,21 @@ rm -rf validdist mkdir -p validdist mv dist/* validdist || true -for VERSION in 3.7 3.8 3.9 3.10; do - PYTHON=/Library/Frameworks/Python.framework/Versions/$VERSION/bin/python3 - rm -rf build +VERSION=${VERSION:-3.10} +PYTHON=/Library/Frameworks/Python.framework/Versions/$VERSION/bin/python3 +rm -rf build - createvirtualenv $PYTHON releasevenv - python -m pip install --upgrade wheel - python -m pip install setuptools==63.2.0 - python setup.py bdist_wheel - deactivate || true - rm -rf releasevenv +createvirtualenv $PYTHON releasevenv +python -m pip install --upgrade wheel +python -m pip install setuptools==63.2.0 +python setup.py bdist_wheel +deactivate || true +rm -rf releasevenv - # Test that each wheel is installable. - for release in dist/*; do - testinstall $PYTHON $release - mv $release validdist/ - done +# Test that each wheel is installable. +for release in dist/*; do + testinstall $PYTHON $release + mv $release validdist/ done mv validdist/* dist diff --git a/.evergreen/config.yml b/.evergreen/config.yml index a487c264a..0808cc11b 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -891,7 +891,7 @@ functions: script: | set -o xtrace ${PREPARE_SHELL} - .evergreen/release.sh + VERSION=${VERSION} ENSURE_UNIVERSAL2=${ENSURE_UNIVERSAL2} .evergreen/release.sh "upload release": - command: archive.targz_pack @@ -1046,11 +1046,30 @@ tasks: genhtml --version || true valgrind --version || true - - name: "release-mac" + - name: "release-mac-1100" + tags: ["release_tag"] + run_on: macos-1100 + commands: + - func: "build release" + vars: + VERSION: "3.10" + ENSURE_UNIVERSAL2: "1" + - func: "build release" + vars: + VERSION: "3.9" + ENSURE_UNIVERSAL2: "1" + - func: "upload release" + + - name: "release-mac-1014" tags: ["release_tag"] run_on: macos-1014 commands: - func: "build release" + vars: + VERSION: "3.7" + - func: "build release" + vars: + VERSION: "3.8" - func: "upload release" - name: "release-windows" diff --git a/tools/fail_if_no_c.py b/tools/fail_if_no_c.py index 6cb82eed5..e2e9c5252 100644 --- a/tools/fail_if_no_c.py +++ b/tools/fail_if_no_c.py @@ -17,6 +17,9 @@ Only really intended to be used by internal build scripts. """ +import glob +import os +import subprocess import sys sys.path[0:0] = [""] @@ -26,3 +29,13 @@ import pymongo # noqa: E402 if not pymongo.has_c() or not bson.has_c(): sys.exit("could not load C extensions") + +if os.environ.get("ENSURE_UNIVERSAL2") == "1": + parent_dir = os.path.dirname(pymongo.__path__[0]) + for so_file in glob.glob(f"{parent_dir}/**/*.so"): + print(f"Checking universal2 compatibility in {so_file}...") + output = subprocess.check_output(["file", so_file]) + if "arm64" not in output.decode("utf-8"): + sys.exit("Universal wheel was not compiled with arm64 support") + if "x86_64" not in output.decode("utf-8"): + sys.exit("Universal wheel was not compiled with x86_64 support")