2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-24 07:28:25 +00:00

[fix] installer and travis

This commit is contained in:
Anand Doshi 2016-06-28 12:11:06 +05:30
parent f6b03f488c
commit 68564849e6
4 changed files with 32 additions and 20 deletions

View File

@ -8,15 +8,18 @@ python:
install:
- sudo apt-get purge -y mysql-common mysql-server mysql-client
- sudo apt-get install --only-upgrade -y git
# - sudo python $TRAVIS_BUILD_DIR/installer/install.py --user travis --skip-bench-setup
- sudo bash $TRAVIS_BUILD_DIR/install_scripts/setup_frappe.sh --skip-install-bench --mysql-root-password travis
- mkdir -p ~/bench-repo
- cp -r $TRAVIS_BUILD_DIR/* ~/bench-repo/
- mkdir -p ~/.bench
- mkdir -p /tmp/.bench
- cp -r $TRAVIS_BUILD_DIR/* ~/.bench
- cp -r $TRAVIS_BUILD_DIR/* /tmp/.bench
- sudo python $TRAVIS_BUILD_DIR/playbooks/install.py --user travis --run-travis --production
# - sudo bash $TRAVIS_BUILD_DIR/install_scripts/setup_frappe.sh --skip-install-bench --mysql-root-password travis
# - cd ~ && sudo python bench-repo/installer/install.py --only-dependencies
script:
- cd ~
- sudo pip install --upgrade pip
- sudo pip install -e bench-repo
- sudo pip install -e ~/.bench
# - sudo python -m unittest bench.tests.test_setup_production.TestSetupProduction.test_setup_production_v6
- sudo python -m unittest -v bench.tests.test_setup_production

View File

@ -68,9 +68,13 @@
# setup MariaDB
- include: includes/setup_mariadb.yml
- debug:
var: run_travis
# setup frappe-bench
- include: includes/setup_bench.yml
when: not run_travis
# setup development environment
- include: includes/setup_dev_env.yml
when: not production
when: not production and not run_travis

View File

@ -29,21 +29,23 @@ def install_bench(args):
return
# secure pip installation
if not os.path.exists("get-pip.py"):
if find_executable('pip'):
run_os_command({
'apt-get': 'wget https://bootstrap.pypa.io/get-pip.py',
'yum': 'wget https://bootstrap.pypa.io/get-pip.py'
'yum': 'sudo pip install --upgrade setuptools pip',
'apt-get': 'sudo pip install --upgrade setuptools pip',
'brew': "sudo pip install --upgrade setuptools pip --user"
})
success = run_os_command({
'apt-get': 'sudo python get-pip.py',
'yum': 'sudo python get-pip.py',
})
else:
if not os.path.exists("get-pip.py"):
run_os_command({
'apt-get': 'wget https://bootstrap.pypa.io/get-pip.py',
'yum': 'wget https://bootstrap.pypa.io/get-pip.py'
})
if success:
run_os_command({
'pip': "sudo pip install --upgrade setuptools --user python"
success = run_os_command({
'apt-get': 'sudo python get-pip.py',
'yum': 'sudo python get-pip.py',
})
# Restricting ansible version due to following bug in ansible 2.1
@ -56,7 +58,8 @@ def install_bench(args):
could_not_install('Ansible')
# clone bench repo
clone_bench_repo(args)
if not args.run_travis:
clone_bench_repo(args)
if is_sudo_user() and not args.user and not args.production:
raise Exception('Please run this script as a non-root user with sudo privileges, but without using sudo or pass --user=USER')
@ -77,7 +80,8 @@ def install_bench(args):
elif args.production:
run_playbook('production/install.yml', sudo=True, extra_vars=extra_vars)
shutil.rmtree(tmp_bench_repo)
if os.path.exists(tmp_bench_repo):
shutil.rmtree(tmp_bench_repo)
def install_python27():
version = (sys.version_info[0], sys.version_info[1])
@ -180,7 +184,7 @@ def get_extra_vars_json(extra_args, run_travis=False):
extra_vars.update(get_passwords(run_travis))
extra_vars.update(max_worker_connections=multiprocessing.cpu_count() * 1024)
branch = 'master' if extra_args.get('setup_production') else 'develop'
branch = 'master' if extra_args.get('production') else 'develop'
extra_vars.update(branch=branch)
user = args.user or getpass.getuser()

View File

@ -9,6 +9,7 @@
# Setup Bench for production environment
- include: includes/setup_bench_production.yml
when: not run_travis
# Setup SELinux Policy, Optional can be done later
# - include: includes/setup_selinux_policy.yml