diff --git a/npm-scripts.mjs b/npm-scripts.mjs index 80ebc35c3e..f3982f253e 100644 --- a/npm-scripts.mjs +++ b/npm-scripts.mjs @@ -11,7 +11,6 @@ const IS_WINDOWS = os.platform() === 'win32'; const MAYOR_VERSION = PKG.version.split('.')[0]; const PYTHON = getPython(); const PIP_INVOKE_DIR = path.resolve('worker/pip_invoke'); -const INVOKE_VERSION = process.env.INVOKE_VERSION ?? '2.2.0'; const FLATBUFFERS_VERSION = '23.3.3'; const WORKER_RELEASE_DIR = 'worker/out/Release'; const WORKER_RELEASE_BIN = IS_WINDOWS ? 'mediasoup-worker.exe' : 'mediasoup-worker'; @@ -318,7 +317,8 @@ function installInvoke() // Install pip invoke into custom location, so we don't depend on system-wide // installation. executeCmd( - `"${PYTHON}" -m pip install --upgrade --target="${PIP_INVOKE_DIR}" invoke==${INVOKE_VERSION}`, /* exitOnError */ true + `"${PYTHON}" -m pip install --upgrade --target="${PIP_INVOKE_DIR}" invoke`, + /* exitOnError */ true ); } @@ -331,15 +331,7 @@ function deleteNodeLib() logInfo('deleteNodeLib()'); - if (!IS_WINDOWS) - { - executeCmd('rm -rf node/lib'); - } - else - { - // NOTE: This command fails in Windows if the dir doesn't exist. - executeCmd('rmdir /s /q "node/lib"', /* exitOnError */ false); - } + fs.rmSync('node/lib', { recursive: true, force: true }); } function buildTypescript({ force = false } = { force: false }) @@ -584,7 +576,7 @@ async function downloadPrebuiltWorker() const resolvedBinPath = path.resolve(WORKER_RELEASE_BIN_PATH); execSync( - resolvedBinPath, + `"${resolvedBinPath}"`, { stdio : [ 'ignore', 'ignore', 'ignore' ], // Ensure no env is passed to avoid accidents. diff --git a/package.json b/package.json index 0fa0bf1c9c..fdf71d2362 100644 --- a/package.json +++ b/package.json @@ -21,23 +21,22 @@ "types": "node/lib/index.d.ts", "files": [ "node/lib", - "worker/src", - "worker/include", + "worker/deps/libwebrtc", "worker/fbs", - "worker/test/src", - "worker/test/include", - "worker/fuzzer/src", "worker/fuzzer/include", - "worker/scripts/*.mjs", + "worker/fuzzer/src", + "worker/include", + "worker/src", "worker/scripts/*.json", + "worker/scripts/*.mjs", "worker/scripts/*.py", "worker/scripts/*.sh", "worker/subprojects/*.wrap", - "worker/deps/libwebrtc", - "worker/tasks.py", - "worker/Makefile", + "worker/test/include", + "worker/test/src", "worker/meson.build", "worker/meson_options.txt", + "worker/tasks.py", "npm-scripts.mjs" ], "engines": { diff --git a/worker/Cargo.toml b/worker/Cargo.toml index 9116fc8444..a3a5d412ce 100644 --- a/worker/Cargo.toml +++ b/worker/Cargo.toml @@ -21,9 +21,9 @@ include = [ "/test/src", "/build.rs", "/Cargo.toml", - "/Makefile", "/meson.build", "/meson_options.txt", + "/tasks.py" ] [package.metadata.docs.rs] diff --git a/worker/Makefile b/worker/Makefile index 7a0492128c..fd21742768 100644 --- a/worker/Makefile +++ b/worker/Makefile @@ -6,7 +6,6 @@ PYTHON ?= $(shell command -v python3 2> /dev/null || echo python) PIP_INVOKE_DIR = $(shell pwd)/pip_invoke -INVOKE_VERSION ?= 2.2.0 # Instruct Python where to look for invoke module. ifeq ($(OS),Windows_NT) @@ -48,7 +47,7 @@ invoke: ifeq ($(wildcard $(PIP_INVOKE_DIR)),) # Install pip invoke into custom location, so we don't depend on system-wide # installation. - $(PYTHON) -m pip install --upgrade --target="$(PIP_INVOKE_DIR)" invoke==$(INVOKE_VERSION) + $(PYTHON) -m pip install --upgrade --target="$(PIP_INVOKE_DIR)" invoke endif meson-ninja: invoke diff --git a/worker/build.rs b/worker/build.rs index 06d25c0ce6..aca5b430ad 100644 --- a/worker/build.rs +++ b/worker/build.rs @@ -107,10 +107,8 @@ fn main() { // Install Python invoke package in custom folder let pip_invoke_dir = format!("{out_dir}/pip_invoke"); - let invoke_version = "2.2.0"; let python = env::var("PYTHON").unwrap_or("python3".to_string()); - let mut pythonpath = if env::var("PYTHONPATH").is_ok() { - let original_pythonpath = env::var("PYTHONPATH").unwrap(); + let mut pythonpath = if let Ok(original_pythonpath) = env::var("PYTHONPATH") { format!("{pip_invoke_dir}:{original_pythonpath}") } else { pip_invoke_dir.clone() @@ -126,8 +124,9 @@ fn main() { .arg("pip") .arg("install") .arg("--upgrade") - .arg(format!("--target={pip_invoke_dir}")) - .arg(format!("invoke=={invoke_version}")) + .arg("--target") + .arg(pip_invoke_dir) + .arg("invoke") .spawn() .expect("Failed to start") .wait()