Files
pyxis/_build_helpers.py
T
torlando-agent[bot]andClaude Opus 4.8 dfc6a14f00 address greptile #38: fix standalone-exec test, drop dead var, clarify docstring, DRY hostname
- test_patch_nimble.py: the refactor made the script import its sibling
  _build_helpers; the standalone-exec test ran it with a temp PROJECT_DIR, so add
  the script's real directory to the shim's sys.path (CI pytest failure fix).
- sync_file_libdeps.py: remove the now-dead ENV_NAME binding.
- _build_helpers.py: reword the docstring (the "never literal env" line conflicted
  with the helper's own "tdeck" fallback) and note inline that "tdeck" is a
  never-hit default (PlatformIO always injects PIOENV).
- main.cpp: DRY the OTA hostname into OTA_HOSTNAME used by both setHostname() and
  the log line.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWZuYkHBRqNb6BZHV8sTG5
2026-06-23 00:11:54 -04:00

22 lines
1018 B
Python

"""Shared helpers for the PlatformIO pre-build scripts (patch_*, sync_file_libdeps).
Centralizes the per-environment libdeps path so it is computed exactly ONE way.
Each PlatformIO environment gets its OWN .pio/libdeps/<PIOENV> tree, so this path
MUST be resolved per-environment. Hardcoding the env component (e.g. "tdeck")
silently misdirects a patch when building any OTHER env -- that is exactly how the
`nimble_host_reset_reason` undefined-reference link error appeared in tdeck-ota.
Always go through env_libdeps_dir() instead of re-deriving this path in each script.
"""
import os
def env_libdeps_dir(env, *parts):
"""Path inside THIS environment's libdeps tree: .pio/libdeps/<PIOENV>/<parts...>."""
return os.path.join(
env.get("PROJECT_DIR", "."),
# "tdeck" is only a never-hit fallback (PlatformIO always injects PIOENV);
# it is NOT the per-script hardcoding the module docstring warns against.
".pio", "libdeps", env.get("PIOENV", "tdeck"),
*parts,
)