Add 'pythonz' logic, for installing arbitrary versions of python
This commit is contained in:
parent
32dda9742e
commit
3b3cb8ab82
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2019 Lance Edgar
|
# Copyright © 2010-2020 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -55,6 +55,35 @@ def bootstrap_python(c, pip_from_apt=True, workon_home='/srv/envs', user='rattai
|
||||||
deploy(c, 'python/premkvirtualenv', '{}/premkvirtualenv'.format(workon_home), owner=user, use_sudo=True)
|
deploy(c, 'python/premkvirtualenv', '{}/premkvirtualenv'.format(workon_home), owner=user, use_sudo=True)
|
||||||
|
|
||||||
|
|
||||||
|
def install_pythonz(c):
|
||||||
|
"""
|
||||||
|
Install the 'pythonz' utility, for installing arbitrary versions of python.
|
||||||
|
|
||||||
|
https://github.com/saghul/pythonz/blob/master/README.rst#installation
|
||||||
|
"""
|
||||||
|
apt.install(
|
||||||
|
c,
|
||||||
|
'curl',
|
||||||
|
'zlib1g-dev', # seems to be needed when building python
|
||||||
|
)
|
||||||
|
if not exists(c, '/usr/local/pythonz'):
|
||||||
|
if not exists(c, '/usr/local/src/pythonz'):
|
||||||
|
mkdir(c, '/usr/local/src/pythonz', use_sudo=True)
|
||||||
|
if not exists(c, '/usr/local/src/pythonz/pythonz-install'):
|
||||||
|
c.sudo('curl -kL -o /usr/local/src/pythonz/pythonz-install https://raw.github.com/saghul/pythonz/master/pythonz-install')
|
||||||
|
c.sudo('chmod +x /usr/local/src/pythonz/pythonz-install')
|
||||||
|
c.sudo('/usr/local/src/pythonz/pythonz-install')
|
||||||
|
|
||||||
|
|
||||||
|
def install_python(c, version, verbose=False):
|
||||||
|
"""
|
||||||
|
Install a specific version of python, via pythonz.
|
||||||
|
"""
|
||||||
|
if not exists(c, '/usr/local/pythonz/pythons/CPython-{}'.format(version)):
|
||||||
|
verbose = '--verbose' if verbose else ''
|
||||||
|
c.sudo("bash -lc 'pythonz install {} {}'".format(verbose, version))
|
||||||
|
|
||||||
|
|
||||||
def install_pip(c, use_apt=False, eager=True):
|
def install_pip(c, use_apt=False, eager=True):
|
||||||
"""
|
"""
|
||||||
Install/upgrade the Pip installer for Python.
|
Install/upgrade the Pip installer for Python.
|
||||||
|
|
Loading…
Reference in a new issue