1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[lit] Fix another Python 3 error.

Apparently we have a buildbot running Python 3.  This is going
to be fun :-/

llvm-svn: 313428
This commit is contained in:
Zachary Turner 2017-09-16 00:43:16 +00:00
parent 363a95ae02
commit 4735a2032e

View File

@ -11,13 +11,20 @@ import threading
def pythonize_bool(value):
def is_string(value):
try:
# Python 2 and Python 3 are different here.
return isinstance(value, basestring)
except NameError:
return isinstance(value, str)
if value is None:
return False
if type(value) is bool:
return value
if isinstance(value, numbers.Number):
return value != 0
if isinstance(value, basestring):
if is_string(value):
if value.lower() in ('1', 'true', 'on', 'yes'):
return True
if value.lower() in ('', '0', 'false', 'off', 'no'):