-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathconfigure.py
More file actions
49 lines (41 loc) · 1.68 KB
/
configure.py
File metadata and controls
49 lines (41 loc) · 1.68 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
import os
CONFIG_FILE = "features.conf"
FEATURE_FLAGS_FILE = "radioactive/feature_flags.py"
def generate_flags():
print(f"Generating {FEATURE_FLAGS_FILE} from {CONFIG_FILE}...")
flags = {}
if os.path.exists(CONFIG_FILE):
with open(CONFIG_FILE, "r") as f:
for line in f:
line = line.strip()
if not line or line.startswith("#"):
continue
if "=" in line:
key, value = line.split("=", 1)
flags[key.strip()] = value.strip().lower() == "true"
else:
print(f"Warning: {CONFIG_FILE} not found. Using defaults.")
# Default flags if config is missing
flags["RECORDING_FEATURE"] = True
flags["TRACK_FEATURE"] = True
flags["SEARCH_FEATURE"] = True
flags["CYCLE_FEATURE"] = True
flags["INFO_FEATURE"] = True
flags["TIMER_FEATURE"] = True
flags["MINIMAL_FEATURE"] = False
# Apply limits if MINIMAL_FEATURE is True
if flags.get("MINIMAL_FEATURE", False):
print("MINIMAL_FEATURE is enabled. Disabling all optional features.")
flags["RECORDING_FEATURE"] = False
flags["TRACK_FEATURE"] = False
flags["SEARCH_FEATURE"] = False
flags["CYCLE_FEATURE"] = False
flags["INFO_FEATURE"] = False
flags["TIMER_FEATURE"] = False
with open(FEATURE_FLAGS_FILE, "w") as f:
f.write("# This file is auto-generated by the configure step. Do not edit manually.\n\n")
for key, value in flags.items():
f.write(f"{key} = {value}\n")
print(f"done. {FEATURE_FLAGS_FILE} is ready.")
if __name__ == "__main__":
generate_flags()