X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2Flit%2Flit%2FTestingConfig.py;h=eb890674a74d1ba5d92f6a652d778f551963aaec;hb=ca179f4de8cc4b146bab425242b2296be311c0a3;hp=95405e932441451ad5b8fdcd71a07b6fd76eeff3;hpb=04ca26908e9b7b414ecbb7b495c49b476b040a96;p=oota-llvm.git diff --git a/utils/lit/lit/TestingConfig.py b/utils/lit/lit/TestingConfig.py index 95405e93244..eb890674a74 100644 --- a/utils/lit/lit/TestingConfig.py +++ b/utils/lit/lit/TestingConfig.py @@ -1,7 +1,7 @@ import os import sys -PY2 = sys.version_info[0] < 3 +OldPy = sys.version_info[0] == 2 and sys.version_info[1] < 7 class TestingConfig: """" @@ -74,12 +74,14 @@ class TestingConfig: """ # Load the config script data. - f = open(path) - try: - data = f.read() - except: - litConfig.fatal('unable to load config file: %r' % (path,)) - f.close() + data = None + if not OldPy: + f = open(path) + try: + data = f.read() + except: + litConfig.fatal('unable to load config file: %r' % (path,)) + f.close() # Execute the config script to initialize the object. cfg_globals = dict(globals()) @@ -87,10 +89,10 @@ class TestingConfig: cfg_globals['lit_config'] = litConfig cfg_globals['__file__'] = path try: - if PY2: - exec("exec data in cfg_globals") + if OldPy: + execfile(path, cfg_globals) else: - exec(data, cfg_globals) + exec(compile(data, path, 'exec'), cfg_globals, None) if litConfig.debug: litConfig.note('... loaded config %r' % path) except SystemExit: