2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 00:37:51 +00:00

[Fix] Updated the patch to find node executable as well as provide installation instructions

This commit is contained in:
shreyas 2016-07-25 20:39:18 +05:30
parent be1f23a602
commit abc224f3e1

View File

@ -1,12 +1,24 @@
import click, subprocess, sys
from semantic_version import Version
from distutils.spawn import find_executable
def execute(bench_path):
expected_node_ver = Version('5.0.0')
node_exec = find_executable('node')
if node_exec:
result = subprocess.check_output([node_exec, '-v'])
else:
click.echo('\nNo node executable was found on your machine.\nPlease install node 5.x before\n'
'running "bench update".\nInstallation instructions for CentOS and Ubuntu can be found on \n'
'the following link,\n'
'"https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/"\n\n')
sys.exit(1)
result = subprocess.check_output(['node', '-v'])
node_ver = Version(result.rstrip('\n').lstrip('v'))
if node_ver < expected_node_ver:
click.echo('\nPlease update node version to 5.x before running the "bench update"\n\n')
click.echo('\nPlease update node version to 5.x before running "bench update".\n'
'Installation instructions for CentOS and Ubuntu can be found on the following link,\n
'"https://www.metachris.com/2015/10/how-to-install-nodejs-5-on-centos-and-ubuntu/"\n\n')
sys.exit(1)