File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ PCbuild/arm64/
127127PCbuild /obj /
128128PCbuild /win32 /
129129Tools /unicode /data /
130+ /.venv-pre-commit /
130131/autom4te.cache
131132/build /
132133/builddir /
Original file line number Diff line number Diff line change @@ -3100,6 +3100,35 @@ funny:
31003100 -o -name MANIFEST \
31013101 -o -print
31023102
3103+ .PHONY: clean-venv
3104+ clean-venv:
3105+ rm -rf .venv-pre-commit
3106+
3107+ # Create a virtual environment for pre-commit
3108+ .PHONY: pre-commit-venv
3109+ pre-commit-venv:
3110+ @if [ -d .venv-pre-commit ] ; then \
3111+ echo "pre-commit venv already exists."; \
3112+ echo "To recreate it, remove it first with \`make clean-venv'."; \
3113+ else \
3114+ echo "Creating venv for pre-commit in .venv-pre-commit"; \
3115+ if uv --version > /dev/null; then \
3116+ uv venv .venv-pre-commit; \
3117+ VIRTUAL_ENV=.venv-pre-commit uv pip install pre-commit; \
3118+ else \
3119+ $(PYTHON_FOR_REGEN) -m venv .venv-pre-commit; \
3120+ .venv-pre-commit/bin/python3 -m pip install --upgrade pip; \
3121+ .venv-pre-commit/bin/python3 -m pip install pre-commit; \
3122+ fi; \
3123+ echo "The venv has been created in the .venv-pre-commit directory"; \
3124+ fi
3125+
3126+ # Run CPython's static analysis, verification, and style checks.
3127+ .PHONY: lint
3128+ lint: pre-commit-venv
3129+ .venv-pre-commit/bin/pre-commit run --all-files
3130+ $(PYTHON_FOR_REGEN) $(srcdir)/Tools/patchcheck/patchcheck.py
3131+
31033132# Perform some verification checks on any modified files.
31043133.PHONY: patchcheck
31053134patchcheck: all
You can’t perform that action at this time.
0 commit comments