PYTHON-3424 PyMongo Universal Wheels Are Improperly Compiled (#1051)

This commit is contained in:
Steven Silvester 2022-09-12 19:14:50 -05:00 committed by GitHub
parent e3ff041b47
commit 1019c91bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 16 deletions

View File

@ -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

View File

@ -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"

View File

@ -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")