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

Side by Side Diff: pylib/gyp/input.py

Issue 2094021: Raise an error when a configuration dictionary contains invalid keys.... (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/configurations/invalid/actions.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2009 Google Inc. All rights reserved. 3 # Copyright (c) 2009 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 from compiler.ast import Const 7 from compiler.ast import Const
8 from compiler.ast import Dict 8 from compiler.ast import Dict
9 from compiler.ast import Discard 9 from compiler.ast import Discard
10 from compiler.ast import List 10 from compiler.ast import List
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 'toolsets', 88 'toolsets',
89 'type', 89 'type',
90 'variants', 90 'variants',
91 91
92 # Sections that can be found inside targets or configurations, but that 92 # Sections that can be found inside targets or configurations, but that
93 # should not be propagated from targets into their configurations. 93 # should not be propagated from targets into their configurations.
94 'variables', 94 'variables',
95 ] 95 ]
96 non_configuration_keys = [] 96 non_configuration_keys = []
97 97
98 # Keys that do not belong inside a configuration dictionary.
99 invalid_configuration_keys = [
100 'actions',
101 'all_dependent_settings',
102 'configurations',
103 'dependencies',
104 'direct_dependent_settings',
105 'libraries',
106 'link_settings',
107 'sources',
108 'target_name',
109 'type',
110 ]
111
98 # Controls how the generator want the build file paths. 112 # Controls how the generator want the build file paths.
99 absolute_build_file_paths = False 113 absolute_build_file_paths = False
100 114
101 # Controls whether or not the generator supports multiple toolsets. 115 # Controls whether or not the generator supports multiple toolsets.
102 multiple_toolsets = False 116 multiple_toolsets = False
103 117
104 118
105 def GetIncludedBuildFiles(build_file_path, aux_data, included=None): 119 def GetIncludedBuildFiles(build_file_path, aux_data, included=None):
106 """Return a list of all build files included into build_file_path. 120 """Return a list of all build files included into build_file_path.
107 121
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 key_ext = key[-1:] 1791 key_ext = key[-1:]
1778 if key_ext in key_suffixes: 1792 if key_ext in key_suffixes:
1779 key_base = key[:-1] 1793 key_base = key[:-1]
1780 else: 1794 else:
1781 key_base = key 1795 key_base = key
1782 if not key_base in non_configuration_keys: 1796 if not key_base in non_configuration_keys:
1783 delete_keys.append(key) 1797 delete_keys.append(key)
1784 for key in delete_keys: 1798 for key in delete_keys:
1785 del target_dict[key] 1799 del target_dict[key]
1786 1800
1801 # Check the configurations to see if they contain invalid keys.
1802 for configuration in target_dict['configurations'].keys():
1803 configuration_dict = target_dict['configurations'][configuration]
1804 for key in configuration_dict.keys():
1805 if key in invalid_configuration_keys:
1806 raise KeyError, ('%s not allowed in the %s configuration, found in '
1807 'target %s' % (key, configuration, target))
1808
1809
1787 1810
1788 def ProcessListFiltersInDict(name, the_dict): 1811 def ProcessListFiltersInDict(name, the_dict):
1789 """Process regular expression and exclusion-based filters on lists. 1812 """Process regular expression and exclusion-based filters on lists.
1790 1813
1791 An exclusion list is in a dict key named with a trailing "!", like 1814 An exclusion list is in a dict key named with a trailing "!", like
1792 "sources!". Every item in such a list is removed from the associated 1815 "sources!". Every item in such a list is removed from the associated
1793 main list, which in this example, would be "sources". Removed items are 1816 main list, which in this example, would be "sources". Removed items are
1794 placed into a "sources_excluded" list in the dict. 1817 placed into a "sources_excluded" list in the dict.
1795 1818
1796 Regular expression (regex) filters are contained in dict keys named with a 1819 Regular expression (regex) filters are contained in dict keys named with a
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 ValidateRunAsInTarget(target, target_dict, build_file) 2211 ValidateRunAsInTarget(target, target_dict, build_file)
2189 ValidateActionsInTarget(target, target_dict, build_file) 2212 ValidateActionsInTarget(target, target_dict, build_file)
2190 2213
2191 # Generators might not expect ints. Turn them into strs. 2214 # Generators might not expect ints. Turn them into strs.
2192 TurnIntIntoStrInDict(data) 2215 TurnIntIntoStrInDict(data)
2193 2216
2194 # TODO(mark): Return |data| for now because the generator needs a list of 2217 # TODO(mark): Return |data| for now because the generator needs a list of
2195 # build files that came in. In the future, maybe it should just accept 2218 # build files that came in. In the future, maybe it should just accept
2196 # a list, and not the whole data dict. 2219 # a list, and not the whole data dict.
2197 return [flat_list, targets, data] 2220 return [flat_list, targets, data]
OLDNEW
« no previous file with comments | « no previous file | test/configurations/invalid/actions.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698