mirror of
https://github.com/frappe/bench.git
synced 2025-01-24 15:38:25 +00:00
fix: checks for bench requirements to be installed without the --user
flag via pip references: https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv
This commit is contained in:
parent
0daa5c45ed
commit
3b06683ebf
@ -537,10 +537,15 @@ def update_npm_packages(bench_path='.'):
|
||||
exec_cmd('npm install', cwd=bench_path)
|
||||
|
||||
|
||||
def in_virtual_env():
|
||||
if sys.version_info.major == 2:
|
||||
return hasattr(sys, 'real_prefix')
|
||||
if sys.version_info.major == 3:
|
||||
return sys.base_prefix != sys.prefix
|
||||
|
||||
def install_requirements(pip, req_file, user=False):
|
||||
if os.path.exists(req_file):
|
||||
# sys.real_prefix exists only in a virtualenv
|
||||
if hasattr(sys, 'real_prefix'):
|
||||
if in_virtual_env():
|
||||
user = False
|
||||
|
||||
user_flag = "--user" if user else ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user