view examples/hotinstall.py @ 248:407dd46857e1

fix syntax error in python.py + version bump
author Jeff Hammel <k0scist@gmail.com>
date Fri, 31 Mar 2017 18:05:28 -0700
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)