summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-01-11 14:34:18 +0000
committerAlp Toker <alp@nuanti.com>2014-01-11 14:34:18 +0000
commitca179f4de8cc4b146bab425242b2296be311c0a3 (patch)
tree092de3e2ef5f904aa727cff98eba733b8ce42313 /utils
parent1a1ec67710769ca9b733ba085696b2c0c3cd01f2 (diff)
downloadllvm-ca179f4de8cc4b146bab425242b2296be311c0a3.tar.gz
llvm-ca179f4de8cc4b146bab425242b2296be311c0a3.tar.bz2
llvm-ca179f4de8cc4b146bab425242b2296be311c0a3.tar.xz
lit: Provide source locations in cfg files with older Python versions
This commit prospectively brings the benefits of r198766 to older supported Python versions (2.5+). Tested with Python 2.6, 2.7, 3.1 and 3.3 (!) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/lit/lit/TestingConfig.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/utils/lit/lit/TestingConfig.py b/utils/lit/lit/TestingConfig.py
index 97e0de3047..eb890674a7 100644
--- a/utils/lit/lit/TestingConfig.py
+++ b/utils/lit/lit/TestingConfig.py
@@ -75,12 +75,13 @@ class TestingConfig:
# Load the config script data.
data = None
- f = open(path)
- try:
- data = f.read()
- except:
- litConfig.fatal('unable to load config file: %r' % (path,))
- f.close()
+ 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())
@@ -89,7 +90,7 @@ class TestingConfig:
cfg_globals['__file__'] = path
try:
if OldPy:
- exec("exec data in cfg_globals")
+ execfile(path, cfg_globals)
else:
exec(compile(data, path, 'exec'), cfg_globals, None)
if litConfig.debug: