/ .setup / macos / python-path.mjs
python-path.mjs
 1  import { logInfo } from '../log.mjs';
 2  import { execSync } from 'child_process';
 3  
 4  export function getPythonPath() {
 5    const nodeGypPythonPath = process.env.NODE_GYP_FORCE_PYTHON;
 6    if (nodeGypPythonPath) {
 7      logInfo(`NODE_GYP_FORCE_PYTHON=${nodeGypPythonPath}`);
 8      return nodeGypPythonPath;
 9    }
10    logInfo(`defaulting to system's python3`);
11    return execSync(`which python3`).toString().trim();
12  }
13