From 5e7ad22be9d7fde9ae4a9dfc746567fb9d3543a1 Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Mon, 16 Mar 2020 12:53:47 +0530 Subject: [PATCH] chore: throw warning that bench is being run in editable mode --- bench/cli.py | 6 +++++- bench/utils.py | 25 ------------------------- 2 files changed, 5 insertions(+), 26 deletions(-) diff --git a/bench/cli.py b/bench/cli.py index 733a0dd6..55b7fe2e 100755 --- a/bench/cli.py +++ b/bench/cli.py @@ -1,6 +1,6 @@ import click import os, sys, logging, json, pwd, subprocess -from bench.utils import is_root, PatchError, drop_privileges, get_env_cmd, get_cmd_output, get_frappe, log, is_bench_directory +from bench.utils import is_root, PatchError, drop_privileges, get_env_cmd, get_cmd_output, get_frappe, log, is_bench_directory, is_dist_editable from bench.app import get_apps from bench.config.common_site_config import get_config from bench.commands import bench_command @@ -18,6 +18,10 @@ def cli(): change_dir() change_uid() + if is_dist_editable("bench"): + log("bench is installed in editable mode!") + print("Install bench via PYPI for production instead, using `pip install frappe-bench`") + if len(sys.argv) > 2 and sys.argv[1] == "frappe": return old_frappe_cli() diff --git a/bench/utils.py b/bench/utils.py index ce4cfd64..02d76e77 100755 --- a/bench/utils.py +++ b/bench/utils.py @@ -1027,28 +1027,3 @@ def is_dist_editable(dist): if os.path.isfile(egg_link): return True return False - -def install_checker(): - development_mode = os.path.exists(os.path.expanduser("~/.bench.dev")) - bench_editable = is_dist_editable(dist="bench") - - if development_mode and bench_editable: - log("bench is setup for development mode") - - if development_mode and not bench_editable: - log("Clone bench's git repository from https://github.com/frappe/bench to develop using bench") - - if not development_mode and not bench_editable: - """Ideal scenario for bench users""" - - if not development_mode and bench_editable: - log("Installing bench in editable mode is not recommended for production", level=3) - import click - # breaking change!!! - if click.confirm("Do you wish to uninstall editable install and install bench from PYPI?"): - log("Uninstalling bench") - os.system("pip uninstall bench -y") - log("Uninstalled bench", level=2) - log("Installing bench via PYPI") - os.system("pip install frappe-bench") - log("Installed bench via PYPI", level=2)