@@ -14,10 +14,7 @@ import type { Tool } from "../../scripts/hak/hakEnv.ts";
|
|||||||
import type { DependencyInfo } from "../../scripts/hak/dep.ts";
|
import type { DependencyInfo } from "../../scripts/hak/dep.ts";
|
||||||
|
|
||||||
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Promise<void> {
|
||||||
const tools: Tool[] = [
|
const tools: Tool[] = [["rustc", "--version"]];
|
||||||
["rustc", "--version"],
|
|
||||||
["python", "--version"], // node-gyp uses python for reasons beyond comprehension
|
|
||||||
];
|
|
||||||
if (hakEnv.isWin()) {
|
if (hakEnv.isWin()) {
|
||||||
tools.push(["perl", "--version"]); // for openssl configure
|
tools.push(["perl", "--version"]); // for openssl configure
|
||||||
tools.push(["nasm", "-v"]); // for openssl building
|
tools.push(["nasm", "-v"]); // for openssl building
|
||||||
@@ -28,6 +25,14 @@ export default async function (hakEnv: HakEnv, moduleInfo: DependencyInfo): Prom
|
|||||||
}
|
}
|
||||||
await hakEnv.checkTools(tools);
|
await hakEnv.checkTools(tools);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// node-gyp uses python for reasons beyond comprehension
|
||||||
|
// Try python3 first, to get a more sensible error if python is not found in the fallback
|
||||||
|
await hakEnv.checkTools([["python3", "--version"]]);
|
||||||
|
} catch {
|
||||||
|
await hakEnv.checkTools([["python", "--version"]]);
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure Rust target exists (nb. we avoid depending on rustup)
|
// Ensure Rust target exists (nb. we avoid depending on rustup)
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
const rustc = childProcess.execFile(
|
const rustc = childProcess.execFile(
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ export default class HakEnv {
|
|||||||
shell: this.isWin(),
|
shell: this.isWin(),
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
proc.on("error", (err) => {
|
||||||
|
reject(err);
|
||||||
|
});
|
||||||
proc.on("exit", (code) => {
|
proc.on("exit", (code) => {
|
||||||
if (code) {
|
if (code) {
|
||||||
reject(code);
|
reject(code);
|
||||||
|
|||||||
Reference in New Issue
Block a user