llvm.org GIT mirror llvm / ca179f4
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 Alp Toker 5 years ago
1 changed file(s) with 8 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
7474
7575 # Load the config script data.
7676 data = None
77 f = open(path)
78 try:
79 data = f.read()
80 except:
81 litConfig.fatal('unable to load config file: %r' % (path,))
82 f.close()
77 if not OldPy:
78 f = open(path)
79 try:
80 data = f.read()
81 except:
82 litConfig.fatal('unable to load config file: %r' % (path,))
83 f.close()
8384
8485 # Execute the config script to initialize the object.
8586 cfg_globals = dict(globals())
8889 cfg_globals['__file__'] = path
8990 try:
9091 if OldPy:
91 exec("exec data in cfg_globals")
92 execfile(path, cfg_globals)
9293 else:
9394 exec(compile(data, path, 'exec'), cfg_globals, None)
9495 if litConfig.debug: