This repository was archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBootstrapEpilog.py
More file actions
56 lines (47 loc) · 1.51 KB
/
BootstrapEpilog.py
File metadata and controls
56 lines (47 loc) · 1.51 KB
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
# ----------------------------------------------------------------------
# |
# | Copyright (c) 2024 Scientific Software Engineering Center at Georgia Tech
# | Distributed under the MIT License.
# |
# ----------------------------------------------------------------------
# pylint: disable=missing-module-docstring
import os
import subprocess
import sys
from pathlib import Path
# Parse the arguments
is_debug = False
is_force = False
is_verbose = False
is_package = False
no_cache = False
display_flags: list[str] = []
# First arg is the script name, second arg is the name of the shell script to write to
for arg in sys.argv[2:]:
if arg == "--debug":
is_debug = True
elif arg == "--force":
is_force = True
elif arg == "--verbose":
is_verbose = True
elif arg == "--package":
is_package = True
display_flags.append("package")
elif arg == "--no-cache":
no_cache = True
else:
raise Exception("'{}' is not a recognized argument.".format(arg))
if is_debug:
is_verbose = True
subprocess.run(
'pip install --disable-pip-version-check {} --editable ".[dev{}]"'.format(
"--no-cache-dir" if no_cache else "",
", package" if is_package else "",
),
check=True,
shell=True,
)
with (
Path(__file__).parent / os.environ["PYTHON_BOOTSTRAPPER_GENERATED_DIR"] / "bootstrap_flags.json"
).open("w") as f:
f.write("[{}]".format(", ".join(f'"{flag}"' for flag in display_flags)))