mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
build: Add Python 3 support (see issue #2856)
This commit is contained in:
@@ -93,6 +93,8 @@ the input will be replaced with "bar":
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
from optparse import OptionParser
|
||||
import os
|
||||
import sys
|
||||
@@ -100,7 +102,7 @@ import sys
|
||||
try:
|
||||
# May already be in the import path.
|
||||
import gn_helpers
|
||||
except ImportError, e:
|
||||
except ImportError as e:
|
||||
# Add src/build to import path.
|
||||
cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
|
||||
src_dir = os.path.abspath(os.path.join(cef_dir, os.pardir))
|
||||
@@ -112,10 +114,10 @@ def LoadPythonDictionary(path):
|
||||
file_string = open(path).read()
|
||||
try:
|
||||
file_data = eval(file_string, {'__builtins__': None}, None)
|
||||
except SyntaxError, e:
|
||||
except SyntaxError as e:
|
||||
e.filename = path
|
||||
raise
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
raise Exception("Unexpected error while reading %s: %s" % (path, str(e)))
|
||||
|
||||
assert isinstance(file_data, dict), "%s does not eval to a dictionary" % path
|
||||
@@ -194,11 +196,11 @@ def main():
|
||||
data[key[:-1]] = data[key]
|
||||
del data[key]
|
||||
|
||||
print gn_helpers.ToGNString(data)
|
||||
print(gn_helpers.ToGNString(data))
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
except Exception, e:
|
||||
print str(e)
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
sys.exit(1)
|
||||
|
Reference in New Issue
Block a user