Do *not* pass --upgrade
flag by default, for pip install
must now specify pip('pkg', upgrade=True) if you want an upgrade
This commit is contained in:
parent
c658cd5c38
commit
e542f45638
|
@ -50,21 +50,26 @@ def install_pip(use_apt=False):
|
|||
apt.install('python-pkg-resources', 'python-setuptools')
|
||||
sudo('easy_install pip')
|
||||
sudo('apt-get --assume-yes purge python-setuptools')
|
||||
pip('setuptools')
|
||||
pip('pip', 'wheel', 'ndg-httpsclient')
|
||||
pip('setuptools')
|
||||
pip('pip', upgrade=True)
|
||||
pip('setuptools', 'wheel', 'ndg-httpsclient', upgrade=True, upgrade_strategiy='eager')
|
||||
|
||||
|
||||
def pip(*packages, **kwargs):
|
||||
"""
|
||||
Install one or more packages via ``pip install``.
|
||||
"""
|
||||
upgrade = kwargs.pop('upgrade', False)
|
||||
upgrade = '--upgrade' if upgrade else ''
|
||||
upgrade_strategy = kwargs.pop('upgrade_strategy', None)
|
||||
if upgrade_strategy:
|
||||
if upgrade and upgrade_strategy:
|
||||
upgrade_strategy = '--upgrade-strategy {}'.format(upgrade_strategy)
|
||||
else:
|
||||
upgrade_strategy = ''
|
||||
if kwargs:
|
||||
abort("Unknown kwargs for pip(): {}".format(kwargs))
|
||||
packages = ["'{}'".format(p) for p in packages]
|
||||
sudo('pip install --upgrade {} {}'.format(upgrade_strategy or '', ' '.join(packages)))
|
||||
sudo('pip install {} {} {}'.format(upgrade, upgrade_strategy, ' '.join(packages)))
|
||||
|
||||
|
||||
def install_virtualenvwrapper(workon_home=None, user='root', use_apt=False):
|
||||
|
@ -77,7 +82,7 @@ def install_virtualenvwrapper(workon_home=None, user='root', use_apt=False):
|
|||
if use_apt:
|
||||
apt.install('virtualenvwrapper')
|
||||
else:
|
||||
pip('virtualenvwrapper')
|
||||
pip('virtualenvwrapper', upgrade=True)
|
||||
configure_virtualenvwrapper('root', workon_home)
|
||||
if user != 'root':
|
||||
configure_virtualenvwrapper(user, workon_home)
|
||||
|
@ -117,10 +122,10 @@ def mkvirtualenv(name, python=None, user=None, workon_home=None,
|
|||
else:
|
||||
pip_req = 'pip'
|
||||
with workon(name):
|
||||
pip('six')
|
||||
pip(pip_req)
|
||||
pip('six', upgrade=True)
|
||||
pip(pip_req, upgrade=True)
|
||||
if upgrade_setuptools:
|
||||
pip('setuptools', 'wheel', 'ndg-httpsclient', upgrade_strategy=upgrade_strategy)
|
||||
pip('setuptools', 'wheel', 'ndg-httpsclient', upgrade=True, upgrade_strategy=upgrade_strategy)
|
||||
if user:
|
||||
with cdvirtualenv(name, workon_home=workon_home):
|
||||
mkdir('app/log', owner='{0}:{0}'.format(user))
|
||||
|
|
Loading…
Reference in a new issue