mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 00:06:36 +00:00
Merge pull request #934 from gavindsouza/force-use-pypi
fix: show warning if bench is not installed via PYPI
This commit is contained in:
commit
5b955897c3
@ -1,6 +1,6 @@
|
|||||||
import click
|
import click
|
||||||
import os, sys, logging, json, pwd, subprocess
|
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, find_parent_bench
|
from bench.utils import is_root, PatchError, drop_privileges, get_env_cmd, get_cmd_output, get_frappe, log, is_dist_editable, find_parent_bench
|
||||||
from bench.app import get_apps
|
from bench.app import get_apps
|
||||||
from bench.config.common_site_config import get_config
|
from bench.config.common_site_config import get_config
|
||||||
from bench.commands import bench_command
|
from bench.commands import bench_command
|
||||||
@ -19,6 +19,9 @@ def cli():
|
|||||||
change_dir()
|
change_dir()
|
||||||
change_uid()
|
change_uid()
|
||||||
|
|
||||||
|
if is_dist_editable("bench"):
|
||||||
|
log("bench is installed in editable mode!\n\nThis is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`\n", level=3)
|
||||||
|
|
||||||
if len(sys.argv) > 2 and sys.argv[1] == "frappe":
|
if len(sys.argv) > 2 and sys.argv[1] == "frappe":
|
||||||
return old_frappe_cli()
|
return old_frappe_cli()
|
||||||
|
|
||||||
|
@ -1095,6 +1095,15 @@ def migrate_env(python, backup=False):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
def is_dist_editable(dist):
|
||||||
|
"""Is distribution an editable install?"""
|
||||||
|
for path_item in sys.path:
|
||||||
|
egg_link = os.path.join(path_item, dist + '.egg-link')
|
||||||
|
if os.path.isfile(egg_link):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def find_parent_bench(path):
|
def find_parent_bench(path):
|
||||||
"""Checks if parent directories are benches"""
|
"""Checks if parent directories are benches"""
|
||||||
if is_bench_directory(directory=path):
|
if is_bench_directory(directory=path):
|
||||||
|
Loading…
Reference in New Issue
Block a user