File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010from pre_commit .envcontext import Var
1111from pre_commit .hook import Hook
1212from pre_commit .languages import helpers
13+ from pre_commit .parse_shebang import find_executable
1314from pre_commit .prefix import Prefix
1415from pre_commit .util import clean_path_on_failure
1516
@@ -27,6 +28,14 @@ def install_environment(
2728 helpers .assert_version_default ('coursier' , version )
2829 helpers .assert_no_additional_deps ('coursier' , additional_dependencies )
2930
31+ # Support both possible executable names (either "cs" or "coursier")
32+ executable = find_executable ('cs' ) or find_executable ('coursier' )
33+ if executable is None :
34+ raise AssertionError (
35+ 'pre-commit requires system-installed "cs" or "coursier" '
36+ 'executables in the application search path' ,
37+ )
38+
3039 envdir = prefix .path (helpers .environment_dir (ENVIRONMENT_DIR , version ))
3140 channel = prefix .path ('.pre-commit-channel' )
3241 with clean_path_on_failure (envdir ):
@@ -36,7 +45,7 @@ def install_environment(
3645 helpers .run_setup_cmd (
3746 prefix ,
3847 (
39- 'cs' ,
48+ executable ,
4049 'install' ,
4150 '--default-channels=false' ,
4251 f'--channel={ channel } ' ,
You can’t perform that action at this time.
0 commit comments