Skip to content

Instantly share code, notes, and snippets.

@tarunbhardwaj
Created August 9, 2013 08:41
Show Gist options
  • Save tarunbhardwaj/6192089 to your computer and use it in GitHub Desktop.
Save tarunbhardwaj/6192089 to your computer and use it in GitHub Desktop.
Script to install package using .travis.yml
#!/usr/bin/env python
'''
Install package from .travis.yml
usage: travis_setup.py
@author Tarun Bhardwaj
@license FreeBSD Licence
'''
import os
try:
import yaml
except ImportError, e:
os.system('pip install pyyaml')
import yaml
def run(cmd):
'''
Execute cmd on terminal.
:param cmd: terminal command/list or commands
'''
if cmd:
map(os.system, cmd if isinstance(cmd, list) else [cmd])
file = open(".travis.yml", "r")
setup = yaml.load(file)
run(setup.get('before_install'))
run(setup.get('install'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment