Make tools/gn compatible with Python 3 (flutter/engine#26321)
Python 2.7 was end-of-lifed on 2020-01-01. This makes tools/gn compatible with both Python 2.7 and Python 3. Issue: https://github.com/flutter/flutter/issues/83043
This commit is contained in:
@@ -66,11 +66,16 @@ def get_out_dir(args):
|
||||
return os.path.join(args.out_dir, 'out', '_'.join(target_dir))
|
||||
|
||||
def to_command_line(gn_args):
|
||||
"""Converts the arguments dictionary to a list of command-line arguments.
|
||||
|
||||
Args:
|
||||
gn_args: GN arguments dictionary generated by to_gn_args().
|
||||
"""
|
||||
def merge(key, value):
|
||||
if type(value) is bool:
|
||||
return '%s=%s' % (key, 'true' if value else 'false')
|
||||
return '%s="%s"' % (key, value)
|
||||
return [merge(x, y) for x, y in gn_args.iteritems()]
|
||||
return [merge(x, y) for x, y in gn_args.items()]
|
||||
|
||||
def cpu_for_target_arch(arch):
|
||||
if arch in ['ia32', 'arm', 'armv6', 'armv5te', 'mips',
|
||||
@@ -327,7 +332,7 @@ def to_gn_args(args):
|
||||
gn_args['is_ubsan'] = True
|
||||
|
||||
if args.enable_vulkan_validation_layers:
|
||||
if args.target_os is not 'fuchsia':
|
||||
if args.target_os != 'fuchsia':
|
||||
print('Vulkan validation layers are currently only supported on Fuchsia targets.')
|
||||
sys.exit(1)
|
||||
gn_args['enable_vulkan_validation_layers'] = True
|
||||
|
||||
Reference in New Issue
Block a user