2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-23 15:08:24 +00:00

chore: check if locales are set to avoid install breaking for click

setup + minor fixes
This commit is contained in:
Gavin D'souza 2019-12-19 14:01:24 +05:30
parent 2b6260d63e
commit bc190a6d3b

View File

@ -2,6 +2,7 @@
import os, sys, subprocess, getpass, json, multiprocessing, shutil, platform, warnings
from builtins import print as _
tmp_bench_repo = '/tmp/.bench'
tmp_log_folder = '/tmp/logs/'
log_path = os.path.join(tmp_log_folder, 'install_bench.log')
@ -58,6 +59,20 @@ def find_executable(executable, path=None):
return None
def check_environment():
needed_environ_vars = ['LANG', 'LC_ALL']
message = ''
for var in needed_environ_vars:
if var not in os.environ:
message += "\nexport {}=C.UTF-8".format(var)
if message:
print("Bench's CLI needs these to be defined!", level=3)
print("Run the following commands in shell: {}".format(message), level=2)
sys.exit()
def run_os_command(command_map):
'''command_map is a dictionary of {'executable': command}. For ex. {'apt-get': 'sudo apt-get install -y python2.7'}'''
success = True
@ -435,8 +450,14 @@ def parse_commandline_args():
return args
if __name__ == '__main__':
if not is_sudo_user():
print("Please run this script as a non-root user with sudo privileges", level=3)
sys.exit()
args = parse_commandline_args()
with warnings.catch_warnings():
warnings.simplefilter("ignore")
check_environment()
install_bench(args)
print("Frappe/ERPNext has been successfully installed!")
print("Bench + Frappe + ERPNext has been successfully installed!")