Skip to content

The pre-commit hooks do not work on macOS #110652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
erlend-aasland opened this issue Oct 10, 2023 · 6 comments
Closed

The pre-commit hooks do not work on macOS #110652

erlend-aasland opened this issue Oct 10, 2023 · 6 comments
Labels

Comments

@erlend-aasland
Copy link
Contributor

erlend-aasland commented Oct 10, 2023

$ grep "entry.*python" .pre-commit-config.yaml
        entry: 'python Tools/patchcheck/reindent.py --nobackup --newline LF'
        entry: "python Tools/patchcheck/untabify.py"

Unfortunately, there is no python on macOS; only python3. Can we change these to python3?

Linked PRs

@erlend-aasland
Copy link
Contributor Author

Simply executing these scripts directly would also do:

$ head -n1 Tools/patchcheck/*.py
==> Tools/patchcheck/patchcheck.py <==
#!/usr/bin/env python3

==> Tools/patchcheck/reindent.py <==
#! /usr/bin/env python3

==> Tools/patchcheck/untabify.py <==
#! /usr/bin/env python3

@hugovk
Copy link
Member

hugovk commented Oct 10, 2023

Yep, see also comments at #109891 (comment).

We can't use python3 because that won't work on Windows...

Let's check if direct execution works on Windows.

@AlexWaygood
Copy link
Member

We can't use python3 because that won't work on Windows...

Let's check if direct execution works on Windows.

Unfortunately neither approach works on Windows: see #110653 (comment) ://

@AlexWaygood
Copy link
Member

I think we should revert these commits until we figure out how to fix this properly (if it can be "fixed properly"):

@hugovk
Copy link
Member

hugovk commented Oct 11, 2023

Agree to revert.

I'd prefer to replace Tools/patchcheck/reindent.py and Tools/patchcheck/untabify.py with other pre-commit hooks.

@erlend-aasland
Copy link
Contributor Author

I'd prefer to replace Tools/patchcheck/reindent.py and Tools/patchcheck/untabify.py with other pre-commit hooks.

Surely there must be existing hooks we can use.

If we need CPython specific hooks, we can create a repo for them under the GitHub python org. (for example python/pre-commit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants