Skip to content

Commit

Permalink
move to nested opendbc/ (#1069)
Browse files Browse the repository at this point in the history
* move to nested opendbc/

* get CI working / similar to msgq

* move dbcs to dbc/

* run pre-commit outside docker

* move generator to dbc/

* fix path in print
  • Loading branch information
sshane committed Aug 1, 2024
1 parent cd61e17 commit a40652d
Show file tree
Hide file tree
Showing 173 changed files with 23 additions and 23 deletions.
16 changes: 8 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
.DS_Store
.sconsign.dblite

can/*.so
can/*.a
can/build/
can/obj/
can/packer_pyx.cpp
can/parser_pyx.cpp
can/packer_pyx.html
can/parser_pyx.html
opendbc/can/*.so
opendbc/can/*.a
opendbc/can/build/
opendbc/can/obj/
opendbc/can/packer_pyx.cpp
opendbc/can/parser_pyx.cpp
opendbc/can/packer_pyx.html
opendbc/can/parser_pyx.html
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ repos:
hooks:
- id: generator
name: dbc generator
entry: generator/test_generator.py
entry: opendbc/dbc/generator/test_generator.py
language: script
pass_filenames: false
8 changes: 2 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ RUN pip3 install --break-system-packages --no-cache-dir -r /tmp/requirements.txt
RUN pip3 install --break-system-packages --no-cache-dir pre-commit==2.15.0 pylint==2.17.4

WORKDIR /project/opendbc
ENV PYTHONPATH=/project
ENV PYTHONPATH=/project/opendbc

COPY . .
COPY SConstruct /project
COPY ./site_scons /project/site_scons
COPY .gitignore /project/.gitignore

RUN ls && rm -rf .git && cd ../ && \
RUN ls && rm -rf .git && \
scons -c && scons -j$(nproc) \
2 changes: 0 additions & 2 deletions __init__.py

This file was deleted.

3 changes: 3 additions & 0 deletions opendbc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import os

DBC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'dbc')
2 changes: 1 addition & 1 deletion can/SConscript → opendbc/can/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Import('env', 'envCython', 'common', 'arch')
import os

envDBC = env.Clone()
dbc_file_path = '-DDBC_FILE_PATH=\'"%s"\'' % (envDBC.Dir("..").abspath)
dbc_file_path = '-DDBC_FILE_PATH=\'"%s"\'' % (envDBC.Dir("../dbc").abspath)
envDBC['CXXFLAGS'] += [dbc_file_path]
src = ["dbc.cc", "parser.cc", "packer.cc", "common.cc"]
libs = [common, "zmq"]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion can/dbc.cc → opendbc/can/dbc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ DBC* dbc_parse(const std::string& dbc_path) {
const std::string get_dbc_root_path() {
char *basedir = std::getenv("BASEDIR");
if (basedir != NULL) {
return std::string(basedir) + "/opendbc";
return std::string(basedir) + "/opendbc/dbc";
} else {
return DBC_FILE_PATH;
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added opendbc/dbc/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

import os
from opendbc.generator.tesla.radar_common import get_radar_point_definition, get_val_definition
from opendbc.dbc.generator.tesla.radar_common import get_radar_point_definition, get_val_definition

if __name__ == "__main__":
dbc_name = os.path.basename(__file__).replace(".py", ".dbc")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

import os
from opendbc.generator.tesla.radar_common import get_radar_point_definition, get_val_definition
from opendbc.dbc.generator.tesla.radar_common import get_radar_point_definition, get_val_definition

if __name__ == "__main__":
dbc_name = os.path.basename(__file__).replace(".py", ".dbc")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import filecmp
import tempfile
from opendbc.generator.generator import create_all, opendbc_root
from opendbc.dbc.generator.generator import create_all, opendbc_root


def test_generator():
Expand All @@ -14,7 +14,7 @@ def test_generator():

err = "Generated DBC mismatch\n\n"
err += f"Different files: {comp.diff_files}\n\n"
err += "Run opendbc/generator/generator.py to regenerate DBC files."
err += "Run opendbc/dbc/generator/generator.py to regenerate DBC files."
assert len(comp.diff_files) == 0, err


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ repository = "https://github.com/commaai/opendbc"
max-line-length = 120
ignore = ["E111", "E114"]

[tool.mypy]
explicit_package_bases=true

# https://beta.ruff.rs/docs/configuration/#using-pyprojecttoml
[tool.ruff]
select = ["E", "F", "W", "PIE", "C4", "ISC", "RUF100", "A"]
Expand Down

0 comments on commit a40652d

Please sign in to comment.