Skip to content

A feature-rich command-line audio/video downloader

Support Deno installed via Python package (#15614)

Karl Knechteldde5eab3b3a3
diff --git a/pyproject.toml b/pyproject.toml
index 79313ae2ec..5827629965 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -65,6 +65,9 @@ secretstorage = [
"cffi",
"secretstorage",
]
+deno = [
+ "deno>=2.6.5", # v2.6.5 fixes installation of incompatible binaries
+]
build = [
"build",
"hatchling>=1.27.0",
diff --git a/yt_dlp/utils/_jsruntime.py b/yt_dlp/utils/_jsruntime.py
index 4ea230da42..2c2ec9e7c6 100644
--- a/yt_dlp/utils/_jsruntime.py
+++ b/yt_dlp/utils/_jsruntime.py
@@ -5,6 +5,7 @@ import dataclasses
import functools
import os.path
import sys
+import sysconfig
from ._utils import _get_exe_version_output, detect_exe_version, version_tuple
@@ -13,6 +14,13 @@ _FALLBACK_PATHEXT = ('.COM', '.EXE', '.BAT', '.CMD')
def _find_exe(basename: str) -> str:
+ # Check in Python "scripts" path, e.g. for pipx-installed binaries
+ binary = os.path.join(
+ sysconfig.get_path('scripts'),
+ basename + sysconfig.get_config_var('EXE'))
+ if os.access(binary, os.F_OK | os.X_OK) and not os.path.isdir(binary):
+ return binary
+
if os.name != 'nt':
return basename