Add clang
workaround for pythonz
needed that to install python 3.6.8 on debian 12
This commit is contained in:
parent
94945fbc30
commit
ab1baaa6d2
|
@ -2,7 +2,7 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
# Rattail -- Retail Software Framework
|
# Rattail -- Retail Software Framework
|
||||||
# Copyright © 2010-2022 Lance Edgar
|
# Copyright © 2010-2023 Lance Edgar
|
||||||
#
|
#
|
||||||
# This file is part of Rattail.
|
# This file is part of Rattail.
|
||||||
#
|
#
|
||||||
|
@ -112,7 +112,8 @@ def configure_pythonz(c, user):
|
||||||
use_sudo=True)
|
use_sudo=True)
|
||||||
|
|
||||||
|
|
||||||
def install_python(c, version, globally=False, verbose=False):
|
def install_python(c, version, globally=False, verbose=False,
|
||||||
|
use_clang=False):
|
||||||
"""
|
"""
|
||||||
Install a specific version of python, via pythonz.
|
Install a specific version of python, via pythonz.
|
||||||
|
|
||||||
|
@ -121,10 +122,17 @@ def install_python(c, version, globally=False, verbose=False):
|
||||||
symlink, if installed, will use the "short" version, e.g. if the
|
symlink, if installed, will use the "short" version, e.g. if the
|
||||||
``version`` specified is ``'3.5.3'`` then the symlink will be named
|
``version`` specified is ``'3.5.3'`` then the symlink will be named
|
||||||
``'python3.5'``.
|
``'python3.5'``.
|
||||||
|
|
||||||
|
:param use_clang: Use `clang` instead of default compiler. May be
|
||||||
|
needed in rare cases for older python versions. See also
|
||||||
|
https://stackoverflow.com/a/73267352
|
||||||
"""
|
"""
|
||||||
|
if use_clang:
|
||||||
|
apt.install(c, 'clang')
|
||||||
if not exists(c, '/usr/local/pythonz/pythons/CPython-{}'.format(version)):
|
if not exists(c, '/usr/local/pythonz/pythons/CPython-{}'.format(version)):
|
||||||
|
clang = 'CC=clang' if use_clang else ''
|
||||||
verbose = '--verbose' if verbose else ''
|
verbose = '--verbose' if verbose else ''
|
||||||
c.sudo("bash -lc 'pythonz install {} {}'".format(verbose, version))
|
c.sudo(f"bash -lc '{clang} pythonz install {verbose} {version}'")
|
||||||
if globally:
|
if globally:
|
||||||
short_version = '.'.join(version.split('.')[:2])
|
short_version = '.'.join(version.split('.')[:2])
|
||||||
c.sudo('ln -sf /usr/local/pythonz/pythons/CPython-{0}/bin/python{1} /usr/local/bin/python{1}'.format(
|
c.sudo('ln -sf /usr/local/pythonz/pythons/CPython-{0}/bin/python{1} /usr/local/bin/python{1}'.format(
|
||||||
|
|
Loading…
Reference in a new issue