Created
August 9, 2013 08:41
-
-
Save tarunbhardwaj/6192089 to your computer and use it in GitHub Desktop.
Script to install package using .travis.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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