MCPcopy Create free account
hub / github.com/FastLED/FastLED / init

Function init

ci/tests/test_symbol_analysis.py:65–116  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63
64
65def init() -> None:
66 global _compilation_done
67
68 # Use lock to ensure only one thread runs compilation
69 with _compilation_lock:
70 if _compilation_done:
71 print("Compilation already completed by another thread, skipping.")
72 return
73
74 uno_build = PROJECT_ROOT / ".build" / "uno"
75 print(
76 f"Thread {threading.current_thread().ident}: Checking for Uno build in: {uno_build}"
77 )
78 print(f"BUILD_INFO_PATH: {BUILD_INFO_PATH}")
79 print(f"TOOLCHAIN_AVR: {TOOLCHAIN_AVR}")
80 print(f"BUILD_INFO_PATH exists: {BUILD_INFO_PATH.exists()}")
81 print(f"TOOLCHAIN_AVR exists: {TOOLCHAIN_AVR.exists()}")
82
83 if not BUILD_INFO_PATH.exists() or not TOOLCHAIN_AVR.exists():
84 print("Uno build not found. Running compilation...")
85 print(f"Working directory: {PROJECT_ROOT}")
86 try:
87 print(
88 "Starting compilation command: uv run python-m ci.ci-compile uno --examples Blink"
89 )
90 start_time = time.time()
91 result = subprocess.run(
92 "uv run python -m ci.ci-compile uno --examples Blink",
93 shell=True,
94 check=True,
95 cwd=str(PROJECT_ROOT),
96 capture_output=True,
97 text=True,
98 )
99 end_time = time.time()
100 print(
101 f"Compilation completed successfully in {end_time - start_time:.2f} seconds."
102 )
103 print(f"STDOUT: {result.stdout}")
104 if result.stderr:
105 print(f"STDERR: {result.stderr}")
106 _compilation_done = True
107 except subprocess.CalledProcessError as e:
108 print(f"Error during compilation (returncode: {e.returncode}): {e}")
109 if e.stdout:
110 print(f"STDOUT: {e.stdout}")
111 if e.stderr:
112 print(f"STDERR: {e.stderr}")
113 raise
114 else:
115 print("Uno build found, skipping compilation.")
116 _compilation_done = True
117
118
119@pytest.mark.slow

Callers 1

setUpClassMethod · 0.70

Calls 3

timeMethod · 0.80
printFunction · 0.50
runMethod · 0.45

Tested by

no test coverage detected