From 8c604f38fbc7f10238e9b9bb949d085c28238fc9 Mon Sep 17 00:00:00 2001 From: Jacob Trimble Date: Thu, 11 Jun 2020 15:03:01 -0700 Subject: [PATCH] Fix style of gyp_packager.py. Change-Id: I5668da965775d9f42cf070b3c2ca23888932f1bd --- gyp_packager.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/gyp_packager.py b/gyp_packager.py index e62452912c..6f0d11b858 100755 --- a/gyp_packager.py +++ b/gyp_packager.py @@ -55,7 +55,7 @@ if __name__ == '__main__': # If we didn't get a gyp file, then fall back to assuming 'packager.gyp' from # the same directory as the script. - if [arg.endswith('.gyp') for arg in args].count(True) == 0: + if not any(arg.endswith('.gyp') for arg in args): args.append(os.path.join(src_dir, 'packager.gyp')) # Always include Chromium's common.gypi and our common.gypi. @@ -74,18 +74,17 @@ if __name__ == '__main__': 'linux_use_gold_flags': 0, 'clang_use_chrome_plugins': 0} - gyp_defines = (os.environ['GYP_DEFINES'] if os.environ.get('GYP_DEFINES') else - '') - for key in _DEFAULT_DEFINES: + gyp_defines = os.environ.get('GYP_DEFINES', '') + for key, value in _DEFAULT_DEFINES.items(): if key not in gyp_defines: - gyp_defines += ' {0}={1}'.format(key, _DEFAULT_DEFINES[key]) + gyp_defines += ' {0}={1}'.format(key, value) # Somehow gcc don't like use_sysroot. if 'clang=0' in gyp_defines and 'use_sysroot' not in gyp_defines: gyp_defines += ' use_sysroot=0' os.environ['GYP_DEFINES'] = gyp_defines.strip() # Default to ninja, but only if no generator has explicitly been set. - if not os.environ.get('GYP_GENERATORS'): + if 'GYP_GENERATORS' not in os.environ: os.environ['GYP_GENERATORS'] = 'ninja' # There shouldn't be a circular dependency relationship between .gyp files, @@ -98,11 +97,10 @@ if __name__ == '__main__': # TODO(kqyang): Find a better way to handle the depth. This workaround works # only if this script is executed in 'src' directory. - if ['--depth' in arg for arg in args].count(True) == 0: + if not any('--depth' in arg for arg in args): args.append('--depth=packager') - if (not os.environ.get('GYP_GENERATOR_FLAGS') or - ('output_dir=' not in os.environ.get('GYP_GENERATOR_FLAGS'))): + if 'output_dir=' not in os.environ.get('GYP_GENERATOR_FLAGS', ''): output_dir = os.path.join(checkout_dir, 'out') gyp_generator_flags = 'output_dir="' + output_dir + '"' if os.environ.get('GYP_GENERATOR_FLAGS'):