aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Doucette <[email protected]>2026-03-18 09:37:33 -0600
committerGitHub Enterprise <[email protected]>2026-03-18 09:37:33 -0600
commitf88b1f82153d2043597c27534645d7b957179309 (patch)
tree22b921e082bb5f70ef52275c37931de18f77f710
parentAdd natvis for Compact Binary (#860) (diff)
downloadzen-f88b1f82153d2043597c27534645d7b957179309.tar.xz
zen-f88b1f82153d2043597c27534645d7b957179309.zip
Allow pre-commit without it being in the PATH (#861)
Running through `python -m pre_commit` avoids the need to have the directory containing `pre-commit` in the PATH. This is preferable when the path is subject to change such as `%LocalAppData%\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages`.
-rw-r--r--CLAUDE.md4
-rw-r--r--README.md2
-rw-r--r--xmake.lua2
3 files changed, 4 insertions, 4 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 9228d3de1..759ec8298 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -102,10 +102,10 @@ zencore-test
xmake precommit
# Or use pre-commit directly
-pre-commit run --all-files
+python -m pre_commit run --all-files
```
-Install pre-commit hooks with `pre-commit install` to auto-format on commit.
+Install pre-commit hooks with `python -m pre_commit install` to auto-format on commit.
### Cleaning Build State
diff --git a/README.md b/README.md
index 2146738ec..80295f9d8 100644
--- a/README.md
+++ b/README.md
@@ -67,7 +67,7 @@ commit.
* You can install using `winget install python3`
* Run `pip install pre-commit==3.2.0` (later versions may or may not work)
* If you want the pre-commit steps to be run at commit time (which is recommended) you can
- run `pre-commit install` within your local repo.
+ run `python -m pre_commit install` within your local repo.
Once you have pre-commit installed, it's convenient to use the provided xmake task to trigger it
manually to apply clang-format rules. You can do this by running `xmake precommit` on the command
diff --git a/xmake.lua b/xmake.lua
index bce67364d..8ba4c0a9a 100644
--- a/xmake.lua
+++ b/xmake.lua
@@ -571,7 +571,7 @@ task("precommit")
description = "Run required pre-commit steps (clang-format, etc)",
}
on_run(function ()
- print(os.exec("pre-commit run --all-files"))
+ print(os.exec("python -m pre_commit run --all-files"))
end)
task("sln")