Skip to content

Commit 4e6e720

Browse files
committed
fix: remove runtime FFmpeg installation
1 parent 0120091 commit 4e6e720

3 files changed

Lines changed: 31 additions & 11 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ Core technologies include:
135135

136136
Since ClefinCode Chat is a Frappe app, it can be installed via [frappe-bench](https://frappeframework.com/docs/v14/user/en/bench) on a local machine or production site.
137137

138+
FFmpeg must be installed on the server for audio and video processing. For Docker deployments, include it when building the image. The app installer does not install system packages or require `sudo`.
139+
138140
```bash
139141
bench get-app https://github.com/clefincode/clefincode_chat.git
140142
bench --site yoursite.name install-app clefincode_chat

clefincode_chat/setup/install.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import frappe
2-
import subprocess
32

43
def ensure_contact_custom_fields():
54
from frappe.custom.doctype.custom_field.custom_field import create_custom_field
@@ -17,7 +16,6 @@ def after_install():
1716
ensure_contact_custom_fields()
1817
create_roles()
1918
create_users_profiles()
20-
install_ffmpeg()
2119
add_default_limited_roles()
2220
# =================================================================================
2321
def create_roles():
@@ -101,14 +99,6 @@ def create_users_profiles():
10199

102100
frappe.db.commit()
103101
# =================================================================================
104-
def install_ffmpeg():
105-
try:
106-
subprocess.run(["sudo", "apt", "update", "--fix-missing" , "-y",], check=True)
107-
subprocess.run(["sudo", "apt", "install", "ffmpeg", "--fix-missing" , "-y"], check=True)
108-
except subprocess.CalledProcessError as e:
109-
print(f"An error occurred: {e}")
110-
# =================================================================================
111-
112102
def add_default_limited_roles():
113103
"""Add default roles without removing or duplicating existing roles."""
114104
DEFAULT_LIMITED_ROLES = ["Customer", "Supplier", "Student", "Instructor", "Sales Partner", "Member", "Shareholder", "Guardian"]
@@ -138,4 +128,4 @@ def add_default_limited_roles():
138128
changed = True
139129

140130
if changed:
141-
settings.save(ignore_permissions=True)
131+
settings.save(ignore_permissions=True)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from contextlib import ExitStack
2+
from unittest import TestCase
3+
from unittest.mock import patch
4+
5+
from clefincode_chat.setup import install
6+
7+
8+
class TestAfterInstall(TestCase):
9+
def test_initializes_app_without_installing_system_packages(self):
10+
helpers = (
11+
"ensure_contact_custom_fields",
12+
"create_roles",
13+
"create_users_profiles",
14+
"add_default_limited_roles",
15+
)
16+
with ExitStack() as stack:
17+
setup_steps = [
18+
stack.enter_context(patch.object(install, name)) for name in helpers
19+
]
20+
run = stack.enter_context(
21+
patch("subprocess.run", side_effect=PermissionError("No sudo access"))
22+
)
23+
24+
install.after_install()
25+
26+
run.assert_not_called()
27+
for step in setup_steps:
28+
step.assert_called_once_with()

0 commit comments

Comments
 (0)