Skip to content

Commit

Permalink
raw scons failure fixed by setting PYTHONPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeBusuttil committed Dec 30, 2024
1 parent 983bf9c commit 1235859
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,7 @@ Everything you need to know to use, contribute, and extend opendbc are in these
```bash
git clone https://github.com/commaai/opendbc.git
cd opendbc

# you probably just want to use this. it's an all-in-one for dependency
# installation, compiling, linting, and tests. it's also what runs in CI
./test.sh

# here are the individual commands it runs
pip3 install -e .[testing,docs] # install dependencies
scons -j8 # build with 8 cores
pytest . # run the tests
pre-commit run --all-files # run the linter
./test.sh # all-in-one dependency installation, compiling, linting, and tests. It's what runs in CI
```

[`examples/`](examples/) contains small example programs that can read state from the car and control the steering, gas, and brakes.
Expand Down
2 changes: 2 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import subprocess
import sysconfig
import platform
import numpy as np
from pathlib import Path

arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()
if platform.system() == "Darwin":
arch = "Darwin"

os.environ['PYTHONPATH'] = str(Path(sysconfig.get_paths()['data']).parent)
python_path = sysconfig.get_paths()['include']
cpppath = [
'#',
Expand Down
10 changes: 2 additions & 8 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/bin/bash
set -e

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)"
cd $DIR

# TODO: why doesn't uv do this?
export PYTHONPATH=$DIR

# *** dependencies install ***
if ! command -v uv &>/dev/null; then
echo "'uv' is not installed. Installing 'uv'..."
Expand All @@ -17,15 +11,15 @@ uv sync --all-extras
source .venv/bin/activate

# *** build ***
uv run scons -j8
uv run scons -j$(nproc)

# *** lint ***
# TODO: pre-commit is slow; replace it with openpilot's "op lint"
#uv run pre-commit run --all-files
uv run ruff check .

# *** test ***
uv run pytest -n8
uv run pytest -n$(nproc)

# *** all done ***
GREEN='\033[0;32m'
Expand Down

0 comments on commit 1235859

Please sign in to comment.