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

npm installation: Don't require Python if valid worker prebuilt binary is fetched #1265

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

### NEXT

* worker: Disable RtcLogger usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)).
* worker: Disable `RtcLogger` usage if not enabled ([PR #1264](https://github.com/versatica/mediasoup/pull/1264)).
* npm installation: Don't require Python if valid worker prebuilt binary is fetched ([PR #1265](https://github.com/versatica/mediasoup/pull/1265)).


### 3.13.11
Expand Down
31 changes: 20 additions & 11 deletions npm-scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ async function run()
{
switch (task)
{
case 'preinstall':
{
installInvoke();

break;
}

// As per NPM documentation (https://docs.npmjs.com/cli/v9/using-npm/scripts)
// `prepare` script:
//
Expand Down Expand Up @@ -167,6 +160,8 @@ async function run()

case 'format:worker':
{
installInvoke();

executeCmd(`"${PYTHON}" -m invoke -r worker format`);

break;
Expand Down Expand Up @@ -351,13 +346,17 @@ function buildWorker()
{
logInfo('buildWorker()');

installInvoke();

executeCmd(`"${PYTHON}" -m invoke -r worker mediasoup-worker`);
}

function cleanWorkerArtifacts()
{
logInfo('cleanWorkerArtifacts()');

installInvoke();

// Clean build artifacts except `mediasoup-worker`.
executeCmd(`"${PYTHON}" -m invoke -r worker clean-build`);
// Clean downloaded dependencies.
Expand All @@ -377,13 +376,17 @@ function lintWorker()
{
logInfo('lintWorker()');

installInvoke();

executeCmd(`"${PYTHON}" -m invoke -r worker lint`);
}

function flatcNode()
{
logInfo('flatcNode()');

installInvoke();

// Build flatc if needed.
executeCmd(`"${PYTHON}" -m invoke -r worker flatc`);

Expand All @@ -410,6 +413,8 @@ function flatcWorker()
{
logInfo('flatcWorker()');

installInvoke();

executeCmd(`"${PYTHON}" -m invoke -r worker flatc`);
}

Expand All @@ -431,6 +436,8 @@ function testWorker()
{
logInfo('testWorker()');

installInvoke();

executeCmd(`"${PYTHON}" -m invoke -r worker test`);
}

Expand Down Expand Up @@ -575,6 +582,8 @@ async function downloadPrebuiltWorker()
{
const resolvedBinPath = path.resolve(WORKER_RELEASE_BIN_PATH);

// This will always fail on purpose, but if status code is 41 then
// it's good.
execSync(
`"${resolvedBinPath}"`,
{
Expand All @@ -583,15 +592,15 @@ async function downloadPrebuiltWorker()
env : {}
}
);

logInfo(
'downloadPrebuiltWorker() | fetched mediasoup-worker prebuilt binary is valid for current host'
);
}
catch (error)
{
if (error.status === 41)
{
logInfo(
'downloadPrebuiltWorker() | fetched mediasoup-worker prebuilt binary is valid for current host'
);

resolve(true);
}
else
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"nodejs"
],
"scripts": {
"preinstall": "node npm-scripts.mjs preinstall",
"prepare": "node npm-scripts.mjs prepare",
"postinstall": "node npm-scripts.mjs postinstall",
"typescript:build": "node npm-scripts.mjs typescript:build",
Expand Down