comparison examples/hotinstall.py @ 204:388b4bb3516c

add hot install template
author Jeff Hammel <k0scist@gmail.com>
date Tue, 28 Oct 2014 13:47:43 -0700
parents
children
comparison
equal deleted inserted replaced
203:84be91d59996 204:388b4bb3516c
1 # python requirements
2 # (key, value) = (module, PyPI name)
3 requirements = [('boto', 'boto'),
4 ('tempita', 'tempita')]
5 for module, package in requirements:
6 try:
7 globals()[module] = __import__(module)
8 except ImportError:
9 # install requirement and try again
10 import subprocess
11 subprocess.check_call(['pip', 'install', package])
12 args = [sys.executable] + sys.argv
13 os.execl(sys.executable, *args)