From 31b399abd64b2d1524cb04c4a80f989b001ff45d Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Fri, 21 May 2021 10:58:13 -0700 Subject: [PATCH] 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 --- engine/src/flutter/tools/gn | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/tools/gn b/engine/src/flutter/tools/gn index b34d22be7e..c47650c53c 100755 --- a/engine/src/flutter/tools/gn +++ b/engine/src/flutter/tools/gn @@ -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