Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3144)

Unified Diff: build/gyp_chromium

Issue 896663002: gyp_chromium: Better parsing of -G command line flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/gyp_chromium
diff --git a/build/gyp_chromium b/build/gyp_chromium
index 11125751a0e5b0e515741ee8d18cd96c608a40e0..cd5cd43d3a6f6dd715d6829542111aec654b38fa 100755
--- a/build/gyp_chromium
+++ b/build/gyp_chromium
@@ -143,11 +143,26 @@ def GetOutputDirectory():
"""Returns the output directory that GYP will use."""
# GYP generator flags from the command line. We can't use optparse since we
# want to ignore all arguments other than "-G".
scottmg 2015/02/03 00:21:32 I'm a little skeptical of this comment (though sin
Sam Clegg 2015/02/03 01:20:10 Done.
- needle = '-Goutput_dir='
- cmdline_input_items = []
+ flag = '-G'
+ found_flag = False
+ needle = 'output_dir='
for item in sys.argv[1:]:
- if item.startswith(needle):
- return item[len(needle):]
+ if item == flag:
+ found_flag = True
+ continue
+
+ # Handle the two flag case (['-G', 'output_dir=foo'])
+ if found_flag:
+ found_flag = False
+ if item.startswith(needle):
+ return item[len(needle):]
+ continue
+
+ # Handle the single flag case (['-Goutput_dir=foo'])
+ if item.startswith(flag):
+ item = item[len(flag):]
+ if item.startswith(needle):
+ return item[len(needle):]
env_items = shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', ''))
needle = 'output_dir='
@@ -155,7 +170,7 @@ def GetOutputDirectory():
if item.startswith(needle):
return item[len(needle):]
- return "out"
+ return 'out'
def additional_include_files(supplemental_files, args=[]):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698