nixpkgs/pkgs/by-name/pr/pre-commit/languages-use-the-hardcoded-path-to-python-binaries.patch
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

27 lines
1.2 KiB
Diff

diff --git a/pre_commit/languages/node.py b/pre_commit/languages/node.py
index 66d6136..e3f1bac 100644
--- a/pre_commit/languages/node.py
+++ b/pre_commit/languages/node.py
@@ -83,7 +83,7 @@ def install_environment(
# https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx?f=255&MSPPError=-2147217396#maxpath
if sys.platform == 'win32': # pragma: no cover
envdir = fr'\\?\{os.path.normpath(envdir)}'
- cmd = [sys.executable, '-mnodeenv', '--prebuilt', '--clean-src', envdir]
+ cmd = ['@nodeenv@/bin/nodeenv', '--prebuilt', '--clean-src', envdir]
if version != C.DEFAULT:
cmd.extend(['-n', version])
cmd_output_b(*cmd)
diff --git a/pre_commit/languages/python.py b/pre_commit/languages/python.py
index 976674e..485fe2d 100644
--- a/pre_commit/languages/python.py
+++ b/pre_commit/languages/python.py
@@ -203,7 +203,7 @@ def install_environment(
additional_dependencies: Sequence[str],
) -> None:
envdir = lang_base.environment_dir(prefix, ENVIRONMENT_DIR, version)
- venv_cmd = [sys.executable, '-mvirtualenv', envdir]
+ venv_cmd = ['@virtualenv@/bin/virtualenv', envdir]
python = norm_version(version)
if python is not None:
venv_cmd.extend(('-p', python))