2
0
mirror of https://github.com/frappe/bench.git synced 2025-02-03 19:38:24 +00:00

Added macos support for version check

This commit is contained in:
Valmik Jangla 2016-08-02 11:58:28 +05:30
parent 9811ad24d2
commit d23d7489d7
4 changed files with 25 additions and 20 deletions

View File

@ -90,6 +90,6 @@ def renew_certs():
'Do you want to continue?', 'Do you want to continue?',
abort=True) abort=True)
service('nginx', 'start')
exec_cmd("{path} renew".format(path=get_certbot_path()))
service('nginx', 'stop') service('nginx', 'stop')
exec_cmd("{path} renew".format(path=get_certbot_path()))
service('nginx', 'start')

View File

@ -74,7 +74,7 @@
# setup frappe-bench # setup frappe-bench
- include: includes/setup_bench.yml - include: includes/setup_bench.yml
when: not run_travis and without_bench_setup when: not run_travis and not without_bench_setup
# setup development environment # setup development environment
- include: includes/setup_dev_env.yml - include: includes/setup_dev_env.yml

View File

@ -74,20 +74,20 @@
become: yes become: yes
become_user: root become_user: root
- name: Add nodejs v5 repo - name: Get nodejs 6.x bash script
get_url: get_url:
url: 'https://deb.nodesource.com/setup_5.x' url: 'https://deb.nodesource.com/setup_6.x'
dest: '/tmp/setup_5.x' dest: '/tmp/setup_6.x'
mode: 0644 mode: 0644
become: yes become: yes
become_user: root become_user: root
- name: Install setup_5.x - name: Run nodejs bash script
command: /bin/bash /tmp/setup_5.x command: /bin/bash /tmp/setup_6.x
become: yes become: yes
become_user: root become_user: root
- name: Update and Install Node v5 - name: Install nodejs 6.x
apt: apt:
name: nodejs name: nodejs
state: present state: present

View File

@ -114,22 +114,27 @@ def install_bench(args):
shutil.rmtree(tmp_bench_repo) shutil.rmtree(tmp_bench_repo)
def check_distribution_compatibility(): def check_distribution_compatibility():
supported_dists = {'ubuntu': [14, 15, 16], 'debian': [7, 8], 'centos': [7]} supported_dists = {'ubuntu': [14, 15, 16], 'debian': [7, 8],
'centos': [7], 'macos': [10.9, 10.10, 10.11, 10.12]}
dist_name, dist_version = get_distribution_info() dist_name, dist_version = get_distribution_info()
for dist, versions in supported_dists.iteritems(): if dist_name in supported_dists:
if dist_name == dist: if float(dist_version) in supported_dists[dist_name]:
if dist_version in versions:
return return
print "We currently do not support {0} {1}. Aborting installation!".format(dist_name, dist_version) print "Sorry, the installer doesn't support {0} {1}. Aborting installation!".format(dist_name, dist_version)
if dist_name in supported_dists: if dist_name in supported_dists:
print "Install on {0} {1} instead".format(dist_name, supported_dists[dist_name][-1]) print "Install on {0} {1} instead".format(dist_name, supported_dists[dist_name][-1])
sys.exit(1) sys.exit(1)
def get_distribution_info(): def get_distribution_info():
current_dist = platform.dist()
# return distribution name and major version # return distribution name and major version
return current_dist[0].lower(), int(float(current_dist[1])) if platform.system() == "Linux":
current_dist = platform.dist()
return current_dist[0].lower(), current_dist[1].rsplit('.')[0]
elif platform.system() == "Darwin":
current_dist = platform.mac_ver()
return "macos", current_dist[0].rsplit('.', 1)[0]
def install_python27(): def install_python27():
version = (sys.version_info[0], sys.version_info[1]) version = (sys.version_info[0], sys.version_info[1])