about summary refs log tree commit diff
path: root/pkgs/tools/misc/pre-commit/pygrep-pythonpath.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/misc/pre-commit/pygrep-pythonpath.patch')
-rw-r--r--pkgs/tools/misc/pre-commit/pygrep-pythonpath.patch13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/tools/misc/pre-commit/pygrep-pythonpath.patch b/pkgs/tools/misc/pre-commit/pygrep-pythonpath.patch
new file mode 100644
index 000000000000..722b436169be
--- /dev/null
+++ b/pkgs/tools/misc/pre-commit/pygrep-pythonpath.patch
@@ -0,0 +1,13 @@
+diff --git a/pre_commit/languages/pygrep.py b/pre_commit/languages/pygrep.py
+index ec55560..44e08a1 100644
+--- a/pre_commit/languages/pygrep.py
++++ b/pre_commit/languages/pygrep.py
+@@ -98,7 +98,7 @@ def run_hook(
+         color: bool,
+ ) -> tuple[int, bytes]:
+     cmd = (sys.executable, '-m', __name__, *args, entry)
+-    return xargs(cmd, file_args, color=color)
++    return xargs(cmd, file_args, color=color, env={ "PYTHONPATH": ':'.join(sys.path) })
+ 
+ 
+ def main(argv: Sequence[str] | None = None) -> int: