mirror of
https://github.com/frappe/bench.git
synced 2025-01-09 08:30:39 +00:00
refactor: Bench.sync => Bench.apps.sync
* Added missing imports * Fixed broken import paths
This commit is contained in:
parent
71d178dde9
commit
4d1ddc4722
@ -96,14 +96,14 @@ class Bench(Base, Validator):
|
||||
|
||||
app = App(app, branch=branch)
|
||||
self.apps.append(app)
|
||||
self.sync()
|
||||
self.apps.sync()
|
||||
|
||||
def uninstall(self, app):
|
||||
from bench.app import App
|
||||
|
||||
self.validate_app_uninstall(app)
|
||||
self.apps.remove(App(app, bench=self))
|
||||
self.sync()
|
||||
self.apps.sync()
|
||||
self.build()
|
||||
self.reload()
|
||||
|
||||
@ -118,17 +118,17 @@ class Bench(Base, Validator):
|
||||
if conf.get('restart_systemd_on_update'):
|
||||
restart_systemd_processes(bench_path=self.name)
|
||||
|
||||
def sync(self):
|
||||
self.apps.initialize_apps()
|
||||
with open(self.apps_txt, "w") as f:
|
||||
return f.write("\n".join(self.apps))
|
||||
|
||||
|
||||
class BenchApps(MutableSequence):
|
||||
def __init__(self, bench : Bench):
|
||||
self.bench = bench
|
||||
self.initialize_apps()
|
||||
|
||||
def sync(self):
|
||||
self.initialize_apps()
|
||||
with open(self.bench.apps_txt, "w") as f:
|
||||
return f.write("\n".join(self.apps))
|
||||
|
||||
def initialize_apps(self):
|
||||
try:
|
||||
self.apps = [x for x in os.listdir(
|
||||
|
@ -44,5 +44,5 @@ def switch_to_branch(branch, apps, upgrade=False):
|
||||
@click.command('switch-to-develop')
|
||||
def switch_to_develop(upgrade=False):
|
||||
"Switch frappe and erpnext to develop branch"
|
||||
from bench.app import switch_to_develop
|
||||
from bench.utils.app import switch_to_develop
|
||||
switch_to_develop(apps=['frappe', 'erpnext'])
|
||||
|
@ -1,5 +1,6 @@
|
||||
# imports - standard imports
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
@ -8,12 +9,13 @@ from json.decoder import JSONDecodeError
|
||||
|
||||
# imports - third party imports
|
||||
import click
|
||||
import bench
|
||||
|
||||
# imports - module imports
|
||||
from bench.utils import which, log, exec_cmd, get_bench_name, get_cmd_output
|
||||
from bench.exceptions import PatchError, ValidationError
|
||||
|
||||
# TODO: Fix this
|
||||
from bench.utils import *
|
||||
logger = logging.getLogger(bench.PROJECT_NAME)
|
||||
|
||||
|
||||
def get_env_cmd(cmd, bench_path='.'):
|
||||
@ -74,7 +76,7 @@ def update_python_packages(bench_path='.'):
|
||||
|
||||
def update_node_packages(bench_path='.'):
|
||||
print('Updating node packages...')
|
||||
from bench.app import get_develop_version
|
||||
from bench.utils.app import get_develop_version
|
||||
from distutils.version import LooseVersion
|
||||
v = LooseVersion(get_develop_version('frappe', bench_path = bench_path))
|
||||
|
||||
@ -302,7 +304,7 @@ def update(pull=False, apps=None, patch=False, build=False, requirements=False,
|
||||
import re
|
||||
from bench import patches
|
||||
from bench.utils import clear_command_cache, pause_exec, log
|
||||
from bench.utils.bench import restart_supervisor_processes, restart_systemd_processes
|
||||
from bench.utils.bench import restart_supervisor_processes, restart_systemd_processes, backup_all_sites
|
||||
from bench.app import pull_apps
|
||||
from bench.utils.app import is_version_upgrade
|
||||
from bench.config.common_site_config import update_config
|
||||
|
@ -57,7 +57,7 @@ def init(path, apps_path=None, no_procfile=False, no_backups=False,
|
||||
if apps_path:
|
||||
install_apps_from_path(apps_path, bench_path=path)
|
||||
|
||||
bench.sync()
|
||||
bench.apps.sync()
|
||||
|
||||
if not skip_assets:
|
||||
build_assets(bench_path=path)
|
||||
|
@ -3,9 +3,6 @@ import itertools
|
||||
import json
|
||||
import os
|
||||
|
||||
# TODO: Fix this
|
||||
from bench.utils import *
|
||||
|
||||
|
||||
def update_translations_p(args):
|
||||
import requests
|
||||
|
Loading…
Reference in New Issue
Block a user