-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild-all.py
87 lines (75 loc) · 2.54 KB
/
build-all.py
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
from pathlib import Path
from datetime import datetime
import argparse
from scripts.common import (
load_failed_compatibility,
run_command_unchecked,
save_failed_compatibility,
eprint,
)
import sys
import os
def main() -> None:
parser = argparse.ArgumentParser(description="Build all recipes.")
parser.add_argument(
"--channel",
action="append",
required=True,
help="The channels to use for building.",
)
parser.add_argument(
"--data-file",
type=Path,
default=os.environ.get("DATA_FILE"),
help="Path to where the data should be stored. Nothing will be stored if that flag is not provided.",
)
args = parser.parse_args()
base_dir = Path("recipes")
variant_config = "variants/variants.yaml"
# Load existing failed compatibility data
failed_compatibility = (
None if args.data_file is None else load_failed_compatibility(args.data_file)
)
exit_code = 0
for recipe_dir in base_dir.iterdir():
recipe_file = recipe_dir / "recipe.yaml"
if not recipe_file.is_file():
eprint(f"{recipe_dir} doesn't contain recipe.yaml")
continue
command = [
"rattler-build",
"build",
]
for channel in args.channel:
command.extend(["--channel", channel])
command.extend(
[
"--channel",
"conda-forge",
"--variant-config",
variant_config,
"--skip-existing=all",
"--recipe",
str(recipe_file),
]
)
result = run_command_unchecked(command)
if result.returncode != 0:
eprint(f"Error building recipe in {recipe_dir}: {result.stderr}")
exit_code = 1
if failed_compatibility is not None:
failed_compatibility[recipe_dir.name] = {
"failed_at": datetime.now().isoformat()
}
else:
print(f"Successfully built recipe {recipe_dir.name}")
if failed_compatibility is not None:
if recipe_dir.name in failed_compatibility:
del failed_compatibility[recipe_dir.name]
print(f"Removed {recipe_dir.name} from failed-compatibility.json")
if failed_compatibility is not None:
# Save updated failed compatibility data
save_failed_compatibility(args.data_file, failed_compatibility)
sys.exit(exit_code)
if __name__ == "__main__":
main()