Merge pull request #267499 from NilsIrl/pygrep-pythonpath
[pre-commit] Forward sys.path to pygrep via PYTHONPATH
This commit is contained in:
commit
30b34ac007
2 changed files with 14 additions and 0 deletions
|
@ -33,6 +33,7 @@ buildPythonApplication rec {
|
||||||
patches = [
|
patches = [
|
||||||
./languages-use-the-hardcoded-path-to-python-binaries.patch
|
./languages-use-the-hardcoded-path-to-python-binaries.patch
|
||||||
./hook-tmpl.patch
|
./hook-tmpl.patch
|
||||||
|
./pygrep-pythonpath.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
|
|
13
pkgs/tools/misc/pre-commit/pygrep-pythonpath.patch
Normal file
13
pkgs/tools/misc/pre-commit/pygrep-pythonpath.patch
Normal file
|
@ -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:
|
Loading…
Reference in a new issue