Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use given PYTHON env variable (if given) when running worker/scripts/getmake.py #1186

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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