2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

chore: throw warning that bench is being run in editable mode

This commit is contained in:
Gavin D'souza 2020-03-16 12:53:47 +05:30
parent 15b01e9451
commit 5e7ad22be9
2 changed files with 5 additions and 26 deletions

View File

@ -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()

View File

@ -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)