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

Fixed Debian 7, added version check

This commit is contained in:
Valmik Jangla 2016-07-31 22:22:15 -07:00
parent 5871354e16
commit 9811ad24d2
3 changed files with 37 additions and 3 deletions

View File

@ -19,5 +19,5 @@
when: ansible_distribution == 'MacOSX' when: ansible_distribution == 'MacOSX'
- name: Set /tmp/.bench folder perms - name: Set /tmp/.bench folder perms
command: 'chown -R {{ frappe_user }}:{{ frappe_user }} {{ repo_path }}' command: 'chown -R {{ frappe_user }}:{{ frappe_user }} {{ repo_path }}'
when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'CentOS' or ansible_distribution == 'Debian' when: ansible_distribution == 'Ubuntu' or ansible_distribution == 'CentOS' or ansible_distribution == 'Debian'

16
playbooks/develop/debian.yml Normal file → Executable file
View File

@ -9,6 +9,22 @@
tasks: tasks:
- name: Add dotdeb apt repository key for Debian < 8
apt_key:
url: http://www.dotdeb.org/dotdeb.gpg
state: present
become: yes
become_user: root
when: ansible_distribution == 'Debian' and ansible_distribution_version | version_compare('8', 'lt')
- name: Add dotdeb apt repository for redis-server for Debian < 8
apt_repository:
repo: 'deb http://packages.dotdeb.org wheezy all'
state: present
become: yes
become_user: root
when: ansible_distribution == 'Debian' and ansible_distribution_version | version_compare('8', 'lt')
# install pre-requisites # install pre-requisites
- name: install prequisites - name: install prequisites
apt: pkg={{ item }} state=present apt: pkg={{ item }} state=present

View File

@ -1,12 +1,12 @@
# wget setup_frappe.py | python # wget setup_frappe.py | python
import os, sys, subprocess, getpass, json, multiprocessing, shutil import os, sys, subprocess, getpass, json, multiprocessing, shutil, platform
from distutils.spawn import find_executable from distutils.spawn import find_executable
tmp_bench_repo = '/tmp/.bench' tmp_bench_repo = '/tmp/.bench'
def install_bench(args): def install_bench(args):
check_distribution_compatibility()
check_brew_installed() check_brew_installed()
# pre-requisites for bench repo cloning # pre-requisites for bench repo cloning
install_package('curl') install_package('curl')
install_package('wget') install_package('wget')
@ -113,6 +113,24 @@ def install_bench(args):
if os.path.exists(tmp_bench_repo): if os.path.exists(tmp_bench_repo):
shutil.rmtree(tmp_bench_repo) shutil.rmtree(tmp_bench_repo)
def check_distribution_compatibility():
supported_dists = {'ubuntu': [14, 15, 16], 'debian': [7, 8], 'centos': [7]}
dist_name, dist_version = get_distribution_info()
for dist, versions in supported_dists.iteritems():
if dist_name == dist:
if dist_version in versions:
return
print "We currently do not support {0} {1}. Aborting installation!".format(dist_name, dist_version)
if dist_name in supported_dists:
print "Install on {0} {1} instead".format(dist_name, supported_dists[dist_name][-1])
sys.exit(1)
def get_distribution_info():
current_dist = platform.dist()
# return distribution name and major version
return current_dist[0].lower(), int(float(current_dist[1]))
def install_python27(): def install_python27():
version = (sys.version_info[0], sys.version_info[1]) version = (sys.version_info[0], sys.version_info[1])