diff --git a/bench/app.py b/bench/app.py index 8b165b2b..90853c45 100755 --- a/bench/app.py +++ b/bench/app.py @@ -20,7 +20,7 @@ from six.moves import reload_module # imports - module imports import bench from bench.config.common_site_config import get_config -from bench.utils import CommandFailedError, build_assets, check_git_for_shallow_clone, exec_cmd, get_cmd_output, get_frappe, restart_supervisor_processes, restart_systemd_processes, run_frappe_cmd +from bench.utils import color, CommandFailedError, build_assets, check_git_for_shallow_clone, exec_cmd, get_cmd_output, get_frappe, restart_supervisor_processes, restart_systemd_processes, run_frappe_cmd logging.basicConfig(level="INFO") @@ -173,7 +173,7 @@ def new_app(app, bench_path='.'): def install_app(app, bench_path=".", verbose=False, no_cache=False, postprocess=True, skip_assets=False): - logger.info("installing {}".format(app)) + print('\n{0}Installing {1}{2}'.format(color.yellow, app, color.nc)) pip_path = os.path.join(bench_path, "env", "bin", "pip") quiet_flag = "-q" if not verbose else "" diff --git a/bench/commands/setup.py b/bench/commands/setup.py index 2e516496..973eeff2 100755 --- a/bench/commands/setup.py +++ b/bench/commands/setup.py @@ -128,13 +128,17 @@ def setup_socketio(): @click.option("--node", help="Update only Node packages", default=False, is_flag=True) @click.option("--python", help="Update only Python packages", default=False, is_flag=True) def setup_requirements(node=False, python=False): - if not node: - from bench.utils import update_requirements as setup_python_packages - setup_python_packages() + if not (node or python): + from bench.utils import update_requirements + update_requirements() - if not python: - from bench.utils import update_node_packages as setup_node_packages - setup_node_packages() + elif not node: + from bench.utils import update_python_packages + update_python_packages() + + elif not python: + from bench.utils import update_node_packages + update_node_packages() @click.command("manager", help="Setup bench-manager.local site with the bench_manager app installed on it") diff --git a/bench/utils.py b/bench/utils.py index 67ff3364..5740d50a 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -564,15 +564,26 @@ def update_env_pip(bench_path): def update_requirements(bench_path='.'): from bench.app import get_apps, install_app - print('Updating Python libraries...') + print('Installing applications...') - # update env pip update_env_pip(bench_path) for app in get_apps(): install_app(app, bench_path=bench_path, skip_assets=True) +def update_python_packages(bench_path='.'): + from bench.app import get_apps + pip_path = os.path.join(bench_path, "env", "bin", "pip") + print('Updating Python libraries...') + + update_env_pip(bench_path) + for app in get_apps(): + print('\n{0}Installing python dependencies for {1}{2}'.format(color.yellow, app, color.nc)) + app_path = os.path.join(bench_path, "apps", app) + exec_cmd("{0} install -q -U -e {1}".format(pip_path, app_path), cwd=bench_path) + + def update_node_packages(bench_path='.'): print('Updating node packages...') from bench.app import get_develop_version