Pre-commit uses python virtualenvs to install python hooks. On Windows, pre-commit uses the Windows's virtualenv directory structure, which install scripts in a 'Scripts' subdir. But, on msys, the standard unix virtualenv is used, which installs scripts in a 'bin' subdir. Fixes #21161
20 lines
675 B
Diff
20 lines
675 B
Diff
--- pre_commit-3.7.1/pre_commit/languages/python.py.orig 2024-08-05 11:01:55.206420600 +0200
|
|
+++ pre_commit-3.7.1/pre_commit/languages/python.py 2024-08-05 10:53:15.318707500 +0200
|
|
@@ -4,6 +4,7 @@
|
|
import functools
|
|
import os
|
|
import sys
|
|
+import sysconfig
|
|
from collections.abc import Generator
|
|
from collections.abc import Sequence
|
|
|
|
@@ -48,7 +49,7 @@
|
|
|
|
def bin_dir(venv: str) -> str:
|
|
"""On windows there's a different directory for the virtualenv"""
|
|
- bin_part = 'Scripts' if sys.platform == 'win32' else 'bin'
|
|
+ bin_part = 'Scripts' if sys.platform == 'win32' and not "mingw" in sysconfig.get_platform() else 'bin'
|
|
return os.path.join(venv, bin_part)
|
|
|
|
|