# HG changeset patch # User Jeff Hammel # Date 1414529263 25200 # Node ID 388b4bb3516cc86186c5dcc1fcbc6b06ee2b2c6e # Parent 84be91d599968c2dbefba373cb6e29a56d88c1ba add hot install template diff -r 84be91d59996 -r 388b4bb3516c examples/hotinstall.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/hotinstall.py Tue Oct 28 13:47:43 2014 -0700 @@ -0,0 +1,13 @@ +# 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)