Add safety headers to package (#2258)

* Add safety headers to package

* include path

* it's for the whole project

* update

* guard
This commit is contained in:
Adeeb Shihadeh
2025-05-17 18:52:21 -07:00
committed by GitHub
parent 190ea26e76
commit 45bf6c8f54
5 changed files with 17 additions and 0 deletions

1
.gitignore vendored
View File

@@ -17,6 +17,7 @@
*.gcno
uv.lock
/dist/
opendbc/can/build/
opendbc/can/obj/

View File

@@ -1,2 +1,3 @@
include opendbc/car/car.capnp
include opendbc/car/include/c++.capnp
recursive-include opendbc/safety *.h

View File

@@ -1,3 +1,6 @@
import os
DBC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'dbc')
# -I include path for e.g. "#include <opendbc/safety/safety.h>"
INCLUDE_PATH = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../"))

View File

@@ -1,4 +1,10 @@
#pragma once
// TODO: clean this up. it's for interop with the panda version
#ifndef CANPACKET_HEAD_SIZE
#include "opendbc/safety/board/can_declarations.h"
static const unsigned char dlc_to_len[] = {0U, 1U, 2U, 3U, 4U, 5U, 6U, 7U, 8U, 12U, 16U, 20U, 24U, 32U, 48U, 64U};
#endif

View File

@@ -120,3 +120,9 @@ flake8-implicit-str-concat.allow-multiline=false
"pytest.main".msg = "pytest.main requires special handling that is easy to mess up!"
# TODO: re-enable when all tests are converted to pytest
#"unittest".msg = "Use pytest"
[tool.setuptools]
include-package-data = true
[tool.setuptools.package-data]
"opendbc.safety" = ["*.h", "board/*.h", "board/drivers/*.h", "safety/*.h"]