forked from iRaySpace/erpnext-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_apps.py
27 lines (19 loc) · 821 Bytes
/
install_apps.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import frappe
from frappe.installer import install_app as _install_app
def execute(**kwargs):
"""
Use this to install apps; it checks for apps that are already installed.
bench --site [site_name] execute [module_name].install_apps.execute
--kwargs "{'apps': ['rebrandly_integration', 'printnode_integration']}"
"""
apps_installed = frappe.db.sql("""SELECT DISTINCT app_name FROM `tabModule Def`""", as_dict=True)
apps_installed = [v.app_name for v in apps_installed]
for app in kwargs['apps']:
if app not in apps_installed:
print 'Installing app {0}'.format(app)
frappe.init(site=kwargs['site'])
frappe.connect()
try:
_install_app(app, verbose=False)
finally:
frappe.destroy()