-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathci-docker
executable file
·67 lines (62 loc) · 2.15 KB
/
ci-docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python3
from argparse import ArgumentParser
import os
import platform
import subprocess
import sys
from docker.config import load_config
def main():
parser = ArgumentParser()
parser.add_argument("--arch", action="append")
parser.add_argument("--keep-going", action="store_true")
parser.add_argument("--python", action="append")
args, rest = parser.parse_known_args()
arches = args.arch
if arches is None:
arches = load_config().arches
else:
arches = [arch for arch in load_config().arches if arch[0] in arches]
name_tags = args.python
if name_tags is None:
name_tags = [name_tag for _, name_tag, _, _, _, _ in load_config().pythons]
basedir = os.path.dirname(__file__)
failures = []
for arch, triple in arches:
for name_tag in name_tags:
if arch == platform.machine():
cross = ()
else:
cross = (
f"--host={arch}",
f"--host-python=/usr/{triple}/{name_tag}/bin/python3",
"--skip-tests",
)
argv = [
"./in-docker",
f"--arch={arch}",
f"--python-version={name_tag}",
"--",
"env",
f"CC={triple}-gcc",
f"HOST={triple}",
f"OBJDUMP={triple}-objdump",
"LC_ALL=C.UTF-8",
"LANG=C.UTF-8",
f"/opt/{name_tag}/bin/python3",
"ci",
f"--python=/opt/{name_tag}/bin/python3",
*cross,
"-DBoost_USE_STATIC_LIBS=ON",
"-DCMAKE_MODULE_LINKER_FLAGS=-static-libgcc -static-libstdc++",
] + rest
returncode = subprocess.call(argv, cwd=basedir)
if returncode != 0:
failures.append((arch, name_tag))
if not args.keep_going:
raise subprocess.CalledProcessError(returncode, argv)
for arch, name_tag in failures:
print(f"Failed: {arch} {name_tag}")
if len(failures) > 0:
sys.exit(1)
if __name__ == "__main__":
main()