sb: Add support to search for a suitable version of python.

The command python has been removed from upstream python and python2
and python3 is now used. This patch wraps the commands in a shell
script that locates a suitable python to run.

Updates #3537
This commit is contained in:
Chris Johns
2018-10-07 20:59:45 +11:00
parent 8992d20b8c
commit 13f4c37999
27 changed files with 914 additions and 369 deletions

View File

@@ -30,10 +30,13 @@ import os
import shutil
import stat
import string
import sys
import error
windows_posix = sys.platform == 'msys'
windows = os.name == 'nt'
win_maxpath = 254
def host(path):
@@ -54,13 +57,15 @@ def host(path):
return path
def shell(path):
if isinstance(path, bytes):
path = path.decode('ascii')
if path is not None:
if windows:
path = path.encode('ascii', 'ignore')
if windows or windows_posix:
path = path.encode('ascii', 'ignore').decode('ascii')
if path.startswith('\\\\?\\'):
path = path[4:]
if len(path) > 1 and path[1] == ':':
path = '/%s%s' % (path[0], path[2:])
path = '/%s%s' % (path[0].lower(), path[2:])
path = path.replace('\\', '/')
while '//' in path:
path = path.replace('//', '/')