Created
September 3, 2013 22:44
-
-
Save omaraboumrad/6430617 to your computer and use it in GitHub Desktop.
sily little vagrant bootstrapper
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/python | |
import os | |
def cmd(txt): | |
print '>>> {} <<<'.format(txt) | |
return os.system(txt) >> 8 | |
def test(what): | |
return cmd(what) == 0 | |
def run(what): | |
run_once = 'apt-get update' | |
for available, install in what: | |
if not test(available): | |
if run_once: | |
cmd(run_once) | |
run_once = '' | |
cmd(install) | |
# Test | |
run([ | |
('which bzr', 'apt-get install -y bzr'), | |
('which pip', 'apt-get install -y python-pip'), | |
('which virtualenv', 'apt-get install -y python-virtualenv virtualenvwrapper'), | |
('which pyflakes pylint autopep8', 'pip install pyflakes pylint autopep8') | |
]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment