From a4857a808f61db3877450a1d6b1af3faf146442a Mon Sep 17 00:00:00 2001 From: scheib Date: Fri, 13 Mar 2015 17:14:01 -0700 Subject: [PATCH] Clarify warning for GYP variable merging. https://codereview.chromium.org/931643002 changed variable merging behavior for environment variables and chromium.gyp_env. The new behavior replaces variables, with the exception of GYP_DEFINES which is instead concatenated. This change clarifies the state of the variables to the developer by printing values, and more accurately describes the override behavior as 'merges with, and individual components override,'. Review URL: https://codereview.chromium.org/993143002 Cr-Original-Commit-Position: refs/heads/master@{#320609} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: eedc9ac929470feba9b8b4899c1aad14cbb5b97b --- gyp_helper.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gyp_helper.py b/gyp_helper.py index a2cc7e19c..9be2b9e01 100644 --- a/gyp_helper.py +++ b/gyp_helper.py @@ -44,11 +44,17 @@ def apply_gyp_environment_from_file(file_path): if var in os.environ: behavior = 'replaces' if var == 'GYP_DEFINES': - os.environ[var] = file_val + ' ' + os.environ[var] - behavior = 'overrides' + result = file_val + ' ' + os.environ[var] + behavior = 'merges with, and individual components override,' + else: + result = os.environ[var] print 'INFO: Environment value for "%s" %s value in %s' % ( var, behavior, os.path.abspath(file_path) ) + string_padding = max(len(var), len(file_path), len('result')) + print ' %s: %s' % (var.rjust(string_padding), os.environ[var]) + print ' %s: %s' % (file_path.rjust(string_padding), file_val) + os.environ[var] = result else: os.environ[var] = file_val