try removing submodule symlinks (#38310)

This commit is contained in:
Adeeb Shihadeh
2026-07-08 21:11:39 -07:00
committed by GitHub
parent bf5540c364
commit b827c0f55e
12 changed files with 52 additions and 13 deletions
+7
View File
@@ -15,6 +15,13 @@ a.out
.cache/
bin/
# created at launch for TICI PYTHONPATH (PC uses editable installs via pyproject.toml)
/msgq
/opendbc
/rednose
/teleoprtc
/tinygrad
*.mp4
*.dylib
*.DSYM
+25 -4
View File
@@ -27,6 +27,24 @@ AddOption('--minimal',
default=(not TICI and not release),
help='the minimum build to run openpilot. no tests, tools, etc.')
# Package symlinks are no longer tracked in git (created at launch on device).
# Create them here so PYTHONPATH-based imports find in-tree packages and
# Cython extensions during the build (especially release builds).
_repo_root = Dir('#').abspath
for _pkg, _target in (
('msgq', 'msgq_repo/msgq'),
('opendbc', 'opendbc_repo/opendbc'),
('rednose', 'rednose_repo/rednose'),
('teleoprtc', 'teleoprtc_repo/teleoprtc'),
('tinygrad', 'tinygrad_repo/tinygrad'),
):
_link = os.path.join(_repo_root, _pkg)
if os.path.lexists(_link):
if os.path.islink(_link) and os.readlink(_link) == _target:
continue
os.unlink(_link)
os.symlink(_target, _link)
# Detect platform
arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
if platform.system() == "Darwin":
@@ -128,7 +146,10 @@ env = Environment(
CXXFLAGS=["-std=c++1z"],
CPPPATH=[
"#openpilot",
"#msgq",
"#msgq_repo", # #include "msgq/..."
"#opendbc_repo", # #include "opendbc/..."
"#rednose_repo", # #include "rednose/..."
"#rednose_repo/rednose", # #include "logger/..." (rednose package root)
"#openpilot/cereal/gen/cpp",
acados_include_dirs,
[x.INCLUDE_DIR for x in pkgs],
@@ -138,13 +159,13 @@ env = Environment(
"#openpilot/common",
"#msgq_repo",
"#openpilot/selfdrive/pandad",
"#rednose/helpers",
"#rednose_repo/rednose/helpers",
[x.LIB_DIR for x in pkgs],
],
RPATH=[ffmpeg.LIB_DIR] if ffmpeg_shared else [],
CYTHONCFILESUFFIX=".cpp",
COMPILATIONDB_USE_ABSPATH=True,
REDNOSE_ROOT="#",
REDNOSE_ROOT="#rednose_repo",
tools=["default", "cython", "compilation_db", "rednose_filter"],
toolpath=["#site_scons/site_tools", "#rednose_repo/site_scons/site_tools"],
)
@@ -249,7 +270,7 @@ Export('messaging')
SConscript(['panda/SConscript'])
# Build rednose library
SConscript(['rednose/SConscript'])
SConscript(['rednose_repo/rednose/SConscript'])
# Build system services
SConscript([
+8
View File
@@ -70,6 +70,14 @@ function launch {
ln -sfn $(pwd) /data/pythonpath
export PYTHONPATH="$PWD"
# submodule package symlinks for PYTHONPATH imports on device.
# on PC these come from editable installs via pyproject.toml / uv.
ln -sfn msgq_repo/msgq msgq
ln -sfn opendbc_repo/opendbc opendbc
ln -sfn rednose_repo/rednose rednose
ln -sfn teleoprtc_repo/teleoprtc teleoprtc
ln -sfn tinygrad_repo/tinygrad tinygrad
# hardware specific init
if [ -f /AGNOS ]; then
agnos_init
-1
View File
@@ -1 +0,0 @@
msgq_repo/msgq
-1
View File
@@ -1 +0,0 @@
opendbc_repo/opendbc
@@ -124,4 +124,12 @@ else
safe_checkout
fi
# submodule package symlinks for PYTHONPATH imports on device (same as launch_chffrplus.sh)
cd $TEST_DIR
ln -sfn msgq_repo/msgq msgq
ln -sfn opendbc_repo/opendbc opendbc
ln -sfn rednose_repo/rednose rednose
ln -sfn teleoprtc_repo/teleoprtc teleoprtc
ln -sfn tinygrad_repo/tinygrad tinygrad
echo "$TEST_DIR synced with $GIT_COMMIT, t=$SECONDS"
+1 -1
View File
@@ -76,7 +76,7 @@ cabana_env['CPPPATH'] += [libusb.INCLUDE_DIR]
cabana_env['LIBPATH'] += [libusb.LIB_DIR]
cabana_libs = [cereal, messaging, visionipc, replay_lib] + ffmpeg_libs + ['bz2', 'zstd', 'usb-1.0'] + base_libs
opendbc_path = '-DOPENDBC_FILE_PATH=\'"%s"\'' % (cabana_env.Dir("../../../opendbc/dbc").abspath)
opendbc_path = '-DOPENDBC_FILE_PATH=\'"%s"\'' % (cabana_env.Dir("../../../opendbc_repo/opendbc/dbc").abspath)
cabana_env['CXXFLAGS'] += [opendbc_path]
def write_assets_qrc(target, source, env):
+1 -1
View File
@@ -276,7 +276,7 @@ std::string default_dbc_template() {
DbcEditorSource resolve_dbc_editor_source(const std::string &dbc_name) {
const fs::path generated_dbc_dir = repo_root() / "openpilot" / "tools" / "jotpluggler" / "generated_dbcs";
const std::array<DbcEditorSource, 2> candidates = {{
{.path = repo_root() / "opendbc" / "dbc" / (dbc_name + ".dbc"), .kind = DbcEditorState::SourceKind::Opendbc},
{.path = repo_root() / "opendbc_repo" / "opendbc" / "dbc" / (dbc_name + ".dbc"), .kind = DbcEditorState::SourceKind::Opendbc},
{.path = generated_dbc_dir / (dbc_name + ".dbc"), .kind = DbcEditorState::SourceKind::Generated},
}};
for (const DbcEditorSource &candidate : candidates) {
+2 -2
View File
@@ -385,7 +385,7 @@ std::string detect_dbc_for_fingerprint(std::string_view car_fingerprint) {
std::vector<std::string> available_dbc_names_impl() {
std::set<std::string> names;
for (const fs::path &dbc_dir : {
repo_root() / "opendbc" / "dbc",
repo_root() / "opendbc_repo" / "opendbc" / "dbc",
repo_root() / "openpilot" / "tools" / "jotpluggler" / "generated_dbcs",
}) {
if (fs::exists(dbc_dir) && fs::is_directory(dbc_dir)) {
@@ -407,7 +407,7 @@ std::vector<std::string> available_dbc_names_impl() {
fs::path resolve_dbc_path(const std::string &dbc_name) {
for (const fs::path &candidate : {
repo_root() / "opendbc" / "dbc" / (dbc_name + ".dbc"),
repo_root() / "opendbc_repo" / "opendbc" / "dbc" / (dbc_name + ".dbc"),
repo_root() / "openpilot" / "tools" / "jotpluggler" / "generated_dbcs" / (dbc_name + ".dbc"),
}) {
if (fs::exists(candidate)) return candidate;
-1
View File
@@ -1 +0,0 @@
rednose_repo/rednose
-1
View File
@@ -1 +0,0 @@
teleoprtc_repo/teleoprtc
-1
View File
@@ -1 +0,0 @@
tinygrad_repo/tinygrad