versatica / mediasoup

Cutting Edge WebRTC Video Conferencing
https://mediasoup.org
ISC License
6.27k stars 1.13k forks source link

Only install Python Invoke if mediasoup-worker must be locally built #1244

Closed ibc closed 11 months ago

ibc commented 11 months ago

NOTE: Now I see that this PR is not valid but will create this PR for discussing about it. Problem is that, indeed, running worker "flatc" task is needed for flatc:node NPM script to succeed. Otherwise we get this error:

https://github.com/versatica/mediasoup/actions/runs/6988996456/job/19017138136

npm-scripts.mjs [INFO] [prepare] flatcNode()
npm-scripts.mjs [INFO] [prepare] executeCmd(): for file in /home/runner/work/mediasoup/mediasoup/worker/fbs/*.fbs; do /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc --ts --ts-no-import-ext --gen-object-api -o /home/runner/work/mediasoup/mediasoup/node/src  ${file}; done
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
/bin/sh: 1: /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc: not found
npm-scripts.mjs [ERROR] [prepare] executeCmd() failed, exiting: Error: Command failed: for file in /home/runner/work/mediasoup/mediasoup/worker/fbs/*.fbs; do /home/runner/work/mediasoup/mediasoup/worker/out/Release/build/subprojects/flatbuffers-23.3.3/flatc --ts --ts-no-import-ext --gen-object-api -o /home/runner/work/mediasoup/mediasoup/node/src  ${file}; done
npm ERR! code 1

So the problem is that, in theory, Python was only a dependency in case the mediasoup-worker binary should be locally built. However, now Python is mandatory even if a prebuilt worker binary is fetched. Why? Because despite there is a prebuilt worker binary, mediasoup npm installation needs to compile flatc files to TypeScript and for that it needs to run the worker "flatc" task, which depends on Python Invoke (it depended on make), so Python 3 is needed anyway.

My question is: why does "flatc:node" depend on worker "flatc" task?

ibc commented 11 months ago

My question is: why does "flatc:node" depend on worker "flatc" task?

Ok, ignore me. It needs flatc executable to generate FBS TypeScript files, so it needs to compile flatbuffers so it needs Meson so it needs Python Invoke so it needs Python. Ok, I'm closing this PR.

One may argue that it would make sense to include FBS TS files int the repo, but I won't open that melón now.