view examples/hotinstall.py @ 208:f7f7831f7c8c

add UTF-8 disclaimer
author Jeff Hammel <k0scist@gmail.com>
date Tue, 10 Feb 2015 13:19:01 -0800
parents 388b4bb3516c
children
line wrap: on
line source

# python requirements
# (key, value) = (module, PyPI name)
requirements = [('boto', 'boto'),
                ('tempita', 'tempita')]
for module, package in requirements:
    try:
        globals()[module] = __import__(module)
    except ImportError:
        # install requirement and try again
        import subprocess
        subprocess.check_call(['pip', 'install', package])
        args = [sys.executable] + sys.argv
        os.execl(sys.executable, *args)