From 645c5abca439b3d661ae311f287c6f05db0d48ec Mon Sep 17 00:00:00 2001 From: sam0rr Date: Sun, 13 Sep 2026 21:25:17 -0400 Subject: [PATCH] fix: check FFmpeg availability without sudo --- clefincode_chat/setup/install.py | 13 +++++-------- pyproject.toml | 2 ++ 2 files changed, 7 insertions(+), 8 deletions(-) create mode 100644 pyproject.toml diff --git a/clefincode_chat/setup/install.py b/clefincode_chat/setup/install.py index eebcd9f..0509869 100644 --- a/clefincode_chat/setup/install.py +++ b/clefincode_chat/setup/install.py @@ -1,5 +1,5 @@ import frappe -import subprocess +import shutil def ensure_contact_custom_fields(): from frappe.custom.doctype.custom_field.custom_field import create_custom_field @@ -17,7 +17,7 @@ def after_install(): ensure_contact_custom_fields() create_roles() create_users_profiles() - install_ffmpeg() + check_ffmpeg() add_default_limited_roles() # ================================================================================= def create_roles(): @@ -101,12 +101,9 @@ def create_users_profiles(): frappe.db.commit() # ================================================================================= -def install_ffmpeg(): - try: - subprocess.run(["sudo", "apt", "update", "--fix-missing" , "-y",], check=True) - subprocess.run(["sudo", "apt", "install", "ffmpeg", "--fix-missing" , "-y"], check=True) - except subprocess.CalledProcessError as e: - print(f"An error occurred: {e}") +def check_ffmpeg(): + if not shutil.which("ffmpeg"): + print("Warning: FFmpeg is not installed. Install it manually to enable audio and video processing.") # ================================================================================= def add_default_limited_roles(): diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..f9c41d4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,2 @@ +[deploy.dependencies.apt] +packages = ["ffmpeg"]