Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add upgrade option to venv.install()

  • Loading branch information...
commit 670b1dd2d9046f98cb88b6ee8b3461a3b0231302 1 parent c942f19
Todd DeLuca authored
Showing with 8 additions and 5 deletions.
  1. +7 −4 diabric/venv.py
  2. +1 −1  setup.py
View
11 diabric/venv.py
@@ -80,7 +80,7 @@ def create(venv, python='python', virtualenv_script=None):
run('{} {} --distribute {}'.format(python, script_path, venv))
-def install(venv, requirements):
+def install(venv, requirements, upgrade=False):
'''
venv: virtual environment directory to create.
requirements: local path of requirements.txt file to be copied to venv dir
@@ -89,7 +89,9 @@ def install(venv, requirements):
'''
remote_path = os.path.join(venv, 'requirements.txt')
put(requirements, remote_path)
- run('{} install -r {}'.format(pip(venv), remote_path))
+ upgrade_opt = '--upgrade' if upgrade else ''
+ run('{pip} install {upgrade_opt} -r {requirements}'.format(
+ pip=pip(venv), upgrade_opt=upgrade_opt, requirements=remote_path))
@@ -114,12 +116,13 @@ def run(self, *args, **kwargs):
class InstallVenv(Task):
- def __init__(self, venv, requirements):
+ def __init__(self, venv, requirements, upgrade=False):
self.venv = venv
self.requirements = requirements
+ self.upgrade = upgrade
def run(self, *args, **kwargs):
- install(self.venv, self.requirements)
+ install(self.venv, self.requirements, self.upgrade)
class RemoveVenv(Task):
View
2  setup.py
@@ -4,7 +4,7 @@
setup(
name = 'diabric',
- version = '0.1.6',
+ version = '0.2.0',
license = 'MIT',
description = 'Diabolically atomic Python Fabric fabfile tasks and utilities.',
long_description = open(os.path.join(os.path.dirname(__file__), 'README.md')).read(),
Please sign in to comment.
Something went wrong with that request. Please try again.