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 (#1186)
  • Loading branch information
ibc authored Oct 19, 2023
1 parent ef1b6b0 commit acf7a56
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
### NEXT

* CI: Use Node.js version 20 ([PR #1177](https://github.com/versatica/mediasoup/pull/1177)).
* Use given `PYTHON` environment variable (if given) when running `worker/scripts/getmake.py` ([PR #1186](https://github.com/versatica/mediasoup/pull/1186)).


### 3.12.13
Expand Down
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 acf7a56

Please sign in to comment.