[llvm] r199009 - lit: Provide source locations in cfg files with older Python versions
Alp Toker
alp at nuanti.com
Sat Jan 11 06:34:18 PST 2014
Author: alp
Date: Sat Jan 11 08:34:18 2014
New Revision: 199009
URL: http://llvm.org/viewvc/llvm-project?rev=199009&view=rev
Log:
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 (!)
Modified:
llvm/trunk/utils/lit/lit/TestingConfig.py
Modified: llvm/trunk/utils/lit/lit/TestingConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestingConfig.py?rev=199009&r1=199008&r2=199009&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestingConfig.py (original)
+++ llvm/trunk/utils/lit/lit/TestingConfig.py Sat Jan 11 08:34:18 2014
@@ -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:
More information about the llvm-commits
mailing list