2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-09 08:30:39 +00:00

remove from appstxt

This commit is contained in:
Pratik Vyas 2014-11-20 13:00:57 +05:30
parent ffeaa462d1
commit bbf38c7faf
2 changed files with 18 additions and 4 deletions

View File

@ -18,8 +18,17 @@ def add_to_appstxt(app, bench='.'):
apps = get_apps(bench=bench)
if app not in apps:
apps.append(app)
with open(os.path.join(bench, 'sites', 'apps.txt'), 'w') as f:
return f.write('\n'.join(apps))
return write_appstxt(apps, bench=bench)
def remove_from_appstxt(app, bench='.'):
apps = get_apps(bench=bench)
if app in apps:
apps.remove(app)
return write_appstxt(apps, bench=bench)
def write_appstxt(apps, bench='.'):
with open(os.path.join(bench, 'sites', 'apps.txt'), 'w') as f:
return f.write('\n'.join(apps))
def get_app(app, git_url, branch=None, bench='.'):
logger.info('getting app {}'.format(app))

View File

@ -1,7 +1,8 @@
from .utils import exec_cmd, get_frappe
from .release import get_current_version
from .app import remove_from_appstxt
import os
import shutil
from .release import get_current_version
repos = ('frappe', 'erpnext')
@ -20,7 +21,11 @@ def migrate_to_v5(bench='.'):
def remove_shopping_cart(bench='.'):
exec_cmd("{pip} --no-input uninstall -y shopping_cart".format(pip=os.path.join(bench, 'env', 'bin', 'pip')))
exec_cmd("{frappe} all --remove_from_installed_apps shopping_cart".format(frappe=get_frappe(bench=bench)))
exec_cmd("{frappe} all --remove_from_installed_apps shopping_cart".format(
frappe=get_frappe(bench=bench)),
cwd=os.path.join(bench, 'sites'))
remove_from_appstxt('shopping_cart', bench=bench)
archived_apps_dir = os.path.join(bench, 'archived_apps')
shopping_cart_dir = os.path.join(bench, 'apps', 'shopping_cart')
if not os.path.exists(archived_apps_dir):