From 98de3f6f1e1ce7b24e85153a56bb99280e6adbab Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Thu, 18 Sep 2025 00:06:56 +0530 Subject: [PATCH 01/14] Removed panda submodule --- .gitmodules | 3 --- 1 file changed, 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index ad6530de9ac910..aeb57ba023ec03 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "panda"] - path = panda - url = ../../commaai/panda.git [submodule "opendbc"] path = opendbc_repo url = ../../commaai/opendbc.git From af2e35fa03eec2ee44074969bc9edd11e87728fe Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sun, 21 Sep 2025 10:30:22 +0530 Subject: [PATCH 02/14] remove panda submodule --- .gitmodules | 3 -- SConstruct | 7 ++-- panda | 1 - pyproject.toml | 1 + uv.lock | 88 ++++++++++++++++++++++++++++++++------------------ 5 files changed, 60 insertions(+), 40 deletions(-) delete mode 160000 panda diff --git a/.gitmodules b/.gitmodules index ad6530de9ac910..aeb57ba023ec03 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "panda"] - path = panda - url = ../../commaai/panda.git [submodule "opendbc"] path = opendbc_repo url = ../../commaai/opendbc.git diff --git a/SConstruct b/SConstruct index d8a390f5dfdad6..7279bb3908acc2 100644 --- a/SConstruct +++ b/SConstruct @@ -4,6 +4,7 @@ import sys import sysconfig import platform import numpy as np +import panda import SCons.Errors @@ -204,6 +205,8 @@ env = Environment( toolpath=["#site_scons/site_tools", "#rednose_repo/site_scons/site_tools"], ) +env.AppendUnique(CPPPATH=[panda.INCLUDE_PATH]) + if arch == "Darwin": # RPATH is not supported on macOS, instead use the linker flags darwin_rpath_link_flags = [f"-Wl,-rpath,{path}" for path in env["RPATH"]] @@ -327,10 +330,6 @@ Import('socketmaster', 'msgq') messaging = [socketmaster, msgq, 'capnp', 'kj',] Export('messaging') - -# Build other submodules -SConscript(['panda/SConscript']) - # Build rednose library SConscript(['rednose/SConscript']) diff --git a/panda b/panda deleted file mode 160000 index 1289337ceb6205..00000000000000 --- a/panda +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1289337ceb6205ad985a5469baa950b319329327 diff --git a/pyproject.toml b/pyproject.toml index 9c8a6148a2ec14..7c79f74cc00d99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,7 @@ dependencies = [ "sympy", # rednose + friends "crcmod", # cars + qcomgpsd "tqdm", # cars (fw_versions.py) on start + many one-off uses + "pandacan @ git+https://github.com/prayanshchh/panda@proper_pip_package", # hardwared "smbus2", # configuring amp diff --git a/uv.lock b/uv.lock index c24d9dbbbe44ca..eb94f943233816 100644 --- a/uv.lock +++ b/uv.lock @@ -639,10 +639,10 @@ name = "gymnasium" version = "1.2.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "cloudpickle" }, - { name = "farama-notifications" }, - { name = "numpy" }, - { name = "typing-extensions" }, + { name = "cloudpickle", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "farama-notifications", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "numpy", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "typing-extensions", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/fd/17/c2a0e15c2cd5a8e788389b280996db927b923410de676ec5c7b2695e9261/gymnasium-1.2.0.tar.gz", hash = "sha256:344e87561012558f603880baf264ebc97f8a5c997a957b0c9f910281145534b0", size = 821142, upload-time = "2025-06-27T08:21:20.262Z" } wheels = [ @@ -929,22 +929,22 @@ name = "metadrive-simulator" version = "0.4.2.4" source = { url = "https://github.com/commaai/metadrive/releases/download/MetaDrive-minimal-0.4.2.4/metadrive_simulator-0.4.2.4-py3-none-any.whl" } dependencies = [ - { name = "filelock" }, - { name = "gymnasium" }, - { name = "lxml" }, - { name = "matplotlib" }, - { name = "numpy" }, - { name = "opencv-python-headless" }, - { name = "panda3d" }, - { name = "panda3d-gltf" }, - { name = "pillow" }, - { name = "progressbar" }, - { name = "psutil" }, - { name = "pygments" }, - { name = "requests" }, - { name = "shapely" }, - { name = "tqdm" }, - { name = "yapf" }, + { name = "filelock", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "gymnasium", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "lxml", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "matplotlib", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "numpy", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "opencv-python-headless", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "panda3d", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "panda3d-gltf", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "pillow", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "progressbar", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "psutil", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "pygments", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "requests", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "shapely", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "tqdm", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "yapf", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] wheels = [ { url = "https://github.com/commaai/metadrive/releases/download/MetaDrive-minimal-0.4.2.4/metadrive_simulator-0.4.2.4-py3-none-any.whl", hash = "sha256:fbf0ea9be67e65cd45d38ff930e3d49f705dd76c9ddbd1e1482e3f87b61efcef" }, @@ -1252,6 +1252,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/86/8a/69176a64335aed183529207ba8bc3d329c2999d852b4f3818027203f50e6/opencv_python_headless-4.11.0.86-cp37-abi3-win_amd64.whl", hash = "sha256:6c304df9caa7a6a5710b91709dd4786bf20a74d57672b3c31f7033cc638174ca", size = 39402386, upload-time = "2025-01-16T13:52:56.418Z" }, ] +[[package]] +name = "opendbc" +version = "0.2.1" +source = { git = "https://github.com/commaai/opendbc.git?rev=master#6894a012cd7ec36678b8abd3d95dc79975d5dbe2" } +dependencies = [ + { name = "crcmod" }, + { name = "numpy" }, + { name = "pycapnp" }, + { name = "pycryptodome" }, + { name = "scons" }, + { name = "tqdm" }, +] + [[package]] name = "openpilot" version = "0.1.0" @@ -1270,6 +1283,7 @@ dependencies = [ { name = "libusb1" }, { name = "numpy" }, { name = "onnx" }, + { name = "pandacan" }, { name = "psutil" }, { name = "pyaudio" }, { name = "pycapnp" }, @@ -1373,6 +1387,7 @@ requires-dist = [ { name = "numpy", specifier = ">=2.0" }, { name = "onnx", specifier = ">=1.14.0" }, { name = "opencv-python-headless", marker = "extra == 'dev'" }, + { name = "pandacan", git = "https://github.com/prayanshchh/panda?rev=proper_pip_package" }, { name = "parameterized", marker = "extra == 'dev'", specifier = ">=0.8,<0.9" }, { name = "pre-commit-hooks", marker = "extra == 'testing'" }, { name = "psutil" }, @@ -1452,8 +1467,8 @@ name = "panda3d-gltf" version = "0.13" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "panda3d" }, - { name = "panda3d-simplepbr" }, + { name = "panda3d", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "panda3d-simplepbr", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/07/7f/9f18fc3fa843a080acb891af6bcc12262e7bdf1d194a530f7042bebfc81f/panda3d-gltf-0.13.tar.gz", hash = "sha256:d06d373bdd91cf530909b669f43080e599463bbf6d3ef00c3558bad6c6b19675", size = 25573, upload-time = "2021-05-21T05:46:32.738Z" } wheels = [ @@ -1465,14 +1480,23 @@ name = "panda3d-simplepbr" version = "0.13.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "panda3d" }, - { name = "typing-extensions" }, + { name = "panda3d", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "typing-extensions", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/0d/be/c4d1ded04c22b357277cf6e6a44c1ab4abb285a700bd1991460460e05b99/panda3d_simplepbr-0.13.1.tar.gz", hash = "sha256:c83766d7c8f47499f365a07fe1dff078fc8b3054c2689bdc8dceabddfe7f1a35", size = 6216055, upload-time = "2025-03-30T16:57:41.087Z" } wheels = [ { url = "https://files.pythonhosted.org/packages/11/5d/3744c6550dddf933785a37cdd4a9921fe13284e6d115b5a2637fe390f158/panda3d_simplepbr-0.13.1-py3-none-any.whl", hash = "sha256:cda41cb57cff035b851646956cfbdcc408bee42511dabd4f2d7bd4fbf48c57a9", size = 2457097, upload-time = "2025-03-30T16:57:39.729Z" }, ] +[[package]] +name = "pandacan" +version = "0.0.10" +source = { git = "https://github.com/prayanshchh/panda?rev=proper_pip_package#6fe5e5fa6bd146fc4b8a58d91953c628ca5dd534" } +dependencies = [ + { name = "libusb1" }, + { name = "opendbc" }, +] + [[package]] name = "parameterized" version = "0.8.1" @@ -4203,9 +4227,9 @@ name = "pyopencl" version = "2025.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "numpy" }, - { name = "platformdirs" }, - { name = "pytools" }, + { name = "numpy", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "platformdirs", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "pytools", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/28/88/0ac460d3e2def08b2ad6345db6a13613815f616bbbd60c6f4bdf774f4c41/pyopencl-2025.1.tar.gz", hash = "sha256:0116736d7f7920f87b8db4b66a03f27b1d930d2e37ddd14518407cc22dd24779", size = 422510, upload-time = "2025-01-22T00:16:58.421Z" } wheels = [ @@ -4427,9 +4451,9 @@ name = "pytools" version = "2024.1.10" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "platformdirs" }, - { name = "siphash24" }, - { name = "typing-extensions" }, + { name = "platformdirs", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "siphash24", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, + { name = "typing-extensions", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/ee/0f/56e109c0307f831b5d598ad73976aaaa84b4d0e98da29a642e797eaa940c/pytools-2024.1.10.tar.gz", hash = "sha256:9af6f4b045212c49be32bb31fe19606c478ee4b09631886d05a32459f4ce0a12", size = 81741, upload-time = "2024-07-17T18:47:38.287Z" } wheels = [ @@ -4752,7 +4776,7 @@ name = "shapely" version = "2.1.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "numpy" }, + { name = "numpy", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/ca/3c/2da625233f4e605155926566c0e7ea8dda361877f48e8b1655e53456f252/shapely-2.1.1.tar.gz", hash = "sha256:500621967f2ffe9642454808009044c21e5b35db89ce69f8a2042c2ffd0e2772", size = 315422, upload-time = "2025-05-19T11:04:41.265Z" } wheels = [ @@ -4981,7 +5005,7 @@ name = "yapf" version = "0.43.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "platformdirs" }, + { name = "platformdirs", marker = "platform_machine != 'aarch64' or sys_platform != 'linux'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/23/97/b6f296d1e9cc1ec25c7604178b48532fa5901f721bcf1b8d8148b13e5588/yapf-0.43.0.tar.gz", hash = "sha256:00d3aa24bfedff9420b2e0d5d9f5ab6d9d4268e72afbf59bb3fa542781d5218e", size = 254907, upload-time = "2024-11-14T00:11:41.584Z" } wheels = [ From 9cbc04df8ef28fd2ec9496b2bd4000a4b4446406 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sun, 21 Sep 2025 10:41:20 +0530 Subject: [PATCH 03/14] Trigger CI From fd2a3fd2c61c1c19a9e22e0098a433b63d62b1e4 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sun, 21 Sep 2025 11:14:44 +0530 Subject: [PATCH 04/14] Trigger From 52e9265abaf84da47f32fe19f15b932c7242b85f Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sun, 21 Sep 2025 11:41:17 +0530 Subject: [PATCH 05/14] add scons in dockerfile --- Dockerfile.openpilot_base | 1 + uv.lock | 26 ++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Dockerfile.openpilot_base b/Dockerfile.openpilot_base index 44d8d95e95d926..efcc866c28af25 100644 --- a/Dockerfile.openpilot_base +++ b/Dockerfile.openpilot_base @@ -32,6 +32,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ vim \ libx11-6 \ wget \ + scons \ && rm -rf /var/lib/apt/lists/* RUN mkdir -p /tmp/opencl-driver-intel && \ diff --git a/uv.lock b/uv.lock index eb94f943233816..83b2a346600836 100644 --- a/uv.lock +++ b/uv.lock @@ -1387,7 +1387,7 @@ requires-dist = [ { name = "numpy", specifier = ">=2.0" }, { name = "onnx", specifier = ">=1.14.0" }, { name = "opencv-python-headless", marker = "extra == 'dev'" }, - { name = "pandacan", git = "https://github.com/prayanshchh/panda?rev=proper_pip_package" }, + { name = "pandacan", path = "../panda/dist/pandacan-0.0.10-py3-none-any.whl" }, { name = "parameterized", marker = "extra == 'dev'", specifier = ">=0.8,<0.9" }, { name = "pre-commit-hooks", marker = "extra == 'testing'" }, { name = "psutil" }, @@ -1491,11 +1491,33 @@ wheels = [ [[package]] name = "pandacan" version = "0.0.10" -source = { git = "https://github.com/prayanshchh/panda?rev=proper_pip_package#6fe5e5fa6bd146fc4b8a58d91953c628ca5dd534" } +source = { path = "../panda/dist/pandacan-0.0.10-py3-none-any.whl" } dependencies = [ { name = "libusb1" }, { name = "opendbc" }, ] +wheels = [ + { filename = "pandacan-0.0.10-py3-none-any.whl", hash = "sha256:f8365a8b25add01729afaf9722c80ca3da11cbce46135b93a7ef4db5c2be46be" }, +] + +[package.metadata] +requires-dist = [ + { name = "cffi", marker = "extra == 'dev'" }, + { name = "flaky", marker = "extra == 'dev'" }, + { name = "libusb1" }, + { name = "mypy", marker = "extra == 'dev'" }, + { name = "opendbc", git = "https://github.com/commaai/opendbc.git?rev=master" }, + { name = "pytest", marker = "extra == 'dev'" }, + { name = "pytest-mock", marker = "extra == 'dev'" }, + { name = "pytest-randomly", marker = "extra == 'dev'" }, + { name = "pytest-timeout", marker = "extra == 'dev'" }, + { name = "ruff", marker = "extra == 'dev'" }, + { name = "scons", marker = "extra == 'dev'" }, + { name = "setuptools", marker = "extra == 'dev'" }, + { name = "spidev", marker = "sys_platform == 'linux' and extra == 'dev'" }, + { name = "spidev2", marker = "sys_platform == 'linux' and extra == 'dev'" }, +] +provides-extras = ["dev"] [[package]] name = "parameterized" From b773592aa8ec69470eb9a13884eff33411602a91 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sun, 21 Sep 2025 12:45:27 +0530 Subject: [PATCH 06/14] regenerate uv.lock --- uv.lock | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/uv.lock b/uv.lock index 83b2a346600836..ad9a1a1fc11902 100644 --- a/uv.lock +++ b/uv.lock @@ -1387,7 +1387,7 @@ requires-dist = [ { name = "numpy", specifier = ">=2.0" }, { name = "onnx", specifier = ">=1.14.0" }, { name = "opencv-python-headless", marker = "extra == 'dev'" }, - { name = "pandacan", path = "../panda/dist/pandacan-0.0.10-py3-none-any.whl" }, + { name = "pandacan", git = "https://github.com/prayanshchh/panda?rev=proper_pip_package" }, { name = "parameterized", marker = "extra == 'dev'", specifier = ">=0.8,<0.9" }, { name = "pre-commit-hooks", marker = "extra == 'testing'" }, { name = "psutil" }, @@ -1491,33 +1491,11 @@ wheels = [ [[package]] name = "pandacan" version = "0.0.10" -source = { path = "../panda/dist/pandacan-0.0.10-py3-none-any.whl" } +source = { git = "https://github.com/prayanshchh/panda?rev=proper_pip_package#b3f487c84131c79ba12a6fc4196beead6c30bf2f" } dependencies = [ { name = "libusb1" }, { name = "opendbc" }, ] -wheels = [ - { filename = "pandacan-0.0.10-py3-none-any.whl", hash = "sha256:f8365a8b25add01729afaf9722c80ca3da11cbce46135b93a7ef4db5c2be46be" }, -] - -[package.metadata] -requires-dist = [ - { name = "cffi", marker = "extra == 'dev'" }, - { name = "flaky", marker = "extra == 'dev'" }, - { name = "libusb1" }, - { name = "mypy", marker = "extra == 'dev'" }, - { name = "opendbc", git = "https://github.com/commaai/opendbc.git?rev=master" }, - { name = "pytest", marker = "extra == 'dev'" }, - { name = "pytest-mock", marker = "extra == 'dev'" }, - { name = "pytest-randomly", marker = "extra == 'dev'" }, - { name = "pytest-timeout", marker = "extra == 'dev'" }, - { name = "ruff", marker = "extra == 'dev'" }, - { name = "scons", marker = "extra == 'dev'" }, - { name = "setuptools", marker = "extra == 'dev'" }, - { name = "spidev", marker = "sys_platform == 'linux' and extra == 'dev'" }, - { name = "spidev2", marker = "sys_platform == 'linux' and extra == 'dev'" }, -] -provides-extras = ["dev"] [[package]] name = "parameterized" @@ -4281,11 +4259,11 @@ wheels = [ [[package]] name = "pyparsing" -version = "3.2.4" +version = "3.2.5" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/98/c9/b4594e6a81371dfa9eb7a2c110ad682acf985d96115ae8b25a1d63b4bf3b/pyparsing-3.2.4.tar.gz", hash = "sha256:fff89494f45559d0f2ce46613b419f632bbb6afbdaed49696d322bcf98a58e99", size = 1098809, upload-time = "2025-09-13T05:47:19.732Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f2/a5/181488fc2b9d093e3972d2a472855aae8a03f000592dbfce716a512b3359/pyparsing-3.2.5.tar.gz", hash = "sha256:2df8d5b7b2802ef88e8d016a2eb9c7aeaa923529cd251ed0fe4608275d4105b6", size = 1099274, upload-time = "2025-09-21T04:11:06.277Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/53/b8/fbab973592e23ae313042d450fc26fa24282ebffba21ba373786e1ce63b4/pyparsing-3.2.4-py3-none-any.whl", hash = "sha256:91d0fcde680d42cd031daf3a6ba20da3107e08a75de50da58360e7d94ab24d36", size = 113869, upload-time = "2025-09-13T05:47:17.863Z" }, + { url = "https://files.pythonhosted.org/packages/10/5e/1aa9a93198c6b64513c9d7752de7422c06402de6600a8767da1524f9570b/pyparsing-3.2.5-py3-none-any.whl", hash = "sha256:e38a4f02064cf41fe6593d328d0512495ad1f3d8a91c4f73fc401b3079a59a5e", size = 113890, upload-time = "2025-09-21T04:11:04.117Z" }, ] [[package]] From 09219c1f3806164ab82808ee0bd93d32e65fe4f0 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Tue, 23 Sep 2025 13:27:27 +0530 Subject: [PATCH 07/14] chore: trigger CI From ecf9dc5e02db7e357cc23c4a5ee076b54a4ea7a4 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Tue, 23 Sep 2025 13:37:32 +0530 Subject: [PATCH 08/14] update uv.lock --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index ad9a1a1fc11902..57d50db07eadf5 100644 --- a/uv.lock +++ b/uv.lock @@ -1491,7 +1491,7 @@ wheels = [ [[package]] name = "pandacan" version = "0.0.10" -source = { git = "https://github.com/prayanshchh/panda?rev=proper_pip_package#b3f487c84131c79ba12a6fc4196beead6c30bf2f" } +source = { git = "https://github.com/prayanshchh/panda?rev=proper_pip_package#2a135f0e5c4a43b8904136d59507d29345b2c8ff" } dependencies = [ { name = "libusb1" }, { name = "opendbc" }, From 31a00f7d7961d304f9805bdade5368744800cb34 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Thu, 25 Sep 2025 00:49:39 +0530 Subject: [PATCH 09/14] uvlcok --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index 57d50db07eadf5..402dc2654436a8 100644 --- a/uv.lock +++ b/uv.lock @@ -1491,7 +1491,7 @@ wheels = [ [[package]] name = "pandacan" version = "0.0.10" -source = { git = "https://github.com/prayanshchh/panda?rev=proper_pip_package#2a135f0e5c4a43b8904136d59507d29345b2c8ff" } +source = { git = "https://github.com/prayanshchh/panda?rev=proper_pip_package#c93a96abe3d0e9db0b7a580b11e4c53e4bb0cfea" } dependencies = [ { name = "libusb1" }, { name = "opendbc" }, From 6fdc9973638d9477e085b5325c4aca586468abf5 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Thu, 25 Sep 2025 01:12:04 +0530 Subject: [PATCH 10/14] opendbc added --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index 402dc2654436a8..ce69b2146083d5 100644 --- a/uv.lock +++ b/uv.lock @@ -1491,7 +1491,7 @@ wheels = [ [[package]] name = "pandacan" version = "0.0.10" -source = { git = "https://github.com/prayanshchh/panda?rev=proper_pip_package#c93a96abe3d0e9db0b7a580b11e4c53e4bb0cfea" } +source = { git = "https://github.com/prayanshchh/panda?rev=proper_pip_package#08e0dd2efba09864572c2390197f99de025f9c96" } dependencies = [ { name = "libusb1" }, { name = "opendbc" }, From 12c8a3c02c1d4943226419d4bb2dc225498fb82d Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sat, 27 Sep 2025 01:31:08 +0530 Subject: [PATCH 11/14] resolve --- SConstruct | 275 ++++++++++++++++++----------------------------------- 1 file changed, 95 insertions(+), 180 deletions(-) diff --git a/SConstruct b/SConstruct index 7279bb3908acc2..1c3d5d9b94273b 100644 --- a/SConstruct +++ b/SConstruct @@ -3,6 +3,7 @@ import subprocess import sys import sysconfig import platform +import shlex import numpy as np import panda @@ -10,152 +11,45 @@ import SCons.Errors SCons.Warnings.warningAsException(True) -# pending upstream fix - https://github.com/SCons/scons/issues/4461 -#SetOption('warn', 'all') - -TICI = os.path.isfile('/TICI') -AGNOS = TICI - Decider('MD5-timestamp') SetOption('num_jobs', max(1, int(os.cpu_count()/2))) -AddOption('--kaitai', - action='store_true', - help='Regenerate kaitai struct parsers') - -AddOption('--asan', - action='store_true', - help='turn on ASAN') - -AddOption('--ubsan', - action='store_true', - help='turn on UBSan') - -AddOption('--coverage', - action='store_true', - help='build with test coverage options') - -AddOption('--clazy', - action='store_true', - help='build with clazy') - -AddOption('--ccflags', - action='store', - type='string', - default='', - help='pass arbitrary flags over the command line') - -AddOption('--external-sconscript', - action='store', - metavar='FILE', - dest='external_sconscript', - help='add an external SConscript to the build') - -AddOption('--mutation', - action='store_true', - help='generate mutation-ready code') - +AddOption('--kaitai', action='store_true', help='Regenerate kaitai struct parsers') +AddOption('--asan', action='store_true', help='turn on ASAN') +AddOption('--ubsan', action='store_true', help='turn on UBSan') +AddOption('--mutation', action='store_true', help='generate mutation-ready code') +AddOption('--ccflags', action='store', type='string', default='', help='pass arbitrary flags over the command line') AddOption('--minimal', action='store_false', dest='extras', default=os.path.exists(File('#.lfsconfig').abspath), # minimal by default on release branch (where there's no LFS) help='the minimum build to run openpilot. no tests, tools, etc.') -## Architecture name breakdown (arch) -## - larch64: linux tici aarch64 -## - aarch64: linux pc aarch64 -## - x86_64: linux pc x64 -## - Darwin: mac x64 or arm64 -real_arch = arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() +# Detect platform +arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() if platform.system() == "Darwin": arch = "Darwin" brew_prefix = subprocess.check_output(['brew', '--prefix'], encoding='utf8').strip() -elif arch == "aarch64" and AGNOS: +elif arch == "aarch64" and os.path.isfile('/TICI'): arch = "larch64" -assert arch in ["larch64", "aarch64", "x86_64", "Darwin"] - -lenv = { - "PATH": os.environ['PATH'], - "PYTHONPATH": Dir("#").abspath + ':' + Dir(f"#third_party/acados").abspath, - - "ACADOS_SOURCE_DIR": Dir("#third_party/acados").abspath, - "ACADOS_PYTHON_INTERFACE_PATH": Dir("#third_party/acados/acados_template").abspath, - "TERA_PATH": Dir("#").abspath + f"/third_party/acados/{arch}/t_renderer" -} - -rpath = [] - -if arch == "larch64": - cpppath = [ - "#third_party/opencl/include", - ] - - libpath = [ - "/usr/local/lib", - "/system/vendor/lib64", - f"#third_party/acados/{arch}/lib", - ] - - libpath += [ - "#third_party/libyuv/larch64/lib", - "/usr/lib/aarch64-linux-gnu" - ] - cflags = ["-DQCOM2", "-mcpu=cortex-a57"] - cxxflags = ["-DQCOM2", "-mcpu=cortex-a57"] - rpath += ["/usr/local/lib"] -else: - cflags = [] - cxxflags = [] - cpppath = [] - rpath += [] - - # MacOS - if arch == "Darwin": - libpath = [ - f"#third_party/libyuv/{arch}/lib", - f"#third_party/acados/{arch}/lib", - f"{brew_prefix}/lib", - f"{brew_prefix}/opt/openssl@3.0/lib", - f"{brew_prefix}/opt/llvm/lib/c++", - "/System/Library/Frameworks/OpenGL.framework/Libraries", - ] - - cflags += ["-DGL_SILENCE_DEPRECATION"] - cxxflags += ["-DGL_SILENCE_DEPRECATION"] - cpppath += [ - f"{brew_prefix}/include", - f"{brew_prefix}/opt/openssl@3.0/include", - ] - # Linux - else: - libpath = [ - f"#third_party/acados/{arch}/lib", - f"#third_party/libyuv/{arch}/lib", - "/usr/lib", - "/usr/local/lib", - ] - -if GetOption('asan'): - ccflags = ["-fsanitize=address", "-fno-omit-frame-pointer"] - ldflags = ["-fsanitize=address"] -elif GetOption('ubsan'): - ccflags = ["-fsanitize=undefined"] - ldflags = ["-fsanitize=undefined"] -else: - ccflags = [] - ldflags = [] - -# no --as-needed on mac linker -if arch != "Darwin": - ldflags += ["-Wl,--as-needed", "-Wl,--no-undefined"] - -ccflags_option = GetOption('ccflags') -if ccflags_option: - ccflags += ccflags_option.split(' ') +assert arch in [ + "larch64", # linux tici arm64 + "aarch64", # linux pc arm64 + "x86_64", # linux pc x64 + "Darwin", # macOS arm64 (x86 not supported) +] env = Environment( - ENV=lenv, + ENV={ + "PATH": os.environ['PATH'], + "PYTHONPATH": Dir("#").abspath + ':' + Dir(f"#third_party/acados").abspath, + "ACADOS_SOURCE_DIR": Dir("#third_party/acados").abspath, + "ACADOS_PYTHON_INTERFACE_PATH": Dir("#third_party/acados/acados_template").abspath, + "TERA_PATH": Dir("#").abspath + f"/third_party/acados/{arch}/t_renderer" + }, + CC='clang', + CXX='clang++', CCFLAGS=[ "-g", "-fPIC", @@ -168,36 +62,31 @@ env = Environment( "-Wno-c99-designator", "-Wno-reorder-init-list", "-Wno-vla-cxx-extension", - ] + cflags + ccflags, - - CPPPATH=cpppath + [ + ], + CFLAGS=["-std=gnu11"], + CXXFLAGS=["-std=c++1z"], + CPPPATH=[ "#", + "#msgq", + "#third_party", + "#third_party/json11", + "#third_party/linux/include", "#third_party/acados/include", "#third_party/acados/include/blasfeo/include", "#third_party/acados/include/hpipm/include", "#third_party/catch2/include", "#third_party/libyuv/include", - "#third_party/json11", - "#third_party/linux/include", - "#third_party", - "#msgq", ], - - CC='clang', - CXX='clang++', - LINKFLAGS=ldflags, - - RPATH=rpath, - - CFLAGS=["-std=gnu11"] + cflags, - CXXFLAGS=["-std=c++1z"] + cxxflags, - LIBPATH=libpath + [ + LIBPATH=[ + "#common", "#msgq_repo", "#third_party", "#selfdrive/pandad", - "#common", "#rednose/helpers", + f"#third_party/libyuv/{arch}/lib", + f"#third_party/acados/{arch}/lib", ], + RPATH=[], CYTHONCFILESUFFIX=".cpp", COMPILATIONDB_USE_ABSPATH=True, REDNOSE_ROOT="#", @@ -207,29 +96,63 @@ env = Environment( env.AppendUnique(CPPPATH=[panda.INCLUDE_PATH]) -if arch == "Darwin": - # RPATH is not supported on macOS, instead use the linker flags - darwin_rpath_link_flags = [f"-Wl,-rpath,{path}" for path in env["RPATH"]] - env["LINKFLAGS"] += darwin_rpath_link_flags +# Arch-specific flags and paths +if arch == "larch64": + env.Append(CPPPATH=["#third_party/opencl/include"]) + env.Append(LIBPATH=[ + "/usr/local/lib", + "/system/vendor/lib64", + "/usr/lib/aarch64-linux-gnu", + ]) + arch_flags = ["-D__TICI__", "-mcpu=cortex-a57"] + env.Append(CCFLAGS=arch_flags) + env.Append(CXXFLAGS=arch_flags) +elif arch == "Darwin": + env.Append(LIBPATH=[ + f"{brew_prefix}/lib", + f"{brew_prefix}/opt/openssl@3.0/lib", + f"{brew_prefix}/opt/llvm/lib/c++", + "/System/Library/Frameworks/OpenGL.framework/Libraries", + ]) + env.Append(CCFLAGS=["-DGL_SILENCE_DEPRECATION"]) + env.Append(CXXFLAGS=["-DGL_SILENCE_DEPRECATION"]) + env.Append(CPPPATH=[ + f"{brew_prefix}/include", + f"{brew_prefix}/opt/openssl@3.0/include", + ]) +else: + env.Append(LIBPATH=[ + "/usr/lib", + "/usr/local/lib", + ]) -env.CompilationDatabase('compile_commands.json') +# Sanitizers and extra CCFLAGS from CLI +if GetOption('asan'): + env.Append(CCFLAGS=["-fsanitize=address", "-fno-omit-frame-pointer"]) + env.Append(LINKFLAGS=["-fsanitize=address"]) +elif GetOption('ubsan'): + env.Append(CCFLAGS=["-fsanitize=undefined"]) + env.Append(LINKFLAGS=["-fsanitize=undefined"]) -# Setup cache dir -cache_dir = '/data/scons_cache' if AGNOS else '/tmp/scons_cache' -CacheDir(cache_dir) -Clean(["."], cache_dir) +_extra_cc = shlex.split(GetOption('ccflags') or '') +if _extra_cc: + env.Append(CCFLAGS=_extra_cc) +# no --as-needed on mac linker +if arch != "Darwin": + env.Append(LINKFLAGS=["-Wl,--as-needed", "-Wl,--no-undefined"]) + +# progress output node_interval = 5 node_count = 0 def progress_function(node): global node_count node_count += node_interval sys.stderr.write("progress: %d\n" % node_count) - if os.environ.get('SCONS_PROGRESS'): Progress(progress_function, interval=node_interval) -# Cython build environment +# ********** Cython build environment ********** py_include = sysconfig.get_paths()['include'] envCython = env.Clone() envCython["CPPPATH"] += [py_include, np.get_include()] @@ -238,14 +161,14 @@ envCython["CCFLAGS"].remove("-Werror") envCython["LIBS"] = [] if arch == "Darwin": - envCython["LINKFLAGS"] = ["-bundle", "-undefined", "dynamic_lookup"] + darwin_rpath_link_flags + envCython["LINKFLAGS"] = env["LINKFLAGS"] + ["-bundle", "-undefined", "dynamic_lookup"] else: envCython["LINKFLAGS"] = ["-pthread", "-shared"] np_version = SCons.Script.Value(np.__version__) Export('envCython', 'np_version') -# Qt build environment +# ********** Qt build environment ********** qt_env = env.Clone() qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "DBus", "Xml"] @@ -295,27 +218,20 @@ qt_env['CXXFLAGS'] += qt_flags qt_env['LIBPATH'] += ['#selfdrive/ui', ] qt_env['LIBS'] = qt_libs -if GetOption("clazy"): - checks = [ - "level0", - "level1", - "no-range-loop", - "no-non-pod-global-static", - ] - qt_env['CXX'] = 'clazy' - qt_env['ENV']['CLAZY_IGNORE_DIRS'] = qt_dirs[0] - qt_env['ENV']['CLAZY_CHECKS'] = ','.join(checks) +Export('env', 'qt_env', 'arch') + +# Setup cache dir +cache_dir = '/data/scons_cache' if arch == "larch64" else '/tmp/scons_cache' +CacheDir(cache_dir) +Clean(["."], cache_dir) -Export('env', 'qt_env', 'arch', 'real_arch') +# ********** start building stuff ********** # Build common module SConscript(['common/SConscript']) -Import('_common', '_gpucommon') - +Import('_common') common = [_common, 'json11', 'zmq'] -gpucommon = [_gpucommon] - -Export('common', 'gpucommon') +Export('common') # Build messaging (cereal + msgq + socketmaster + their dependencies) # Enable swaglog include in submodules @@ -352,6 +268,5 @@ if Dir('#tools/cabana/').exists() and GetOption('extras'): if arch != "larch64": SConscript(['tools/cabana/SConscript']) -external_sconscript = GetOption('external_sconscript') -if external_sconscript: - SConscript([external_sconscript]) + +env.CompilationDatabase('compile_commands.json') From 094184052bde8f6af5d04c55838afe4b0963ad27 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sat, 27 Sep 2025 01:45:25 +0530 Subject: [PATCH 12/14] res --- SConstruct | 95 ------------------------------------------------------ 1 file changed, 95 deletions(-) diff --git a/SConstruct b/SConstruct index 0f3de586b02c76..534436468e8bb9 100644 --- a/SConstruct +++ b/SConstruct @@ -15,11 +15,6 @@ Decider('MD5-timestamp') SetOption('num_jobs', max(1, int(os.cpu_count()/2))) -AddOption('--kaitai', action='store_true', help='Regenerate kaitai struct parsers') -AddOption('--asan', action='store_true', help='turn on ASAN') -AddOption('--ubsan', action='store_true', help='turn on UBSan') -AddOption('--mutation', action='store_true', help='generate mutation-ready code') -AddOption('--ccflags', action='store', type='string', default='', help='pass arbitrary flags over the command line') AddOption('--kaitai', action='store_true', help='Regenerate kaitai struct parsers') AddOption('--asan', action='store_true', help='turn on ASAN') AddOption('--ubsan', action='store_true', help='turn on UBSan') @@ -31,14 +26,11 @@ AddOption('--minimal', default=os.path.exists(File('#.lfsconfig').abspath), # minimal by default on release branch (where there's no LFS) help='the minimum build to run openpilot. no tests, tools, etc.') -# Detect platform -arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() # Detect platform arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip() if platform.system() == "Darwin": arch = "Darwin" brew_prefix = subprocess.check_output(['brew', '--prefix'], encoding='utf8').strip() -elif arch == "aarch64" and os.path.isfile('/TICI'): elif arch == "aarch64" and os.path.isfile('/TICI'): arch = "larch64" assert arch in [ @@ -47,23 +39,7 @@ assert arch in [ "x86_64", # linux pc x64 "Darwin", # macOS arm64 (x86 not supported) ] -assert arch in [ - "larch64", # linux tici arm64 - "aarch64", # linux pc arm64 - "x86_64", # linux pc x64 - "Darwin", # macOS arm64 (x86 not supported) -] -env = Environment( - ENV={ - "PATH": os.environ['PATH'], - "PYTHONPATH": Dir("#").abspath + ':' + Dir(f"#third_party/acados").abspath, - "ACADOS_SOURCE_DIR": Dir("#third_party/acados").abspath, - "ACADOS_PYTHON_INTERFACE_PATH": Dir("#third_party/acados/acados_template").abspath, - "TERA_PATH": Dir("#").abspath + f"/third_party/acados/{arch}/t_renderer" - }, - CC='clang', - CXX='clang++', env = Environment( ENV={ "PATH": os.environ['PATH'], @@ -89,20 +65,12 @@ env = Environment( ], CFLAGS=["-std=gnu11"], CXXFLAGS=["-std=c++1z"], - CPPPATH=[ - ], - CFLAGS=["-std=gnu11"], - CXXFLAGS=["-std=c++1z"], CPPPATH=[ "#", "#msgq", "#third_party", "#third_party/json11", "#third_party/linux/include", - "#msgq", - "#third_party", - "#third_party/json11", - "#third_party/linux/include", "#third_party/acados/include", "#third_party/acados/include/blasfeo/include", "#third_party/acados/include/hpipm/include", @@ -120,11 +88,8 @@ env = Environment( "#rednose/helpers", f"#third_party/libyuv/{arch}/lib", f"#third_party/acados/{arch}/lib", - f"#third_party/libyuv/{arch}/lib", - f"#third_party/acados/{arch}/lib", ], RPATH=[], - RPATH=[], CYTHONCFILESUFFIX=".cpp", COMPILATIONDB_USE_ABSPATH=True, REDNOSE_ROOT="#", @@ -132,53 +97,6 @@ env = Environment( toolpath=["#site_scons/site_tools", "#rednose_repo/site_scons/site_tools"], ) -# Arch-specific flags and paths -if arch == "larch64": - env.Append(CPPPATH=["#third_party/opencl/include"]) - env.Append(LIBPATH=[ - "/usr/local/lib", - "/system/vendor/lib64", - "/usr/lib/aarch64-linux-gnu", - ]) - arch_flags = ["-D__TICI__", "-mcpu=cortex-a57"] - env.Append(CCFLAGS=arch_flags) - env.Append(CXXFLAGS=arch_flags) -elif arch == "Darwin": - env.Append(LIBPATH=[ - f"{brew_prefix}/lib", - f"{brew_prefix}/opt/openssl@3.0/lib", - f"{brew_prefix}/opt/llvm/lib/c++", - "/System/Library/Frameworks/OpenGL.framework/Libraries", - ]) - env.Append(CCFLAGS=["-DGL_SILENCE_DEPRECATION"]) - env.Append(CXXFLAGS=["-DGL_SILENCE_DEPRECATION"]) - env.Append(CPPPATH=[ - f"{brew_prefix}/include", - f"{brew_prefix}/opt/openssl@3.0/include", - ]) -else: - env.Append(LIBPATH=[ - "/usr/lib", - "/usr/local/lib", - ]) - -# Sanitizers and extra CCFLAGS from CLI -if GetOption('asan'): - env.Append(CCFLAGS=["-fsanitize=address", "-fno-omit-frame-pointer"]) - env.Append(LINKFLAGS=["-fsanitize=address"]) -elif GetOption('ubsan'): - env.Append(CCFLAGS=["-fsanitize=undefined"]) - env.Append(LINKFLAGS=["-fsanitize=undefined"]) - -_extra_cc = shlex.split(GetOption('ccflags') or '') -if _extra_cc: - env.Append(CCFLAGS=_extra_cc) - -# no --as-needed on mac linker -if arch != "Darwin": - env.Append(LINKFLAGS=["-Wl,--as-needed", "-Wl,--no-undefined"]) - -# progress output env.AppendUnique(CPPPATH=[panda.INCLUDE_PATH]) # Arch-specific flags and paths @@ -237,7 +155,6 @@ def progress_function(node): if os.environ.get('SCONS_PROGRESS'): Progress(progress_function, interval=node_interval) -# ********** Cython build environment ********** # ********** Cython build environment ********** py_include = sysconfig.get_paths()['include'] envCython = env.Clone() @@ -248,14 +165,12 @@ envCython["CCFLAGS"].remove("-Werror") envCython["LIBS"] = [] if arch == "Darwin": envCython["LINKFLAGS"] = env["LINKFLAGS"] + ["-bundle", "-undefined", "dynamic_lookup"] - envCython["LINKFLAGS"] = env["LINKFLAGS"] + ["-bundle", "-undefined", "dynamic_lookup"] else: envCython["LINKFLAGS"] = ["-pthread", "-shared"] np_version = SCons.Script.Value(np.__version__) Export('envCython', 'np_version') -# ********** Qt build environment ********** # ********** Qt build environment ********** qt_env = env.Clone() qt_modules = ["Widgets", "Gui", "Core", "Network", "Concurrent", "DBus", "Xml"] @@ -313,14 +228,6 @@ cache_dir = '/data/scons_cache' if arch == "larch64" else '/tmp/scons_cache' CacheDir(cache_dir) Clean(["."], cache_dir) -# ********** start building stuff ********** -Export('env', 'qt_env', 'arch') - -# Setup cache dir -cache_dir = '/data/scons_cache' if arch == "larch64" else '/tmp/scons_cache' -CacheDir(cache_dir) -Clean(["."], cache_dir) - # ********** start building stuff ********** # Build common module @@ -368,5 +275,3 @@ if Dir('#tools/cabana/').exists() and GetOption('extras'): env.CompilationDatabase('compile_commands.json') - -env.CompilationDatabase('compile_commands.json') From 990d8946f41a14d10809011659180ec47d0102e5 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sat, 27 Sep 2025 01:49:33 +0530 Subject: [PATCH 13/14] res2 --- SConstruct | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/SConstruct b/SConstruct index 534436468e8bb9..0da05b5dae11a2 100644 --- a/SConstruct +++ b/SConstruct @@ -77,9 +77,6 @@ env = Environment( "#third_party/catch2/include", "#third_party/libyuv/include", ], - LIBPATH=[ - "#common", - ], LIBPATH=[ "#common", "#msgq_repo", @@ -233,10 +230,9 @@ Clean(["."], cache_dir) # Build common module SConscript(['common/SConscript']) Import('_common') -Import('_common') + common = [_common, 'json11', 'zmq'] Export('common') -Export('common') # Build messaging (cereal + msgq + socketmaster + their dependencies) # Enable swaglog include in submodules From bb62b7551dd339ccde10978c911a50c6158787d0 Mon Sep 17 00:00:00 2001 From: prayansh_chhablani Date: Sat, 27 Sep 2025 01:50:21 +0530 Subject: [PATCH 14/14] remove space --- SConstruct | 1 - 1 file changed, 1 deletion(-) diff --git a/SConstruct b/SConstruct index 0da05b5dae11a2..1c3d5d9b94273b 100644 --- a/SConstruct +++ b/SConstruct @@ -230,7 +230,6 @@ Clean(["."], cache_dir) # Build common module SConscript(['common/SConscript']) Import('_common') - common = [_common, 'json11', 'zmq'] Export('common')