Merge branch 'develop'

This commit is contained in:
Pratik Vyas 2014-01-07 21:45:04 +05:30
commit 5eb139a531
2 changed files with 21 additions and 41 deletions

View File

@ -1,6 +1,6 @@
{ {
"app_name": "ERPNext", "app_name": "ERPNext",
"app_version": "3.4.8", "app_version": "3.4.9",
"base_template": "app/portal/templates/base.html", "base_template": "app/portal/templates/base.html",
"modules": { "modules": {
"Accounts": { "Accounts": {

View File

@ -5,6 +5,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os, sys import os, sys
import argparse import argparse
import subprocess
is_redhat = is_debian = None is_redhat = is_debian = None
root_password = None root_password = None
@ -80,7 +81,7 @@ def validate_install():
return is_redhat, is_debian return is_redhat, is_debian
def install_using_yum(): def install_using_yum():
packages = "python python-setuptools gcc python-devel MySQL-python git memcached ntp vim-enhanced screen" packages = "gcc MySQL-python git memcached ntp vim-enhanced screen"
print "-"*80 print "-"*80
print "Installing Packages: (This may take some time)" print "Installing Packages: (This may take some time)"
@ -88,7 +89,10 @@ def install_using_yum():
print "-"*80 print "-"*80
exec_in_shell("yum install -y %s" % packages) exec_in_shell("yum install -y %s" % packages)
if not exec_in_shell("which mysql"):
try:
exec_in_shell("which mysql")
except subprocess.CalledProcessError:
packages = "mysql mysql-server mysql-devel" packages = "mysql mysql-server mysql-devel"
print "Installing Packages:", packages print "Installing Packages:", packages
exec_in_shell("yum install -y %s" % packages) exec_in_shell("yum install -y %s" % packages)
@ -101,26 +105,19 @@ def install_using_yum():
exec_in_shell('mysqladmin -u root password "%s"' % (root_password,)) exec_in_shell('mysqladmin -u root password "%s"' % (root_password,))
print "Root password set as", root_password print "Root password set as", root_password
# install htop
if not exec_in_shell("which htop"):
try:
exec_in_shell("cd /tmp && rpm -i --force http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm && yum install -y htop")
except:
pass
update_config_for_redhat() update_config_for_redhat()
def update_config_for_redhat(): def update_config_for_redhat():
import re import re
# set to autostart on startup # set to autostart on startup
for service in ("mysqld", "memcached", "ntpd"): for service in ("mysqld", "memcached"):
exec_in_shell("chkconfig --level 2345 %s on" % service) exec_in_shell("chkconfig --level 2345 %s on" % service)
exec_in_shell("service %s restart" % service) exec_in_shell("service %s restart" % service)
def install_using_apt(): def install_using_apt():
exec_in_shell("apt-get update") exec_in_shell("apt-get update")
packages = "python python-setuptools python-dev build-essential python-pip python-mysqldb git memcached ntp vim screen htop" packages = "python python-setuptools python-dev build-essential python-mysqldb git memcached ntp vim screen htop"
print "-"*80 print "-"*80
print "Installing Packages: (This may take some time)" print "Installing Packages: (This may take some time)"
print packages print packages
@ -132,7 +129,9 @@ def install_using_apt():
exec_in_shell("echo mysql-server mysql-server/root_password password %s | sudo debconf-set-selections" % root_password) exec_in_shell("echo mysql-server mysql-server/root_password password %s | sudo debconf-set-selections" % root_password)
exec_in_shell("echo mysql-server mysql-server/root_password_again password %s | sudo debconf-set-selections" % root_password) exec_in_shell("echo mysql-server mysql-server/root_password_again password %s | sudo debconf-set-selections" % root_password)
if not exec_in_shell("which mysql"): try:
exec_in_shell("which mysql")
except subprocess.CalledProcessError:
packages = "mysql-server libmysqlclient-dev" packages = "mysql-server libmysqlclient-dev"
print "Installing Packages:", packages print "Installing Packages:", packages
exec_in_shell("apt-get install -y %s" % packages) exec_in_shell("apt-get install -y %s" % packages)
@ -140,7 +139,7 @@ def install_using_apt():
update_config_for_debian() update_config_for_debian()
def update_config_for_debian(): def update_config_for_debian():
for service in ("mysql", "ntpd"): for service in ("mysql",):
exec_in_shell("service %s restart" % service) exec_in_shell("service %s restart" % service)
def install_python_modules(): def install_python_modules():
@ -148,13 +147,14 @@ def install_python_modules():
print "Installing Python Modules: (This may take some time)" print "Installing Python Modules: (This may take some time)"
print "-"*80 print "-"*80
if not exec_in_shell("which pip-2.7"): try:
exec_in_shell("which pip2.7")
except subprocess.CalledProcessError:
exec_in_shell("easy_install-2.7 pip") exec_in_shell("easy_install-2.7 pip")
exec_in_shell("pip-2.7 install --upgrade pip") exec_in_shell("pip2.7 install --upgrade setuptools --no-use-wheel")
exec_in_shell("pip-2.7 install --upgrade setuptools") exec_in_shell("pip2.7 install --upgrade setuptools")
exec_in_shell("pip-2.7 install --upgrade virtualenv") exec_in_shell("pip2.7 install {}".format(' '.join(requirements)))
exec_in_shell("pip-2.7 install {}".format(' '.join(requirements)))
def install_erpnext(install_path): def install_erpnext(install_path):
print print
@ -243,28 +243,8 @@ def post_install(install_path):
def exec_in_shell(cmd): def exec_in_shell(cmd):
# using Popen instead of os.system - as recommended by python docs # using Popen instead of os.system - as recommended by python docs
from subprocess import Popen import subprocess
import tempfile out = subprocess.check_output(cmd, shell=True)
with tempfile.TemporaryFile() as stdout:
with tempfile.TemporaryFile() as stderr:
p = Popen(cmd, shell=True, stdout=stdout, stderr=stderr)
p.wait()
stdout.seek(0)
out = stdout.read()
if out: out = out.decode('utf-8')
stderr.seek(0)
err = stderr.read()
if err: err = err.decode('utf-8')
if err and any((kw in err.lower() for kw in ["traceback", "error", "exception"])):
print out
raise Exception, err
else:
print "."
return out return out
def parse_args(): def parse_args():