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

Function create_build_dir

ci/util/create_build_dir.py:262–506  ·  view source on GitHub ↗

Create the build directory for the given board.

(
    board: Board,
    defines: list[str],
    customsdk: Optional[str],
    no_install_deps: bool,
    extra_packages: list[str],
    build_dir: Optional[str],
    board_dir: Optional[str],
    build_flags: Optional[list[str]],
    extra_scripts: Optional[str],
)

Source from the content-addressed store, hash-verified

260
261
262def create_build_dir(
263 board: Board,
264 defines: list[str],
265 customsdk: Optional[str],
266 no_install_deps: bool,
267 extra_packages: list[str],
268 build_dir: Optional[str],
269 board_dir: Optional[str],
270 build_flags: Optional[list[str]],
271 extra_scripts: Optional[str],
272) -> tuple[bool, str]:
273 """Create the build directory for the given board."""
274 import threading
275
276 # filter out "web" board because it's not a real board.
277 if board.board_name == "web":
278 locked_print(f"Skipping web target for board {board.board_name}")
279 return True, ""
280 if board.defines:
281 defines.extend(board.defines)
282 # remove duplicates
283 defines = list(set(defines))
284 board_name = board.board_name
285 real_board_name = board.get_real_board_name()
286 thread_id = threading.current_thread().ident
287 locked_print(
288 f"*** [Thread {thread_id}] Initializing environment for {board_name} ***"
289 )
290 # builddir = Path(build_dir) / board if build_dir else Path(".build") / board
291 build_dir = build_dir or ".build"
292 builddir = Path(build_dir) / board_name
293
294 locked_print(f"[Thread {thread_id}] Creating build directory: {builddir}")
295 try:
296 builddir.mkdir(parents=True, exist_ok=True)
297 locked_print(
298 f"[Thread {thread_id}] Successfully created build directory: {builddir}"
299 )
300 except KeyboardInterrupt as ki:
301 handle_keyboard_interrupt(ki)
302 raise
303 except Exception as e:
304 locked_print(
305 f"[Thread {thread_id}] Error creating build directory {builddir}: {e}"
306 )
307 return False, f"Failed to create build directory: {e}"
308 # if lib directory (where FastLED lives) exists, remove it. This is necessary to run on
309 # recycled build directories for fastled to update. This is a fast operation.
310 srcdir = builddir / "lib"
311 if srcdir.exists():
312 locked_print(f"[Thread {thread_id}] Removing existing lib directory: {srcdir}")
313 # STRICT: Explicit retry parameters - NO defaults allowed
314 if not robust_rmtree(srcdir, max_retries=5, delay=0.1):
315 locked_print(
316 f"[Thread {thread_id}] Warning: Failed to remove lib directory {srcdir}, continuing anyway"
317 )
318
319 platformio_ini = builddir / "platformio.ini"

Callers 1

concurrent_runFunction · 0.90

Calls 14

locked_printFunction · 0.90
listClass · 0.85
robust_rmtreeFunction · 0.85
safe_file_removalFunction · 0.85
_install_global_packageFunction · 0.85
insert_tool_aliasesFunction · 0.85
get_real_board_nameMethod · 0.80
setClass · 0.50
appendMethod · 0.45
resolveMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected