Skip to content

Commit

Permalink
Use given PYTHON env variable (if given) when running worker/scripts/…
Browse files Browse the repository at this point in the history
…getmake.py

Just that.
  • Loading branch information
ibc committed Oct 19, 2023
1 parent ef1b6b0 commit c1e3256
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions npm-scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -418,21 +418,34 @@ function installMsysMake()
{
logInfo('installMsysMake()');

let res = spawnSync('where', [ 'python3.exe' ]);
let pythonPath;

if (res.status !== 0)
// If PYTHON environment variable is given, use it.
if (process.env.PYTHON)
{
res = spawnSync('where', [ 'python.exe' ]);
pythonPath = process.env.PYTHON;
}
// Otherwise ensure python3.exe is available in the PATH.
else
{
let res = spawnSync('where', [ 'python3.exe' ]);

if (res.status !== 0)
{
logError('`installMsysMake() | cannot find Python executable');
res = spawnSync('where', [ 'python.exe' ]);

exitWithError();
if (res.status !== 0)
{
logError('`installMsysMake() | cannot find Python executable');

exitWithError();
}
}

pythonPath = String(res.stdout).trim();
}

executeCmd(`${String(res.stdout).trim()} worker\\scripts\\getmake.py`);
executeCmd(`${pythonPath} worker\\scripts\\getmake.py`);
}

function ensureDir(dir)
Expand Down

0 comments on commit c1e3256

Please sign in to comment.