Add method
kwarg for python.install_pip()
ugh, this still needs to be better probably
This commit is contained in:
parent
6ebc5bbf59
commit
19fcc94dc7
|
@ -33,6 +33,7 @@ deploy = make_deploy(__file__)
|
|||
|
||||
|
||||
def bootstrap_python(c, pip_from_apt=True, pip_eager=True,
|
||||
pip_method=None,
|
||||
pip_auto=False,
|
||||
pip_package_name=None,
|
||||
virtualenvwrapper_from_apt=False,
|
||||
|
@ -54,7 +55,8 @@ def bootstrap_python(c, pip_from_apt=True, pip_eager=True,
|
|||
apt.install(c, 'python-dev')
|
||||
|
||||
# pip
|
||||
install_pip(c, auto=pip_auto, python3=python3,
|
||||
install_pip(c, method=pip_method, python3=python3,
|
||||
auto=pip_auto,
|
||||
use_apt=pip_from_apt,
|
||||
apt_package_name=pip_package_name,
|
||||
eager=pip_eager)
|
||||
|
@ -109,7 +111,8 @@ def install_python(c, version, globally=False, verbose=False):
|
|||
version, short_version))
|
||||
|
||||
|
||||
def install_pip(c, auto=False, python3=False,
|
||||
def install_pip(c, method=None,
|
||||
auto=False, python3=False,
|
||||
use_apt=False, apt_package_name=None,
|
||||
eager=True):
|
||||
"""
|
||||
|
@ -120,7 +123,19 @@ def install_pip(c, auto=False, python3=False,
|
|||
if not c.sudo('which {}'.format(pip_), warn=True).failed:
|
||||
return
|
||||
|
||||
if auto: # try apt first, then fall back to get-pip.py
|
||||
if method == 'apt':
|
||||
package = apt_package_name
|
||||
if not package:
|
||||
package = 'python3-pip' if python3 else 'python-pip'
|
||||
apt.install(c, package, warn=True)
|
||||
|
||||
elif method == 'get-pip':
|
||||
c.sudo('wget -O get-pip.py https://bootstrap.pypa.io/get-pip.py')
|
||||
python = 'python3' if python3 else 'python2'
|
||||
c.sudo('{} get-pip.py'.format(python))
|
||||
c.sudo('rm get-pip.py')
|
||||
|
||||
elif auto: # try apt first, then fall back to get-pip.py
|
||||
package = apt_package_name
|
||||
if not package:
|
||||
package = 'python3-pip' if python3 else 'python-pip'
|
||||
|
|
Loading…
Reference in a new issue