Fix style of gyp_packager.py.

Change-Id: I5668da965775d9f42cf070b3c2ca23888932f1bd
This commit is contained in:
Jacob Trimble 2020-06-11 15:03:01 -07:00
parent 54bf394c03
commit 8c604f38fb
1 changed files with 7 additions and 9 deletions

View File

@ -55,7 +55,7 @@ if __name__ == '__main__':
# If we didn't get a gyp file, then fall back to assuming 'packager.gyp' from # If we didn't get a gyp file, then fall back to assuming 'packager.gyp' from
# the same directory as the script. # 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')) args.append(os.path.join(src_dir, 'packager.gyp'))
# Always include Chromium's common.gypi and our common.gypi. # Always include Chromium's common.gypi and our common.gypi.
@ -74,18 +74,17 @@ if __name__ == '__main__':
'linux_use_gold_flags': 0, 'linux_use_gold_flags': 0,
'clang_use_chrome_plugins': 0} 'clang_use_chrome_plugins': 0}
gyp_defines = (os.environ['GYP_DEFINES'] if os.environ.get('GYP_DEFINES') else gyp_defines = os.environ.get('GYP_DEFINES', '')
'') for key, value in _DEFAULT_DEFINES.items():
for key in _DEFAULT_DEFINES:
if key not in gyp_defines: 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. # Somehow gcc don't like use_sysroot.
if 'clang=0' in gyp_defines and 'use_sysroot' not in gyp_defines: if 'clang=0' in gyp_defines and 'use_sysroot' not in gyp_defines:
gyp_defines += ' use_sysroot=0' gyp_defines += ' use_sysroot=0'
os.environ['GYP_DEFINES'] = gyp_defines.strip() os.environ['GYP_DEFINES'] = gyp_defines.strip()
# Default to ninja, but only if no generator has explicitly been set. # 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' os.environ['GYP_GENERATORS'] = 'ninja'
# There shouldn't be a circular dependency relationship between .gyp files, # 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 # TODO(kqyang): Find a better way to handle the depth. This workaround works
# only if this script is executed in 'src' directory. # 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') args.append('--depth=packager')
if (not os.environ.get('GYP_GENERATOR_FLAGS') or if 'output_dir=' not in os.environ.get('GYP_GENERATOR_FLAGS', ''):
('output_dir=' not in os.environ.get('GYP_GENERATOR_FLAGS'))):
output_dir = os.path.join(checkout_dir, 'out') output_dir = os.path.join(checkout_dir, 'out')
gyp_generator_flags = 'output_dir="' + output_dir + '"' gyp_generator_flags = 'output_dir="' + output_dir + '"'
if os.environ.get('GYP_GENERATOR_FLAGS'): if os.environ.get('GYP_GENERATOR_FLAGS'):