+def upload_requirements_bundle():
+ "Create a pybundle from requirements.txt file and upload it"
+ print '>>> upload requirements bundle'
+ require('release', provided_by=[deploy])
+ requirements_mtime = os.path.getmtime('requirements.txt')
+ pybundle_mtime = 0
+ try:
+ pybundle_mtime = os.path.getmtime('requirements.pybundle')
+ except os.error:
+ pass
+ if pybundle_mtime < requirements_mtime:
+ pip_options = file('pip-options.txt').read().strip()
+ local('pip bundle %s -r requirements.txt requirements.pybundle' % pip_options)
+ put('requirements.pybundle', '%(path)s/releases/%(release)s' % env)
+