Commit Graph

1 Commits

Author SHA1 Message Date
2d44fc8082 Tools: put the script's own directory on sys.path in the two that need it
`python -I` implies `-P`, so the directory of the script is not `sys.path[0]` and a tool that imports the module
next to it dies before `main()`:

    python -I tools/calibrated_texture.py --help
    ModuleNotFoundError: No module named 'bcpack'

`calibrated_texture.py` imports `bcpack`, `bcpack_tables` and `ttpf_mips` and added nothing; `ttpf_assets.py`
imports `bcpack`, `file_mode`, `ttpf_mips` and `calibrated_texture` and added nothing either, so the build's
texture stage tools could only be run through `make_game.py`, never directly as CONTRIBUTING.md documents.

Insert `os.path.dirname(os.path.abspath(__file__))` before the sibling imports, the pattern already used by
`tools/anim_clips.py`. `tests/test_tool_startup.py` derives the affected set from the sources and runs
`python -I <tool> --help` for all of them, so a new tool with a sibling import is covered without editing the
test; without the two fixes it fails exactly on those two tools.

A sweep of `python -I tools/*.py --help` over all 110 tools found no other case.
2026-11-22 16:38:03 +02:00