@@ -14,10 +14,7 @@ import type { Tool } from "../../scripts/hak/hakEnv.ts";
1414import type { DependencyInfo } from "../../scripts/hak/dep.ts" ;
1515
1616export default async function ( hakEnv : HakEnv , moduleInfo : DependencyInfo ) : Promise < void > {
17- const tools : Tool [ ] = [
18- [ "rustc" , "--version" ] ,
19- [ "python" , "--version" ] , // node-gyp uses python for reasons beyond comprehension
20- ] ;
17+ const tools : Tool [ ] = [ [ "rustc" , "--version" ] ] ;
2118 if ( hakEnv . isWin ( ) ) {
2219 tools . push ( [ "perl" , "--version" ] ) ; // for openssl configure
2320 tools . push ( [ "nasm" , "-v" ] ) ; // for openssl building
@@ -28,6 +25,14 @@ export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Prom
2825 }
2926 await hakEnv . checkTools ( tools ) ;
3027
28+ try {
29+ // node-gyp uses python for reasons beyond comprehension
30+ // Try python3 first, to get a more sensible error if python is not found in the fallback
31+ await hakEnv . checkTools ( [ [ "python3" , "--version" ] ] ) ;
32+ } catch {
33+ await hakEnv . checkTools ( [ [ "python" , "--version" ] ] ) ;
34+ }
35+
3136 // Ensure Rust target exists (nb. we avoid depending on rustup)
3237 await new Promise ( ( resolve , reject ) => {
3338 const rustc = childProcess . execFile (
0 commit comments