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

Side by Side Diff: build/gypi_to_gn.py

Issue 1480693003: Revert of New build flag system, convert Google Now flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
« no previous file with comments | « build/config/features.gni ('k') | build/write_buildflag_header.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Converts a given gypi file to a python scope and writes the result to stdout. 5 """Converts a given gypi file to a python scope and writes the result to stdout.
6 6
7 It is assumed that the file contains a toplevel dictionary, and this script 7 It is assumed that the file contains a toplevel dictionary, and this script
8 will return that dictionary as a GN "scope" (see example below). This script 8 will return that dictionary as a GN "scope" (see example below). This script
9 does not know anything about GYP and it will not expand variables or execute 9 does not know anything about GYP and it will not expand variables or execute
10 conditions. 10 conditions.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 if 'variables' in file_data: 89 if 'variables' in file_data:
90 file_data.update(file_data['variables']) 90 file_data.update(file_data['variables'])
91 del file_data['variables'] 91 del file_data['variables']
92 92
93 # Strip any conditions. 93 # Strip any conditions.
94 if 'conditions' in file_data: 94 if 'conditions' in file_data:
95 del file_data['conditions'] 95 del file_data['conditions']
96 if 'target_conditions' in file_data: 96 if 'target_conditions' in file_data:
97 del file_data['target_conditions'] 97 del file_data['target_conditions']
98 98
99 # Strip targets and includes in the toplevel, since some files define these 99 # Strip targets in the toplevel, since some files define these and we can't
100 # and we can't slurp them in. 100 # slurp them in.
101 if 'targets' in file_data: 101 if 'targets' in file_data:
102 del file_data['targets'] 102 del file_data['targets']
103 if 'includes' in file_data:
104 del file_data['includes']
105 103
106 return file_data 104 return file_data
107 105
108 106
109 def ReplaceSubstrings(values, search_for, replace_with): 107 def ReplaceSubstrings(values, search_for, replace_with):
110 """Recursively replaces substrings in a value. 108 """Recursively replaces substrings in a value.
111 109
112 Replaces all substrings of the "search_for" with "repace_with" for all 110 Replaces all substrings of the "search_for" with "repace_with" for all
113 strings occurring in "values". This is done by recursively iterating into 111 strings occurring in "values". This is done by recursively iterating into
114 lists as well as the keys and values of dictionaries.""" 112 lists as well as the keys and values of dictionaries."""
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 del data[key] 158 del data[key]
161 159
162 print gn_helpers.ToGNString(data) 160 print gn_helpers.ToGNString(data)
163 161
164 if __name__ == '__main__': 162 if __name__ == '__main__':
165 try: 163 try:
166 main() 164 main()
167 except Exception, e: 165 except Exception, e:
168 print str(e) 166 print str(e)
169 sys.exit(1) 167 sys.exit(1)
OLDNEW
« no previous file with comments | « build/config/features.gni ('k') | build/write_buildflag_header.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698