mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
lit: execfile() isn't present in Python 3.3
On the other hand, exec(compile()) doesn't work in older Python versions in the 2.x series. This commit introduces exec(compile()) with a fallback to plain exec(). That'll hopefully hit the sweet spot in terms of version support. Followup to r198766 which added enhanced source locations for lit cfg parsing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199006 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
OldPy = sys.version_info[0] == 2 and sys.version_info[1] < 6
|
OldPy = sys.version_info[0] == 2 and sys.version_info[1] < 7
|
||||||
|
|
||||||
class TestingConfig:
|
class TestingConfig:
|
||||||
""""
|
""""
|
||||||
@ -75,7 +75,6 @@ class TestingConfig:
|
|||||||
|
|
||||||
# Load the config script data.
|
# Load the config script data.
|
||||||
data = None
|
data = None
|
||||||
if OldPy:
|
|
||||||
f = open(path)
|
f = open(path)
|
||||||
try:
|
try:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
@ -92,7 +91,7 @@ class TestingConfig:
|
|||||||
if OldPy:
|
if OldPy:
|
||||||
exec("exec data in cfg_globals")
|
exec("exec data in cfg_globals")
|
||||||
else:
|
else:
|
||||||
execfile(path, cfg_globals)
|
exec(compile(data, path, 'exec'), cfg_globals, None)
|
||||||
if litConfig.debug:
|
if litConfig.debug:
|
||||||
litConfig.note('... loaded config %r' % path)
|
litConfig.note('... loaded config %r' % path)
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
|
Reference in New Issue
Block a user