Skip to content

Commit

Permalink
build: fix build regression related to auditwheel>=6.1.0
Browse files Browse the repository at this point in the history
The latest auditwheel has added riscv64 manylinux ABI support, but our
build environment (and support baseline) is more recent than that,
causing our riscv64 builds to fail. For now, just probe for auditwheel
>= 6.1.0 and override the platform tag if necessary.

The pygit2 build always downloads the most recent auditwheel, so
unconditionally apply the platform tag override for it.

Link: pypa/auditwheel#504
  • Loading branch information
xen0n committed Aug 12, 2024
1 parent 3ccfae4 commit 21fb016
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/build-pygit2.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ def get_pygit2_wheel_build_env(pygit2_dir: str) -> dict[str, str]:
# this is unnecessary
del r["LIBGIT2"]

# auditwheel 6.1.0+ has manylinux policies for riscv64, but the default
# is too low for our environment
# bump it up
r["AUDITWHEEL_PLAT"] = "manylinux_2_35_riscv64"

return r


Expand Down
17 changes: 17 additions & 0 deletions scripts/build-xingque.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

import os
import platform
import shutil
import subprocess
import sys
Expand Down Expand Up @@ -114,13 +115,29 @@ def build_xingque(xingque_ver: str, workdir: str) -> str:
log(f"unpacking {xingque_src_filename}")
subprocess.run(("tar", "-xf", xingque_src_filename), cwd=workdir, check=True)

# auditwheel 6.1.0+ has manylinux policies for riscv64, but the default
# is too low for our environment
# bump it up if that's the case
# the output looks like "auditwheel 6.1.0 installed ..."
auditwheel_ver_str = subprocess.check_output(
["auditwheel", "--version"],
encoding="utf-8",
).split(" ")[1]
auditwheel_ver = [int(x) for x in auditwheel_ver_str.split(".", 2)[:2]]
if platform.machine() == "riscv64":
if auditwheel_ver[0] > 6 or (auditwheel_ver[0] == 6 and auditwheel_ver[1] >= 1):
manylinux_plat = "manylinux_2_35_riscv64"
log(f"using manylinux platform tag: {manylinux_plat}")
os.environ["AUDITWHEEL_PLAT"] = manylinux_plat

# build wheel
log("building xingque wheel", group=True)
subprocess.run(
("maturin", "build", "--release"),
cwd=xingque_workdir,
check=True,
)

maturin_out_path = os.path.join(xingque_workdir, "target", "wheels")
tmp_wheel_path = os.path.join(
maturin_out_path,
Expand Down

0 comments on commit 21fb016

Please sign in to comment.