Add basic support for 'pythonz' utility

This commit is contained in:
Lance Edgar 2019-01-24 15:54:38 -06:00
parent 1962b62f11
commit dcb2282172

View file

@ -37,6 +37,31 @@ from fabric.contrib.files import exists, append
from rattail_fabric import apt, mkdir from rattail_fabric import apt, mkdir
def install_pythonz():
"""
Install the 'pythonz' utility, for installing arbitrary versions of python.
Note that this uses 'curl' so that should already be installed.
https://github.com/saghul/pythonz/blob/master/README.rst#installation
"""
if not exists('/usr/local/pythonz'):
if not exists('/usr/local/src/pythonz'):
mkdir('/usr/local/src/pythonz')
if not exists('/usr/local/src/pythonz/pythonz-install'):
sudo('curl -kL -o /usr/local/src/pythonz/pythonz-install https://raw.github.com/saghul/pythonz/master/pythonz-install')
sudo('chmod +x /usr/local/src/pythonz/pythonz-install')
sudo('/usr/local/src/pythonz/pythonz-install')
def install_python(version):
"""
Install a specific version of python, via pythonz.
"""
if not exists('/usr/local/pythonz/pythons/CPython-{}'.format(version)):
sudo('pythonz install {}'.format(version))
def install_pip(use_apt=False, eager=True): def install_pip(use_apt=False, eager=True):
""" """
Install/upgrade the Pip installer for Python. Install/upgrade the Pip installer for Python.