diff --git a/Dockerfile b/Dockerfile index 816a9b80..96a2a86e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ git \ libffi-dev \ libusb-1.0-0 \ - python3 \ python3-dev \ python3-pip \ && rm -rf /var/lib/apt/lists/* && \ @@ -35,15 +34,7 @@ COPY setup.py __init__.py $PYTHONPATH/panda/ COPY python/__init__.py $PYTHONPATH/panda/python/ RUN pip3 install --break-system-packages --no-cache-dir $PYTHONPATH/panda/[dev] -# TODO: this should be a "pip install" or not even in this repo at all RUN git config --global --add safe.directory $PYTHONPATH/panda -ENV OPENDBC_REF="da0a5e3d2b3984b56ebf5e25d9769f5c77807e4d" -RUN cd /tmp/ && \ - git clone --depth 1 https://github.com/commaai/opendbc opendbc_repo && \ - cd opendbc_repo && git fetch origin $OPENDBC_REF && git checkout FETCH_HEAD && rm -rf .git/ && \ - pip3 install --break-system-packages --no-cache-dir Cython numpy pycapnp && \ - ln -s $PWD/opendbc $PYTHONPATH/opendbc && \ - scons -j8 --minimal opendbc/ # for Jenkins COPY README.md panda.tar.* /tmp/ diff --git a/SConscript b/SConscript index f617410b..1a4c875b 100644 --- a/SConscript +++ b/SConscript @@ -1,7 +1,7 @@ import os +import opendbc import subprocess - PREFIX = "arm-none-eabi-" BUILDER = "DEV" @@ -84,7 +84,7 @@ def build_project(project_name, project, extra_flags): '..', panda_root, f"{panda_root}/board/", - f"{panda_root}/../opendbc/safety/", + opendbc.INCLUDE_PATH, ] env = Environment( diff --git a/board/jungle/main.c b/board/jungle/main.c index 1c73edd7..664351c1 100644 --- a/board/jungle/main.c +++ b/board/jungle/main.c @@ -1,7 +1,7 @@ // ********************* Includes ********************* #include "board/config.h" -#include "safety.h" +#include "opendbc/safety/safety.h" #include "board/drivers/led.h" #include "board/drivers/pwm.h" diff --git a/board/main.c b/board/main.c index 9770f836..458db967 100644 --- a/board/main.c +++ b/board/main.c @@ -10,7 +10,7 @@ #include "early_init.h" #include "provision.h" -#include "safety.h" +#include "opendbc/safety/safety.h" #include "health.h" diff --git a/setup.py b/setup.py index a7729cc6..7786b9e4 100644 --- a/setup.py +++ b/setup.py @@ -43,8 +43,10 @@ setup( package_dir={'panda': 'python'}, platforms='any', license='MIT', + python_requires='>=3.11,<3.13', install_requires=[ 'libusb1', + 'opendbc @ git+https://github.com/commaai/opendbc.git@45bf6c8f548473dece52f780f60bd8e20c32bd65#egg=opendbc', ], extras_require = { 'dev': [ diff --git a/tests/libpanda/SConscript b/tests/libpanda/SConscript index b1699cd5..941db938 100644 --- a/tests/libpanda/SConscript +++ b/tests/libpanda/SConscript @@ -1,3 +1,4 @@ +import opendbc import platform CC = 'gcc' @@ -20,7 +21,7 @@ env = Environment( '-Wfatal-errors', '-Wno-pointer-to-int-cast', ], - CPPPATH=[".", "../../board/", "../../../opendbc/safety/"], + CPPPATH=[".", "../../board/", opendbc.INCLUDE_PATH], ) if system == "Darwin": env.PrependENVPath('PATH', '/opt/homebrew/bin') diff --git a/tests/libpanda/panda.c b/tests/libpanda/panda.c index 303d72e7..2d17d64e 100644 --- a/tests/libpanda/panda.c +++ b/tests/libpanda/panda.c @@ -15,7 +15,7 @@ void can_tx_comms_resume_spi(void) { }; #include "faults.h" #include "libc.h" #include "boards/board_declarations.h" -#include "safety.h" +#include "opendbc/safety/safety.h" #include "main_definitions.h" #include "drivers/can_common.h" diff --git a/tests/misra/test_misra.sh b/tests/misra/test_misra.sh index aaa7b0c3..3b16863b 100755 --- a/tests/misra/test_misra.sh +++ b/tests/misra/test_misra.sh @@ -3,6 +3,7 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" PANDA_DIR=$(realpath $DIR/../../) +OPENDBC_ROOT=$(python3 -c "import opendbc; print(opendbc.INCLUDE_PATH)") GREEN="\e[1;32m" YELLOW="\e[1;33m" @@ -47,7 +48,7 @@ cppcheck() { $CPPCHECK_DIR/cppcheck --inline-suppr -I $PANDA_DIR/board/ \ -I "$(arm-none-eabi-gcc -print-file-name=include)" \ -I $PANDA_DIR/board/stm32f4/inc/ -I $PANDA_DIR/board/stm32h7/inc/ \ - -I $PANDA_DIR/../opendbc/safety/ \ + -I $OPENDBC_ROOT \ --suppressions-list=$DIR/suppressions.txt --suppress=*:*inc/* \ --suppress=*:*include/* --error-exitcode=2 --check-level=exhaustive --safety \ --platform=arm32-wchar_t4 $COMMON_DEFINES --checkers-report=$CHECKLIST.tmp \ diff --git a/tests/misra/test_mutation.py b/tests/misra/test_mutation.py index db955a8f..8adaa87d 100755 --- a/tests/misra/test_mutation.py +++ b/tests/misra/test_mutation.py @@ -68,7 +68,6 @@ for p in patterns: def test_misra_mutation(fn, patch, should_fail): with tempfile.TemporaryDirectory() as tmp: shutil.copytree(ROOT, tmp + "/panda", dirs_exist_ok=True) - shutil.copytree(ROOT + "../opendbc", tmp + "/opendbc", dirs_exist_ok=True) # apply patch if fn is not None: