From 27cd6e68df00a7536ccb301a6efae52905484b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Mon, 9 Feb 2026 10:51:40 -0800 Subject: [PATCH] python3Packages.pytubefix: hardcode nodejs path --- .../python-modules/pytubefix/default.nix | 10 ++++ .../replace-nodejs-wheel-binaries.patch | 54 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 pkgs/development/python-modules/pytubefix/replace-nodejs-wheel-binaries.patch diff --git a/pkgs/development/python-modules/pytubefix/default.nix b/pkgs/development/python-modules/pytubefix/default.nix index 9e6261a7f4f99..6e524411e0f87 100644 --- a/pkgs/development/python-modules/pytubefix/default.nix +++ b/pkgs/development/python-modules/pytubefix/default.nix @@ -3,6 +3,8 @@ aiohttp, buildPythonPackage, fetchFromGitHub, + replaceVars, + nodejs, setuptools, pytestCheckHook, }: @@ -19,6 +21,12 @@ buildPythonPackage rec { hash = "sha256-GSXz89BztDOcAmAMPi3SIIDnUbvYJjnHf4DcWf1hqjY="; }; + patches = [ + (replaceVars ./replace-nodejs-wheel-binaries.patch { + inherit nodejs; + }) + ]; + build-system = [ setuptools ]; dependencies = [ aiohttp ]; @@ -37,6 +45,8 @@ buildPythonPackage rec { ]; disabledTests = [ + "test_get_initial_function_name_with_no_match_should_error" + "test_get_throttling_function_name" "test_playlist_failed_pagination" "test_playlist_pagination" "test_create_mock_html_json" diff --git a/pkgs/development/python-modules/pytubefix/replace-nodejs-wheel-binaries.patch b/pkgs/development/python-modules/pytubefix/replace-nodejs-wheel-binaries.patch new file mode 100644 index 0000000000000..95be075679279 --- /dev/null +++ b/pkgs/development/python-modules/pytubefix/replace-nodejs-wheel-binaries.patch @@ -0,0 +1,54 @@ +diff --git a/pyproject.toml b/pyproject.toml +index 3762b62..dfee082 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -33,7 +33,7 @@ classifiers = [ + "Topic :: Terminals", + "Topic :: Utilities", + ] +-dependencies = ["aiohttp >=3.12.13", "nodejs-wheel-binaries >= 22.20.0"] ++dependencies = ["aiohttp >=3.12.13"] + + [project.urls] + "Homepage" = "https://github.com/juanbindez/pytubefix" +diff --git a/pytubefix/botGuard/bot_guard.py b/pytubefix/botGuard/bot_guard.py +index d7bde7e..ca10816 100644 +--- a/pytubefix/botGuard/bot_guard.py ++++ b/pytubefix/botGuard/bot_guard.py +@@ -1,11 +1,10 @@ + import os + import subprocess + import sys +-import nodejs_wheel.executable + + PLATFORM = sys.platform + +-NODE_DIR = nodejs_wheel.executable.ROOT_DIR ++NODE_DIR = "@nodejs@" + + def _node_path() -> str: + suffix = ".exe" if os.name == "nt" else "" +diff --git a/pytubefix/sig_nsig/node_runner.py b/pytubefix/sig_nsig/node_runner.py +index 9ac068a..a7a2c72 100644 +--- a/pytubefix/sig_nsig/node_runner.py ++++ b/pytubefix/sig_nsig/node_runner.py +@@ -1,11 +1,10 @@ + import os + import json + import subprocess +-import nodejs_wheel.executable + + + RUNNER_PATH = os.path.join(os.path.dirname(__file__), "vm", "runner.js") +-NODE_DIR = nodejs_wheel.executable.ROOT_DIR ++NODE_DIR = "@nodejs@" + + class NodeRunner: + def __init__(self, code: str): +@@ -44,4 +43,4 @@ class NodeRunner: + def close(self): + self.proc.stdin.close() + self.proc.terminate() +- self.proc.wait() +\ No newline at end of file ++ self.proc.wait()