Protobuf now ships with a macOS arm64 wheel

This commit is contained in:
Damien Elmes 2022-10-21 21:13:02 +10:00
parent f1fb070dd9
commit 22f54c2c01
3 changed files with 2 additions and 24 deletions

View file

@ -35,7 +35,6 @@ cargo_target = output_root / f"target-{platform.machine()}"
artifacts = output_root / "artifacts" artifacts = output_root / "artifacts"
pyo3_config = output_root / "pyo3-build-config-file.txt" pyo3_config = output_root / "pyo3-build-config-file.txt"
pyoxidizer_folder = bazel_external / "pyoxidizer" pyoxidizer_folder = bazel_external / "pyoxidizer"
arm64_protobuf_wheel = bazel_external / "protobuf_wheel_mac_arm64"
pyoxidizer_binary = cargo_target / "release" / with_exe_extension("pyoxidizer") pyoxidizer_binary = cargo_target / "release" / with_exe_extension("pyoxidizer")
for path in dist_folder.glob("*.zst"): for path in dist_folder.glob("*.zst"):
@ -64,7 +63,7 @@ elif sys.platform.startswith("darwin"):
else: else:
pyqt5_folder_name = "pyqt514" pyqt5_folder_name = "pyqt514"
os.environ["TARGET"] = "x86_64-apple-darwin" os.environ["TARGET"] = "x86_64-apple-darwin"
os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.13" os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.14"
else: else:
is_lin = True is_lin = True
if platform.machine() == "x86_64": if platform.machine() == "x86_64":
@ -133,17 +132,8 @@ def install_wheels_into_venv():
buf = f.read() buf = f.read()
with open(constraints, "w") as f: with open(constraints, "w") as f:
extracted = re.findall("^(\S+==\S+) ", buf, flags=re.M) extracted = re.findall("^(\S+==\S+) ", buf, flags=re.M)
extracted = [ extracted = [line for line in extracted if "protobuf" not in line]
line for line in extracted if not arm64_mac or "protobuf" not in line
]
f.write("\n".join(extracted)) f.write("\n".join(extracted))
# pypi protobuf lacks C extension on darwin-arm64, so we have to use a version
# we built ourselves
if arm64_mac:
wheels = glob.glob(str(arm64_protobuf_wheel / "*.whl"))
subprocess.run(
[pip, "install", "--upgrade", "-c", constraints, *wheels], check=True
)
# install wheels and upgrade any deps # install wheels and upgrade any deps
wheels = glob.glob(str(workspace / ".bazel" / "out" / "dist" / "*.whl")) wheels = glob.glob(str(workspace / ".bazel" / "out" / "dist" / "*.whl"))
subprocess.run( subprocess.run(

View file

@ -194,16 +194,6 @@ exports_files(["l10n.toml"])
sha256 = "0815a601baba05e03bc36b568cdc2332b1cf4aa17125fc33c69de125f8dd687f", sha256 = "0815a601baba05e03bc36b568cdc2332b1cf4aa17125fc33c69de125f8dd687f",
) )
maybe(
http_archive,
name = "protobuf_wheel_mac_arm64",
build_file_content = " ",
urls = [
"https://github.com/ankitects/anki-bundle-extras/releases/download/anki-2022-02-09/protobuf-wheel-mac-arm64.tar",
],
sha256 = "401d1cd6d949af463b3945f0d5dc887185b27fa5478cb6847bf94f680ea797b4",
)
maybe( maybe(
http_archive, http_archive,
name = "audio_mac_amd64", name = "audio_mac_amd64",

View file

@ -27,8 +27,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else else
bazel query @audio_mac_arm64//:* > /dev/null bazel query @audio_mac_arm64//:* > /dev/null
bazel query @pyqt6.4_mac_bundle_arm64//:* > /dev/null bazel query @pyqt6.4_mac_bundle_arm64//:* > /dev/null
bazel query @protobuf_wheel_mac_arm64//:* > /dev/null
fi fi
else else
bazel query @pyqt515//:* > /dev/null bazel query @pyqt515//:* > /dev/null