Skip to content

Commit 7c40f7c

Browse files
committed
Copy auditwheel wrapper from python-lxns
It adds ability to override architecture for auditwheel.
1 parent bd9c5bd commit 7c40f7c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

wheel-build/audit_wheel_wrapper.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# SPDX-License-Identifier: MPL-2.0
2+
# SPDX-FileCopyrightText: 2024 igo95862
3+
from __future__ import annotations
4+
5+
from argparse import ArgumentParser
6+
from unittest.mock import patch
7+
8+
from auditwheel.main import main as auditwheel_main # type: ignore
9+
10+
11+
def main(arch: str, wrapped_args: list[str]) -> None:
12+
with patch("sys.argv", [""] + wrapped_args), patch(
13+
"platform.machine", return_value=arch
14+
):
15+
auditwheel_main()
16+
17+
18+
if __name__ == "__main__":
19+
arg_parse = ArgumentParser()
20+
arg_parse.add_argument(
21+
"--arch",
22+
choices=("x86_64", "i686", "aarch64", "armv7l"),
23+
default="x86_64",
24+
)
25+
arg_parse.add_argument("wrapped_args", nargs="*")
26+
27+
main(**vars(arg_parse.parse_args()))

0 commit comments

Comments
 (0)