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

Unified Diff: Source/core/scripts/in_file.py

Issue 15018018: Autogenerate lists of "stable", "experimental" and "test" features from RuntimeEnabledFeatures.in (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ready for review Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/RuntimeEnabledFeatures.in ('k') | Source/core/scripts/in_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/scripts/in_file.py
diff --git a/Source/core/scripts/in_file.py b/Source/core/scripts/in_file.py
index fa7106461ae3bb21df9380a6d51cb03decbe20a6..ea5010d1d4e50a60ee2d5d74c29db8d8373e4270 100644
--- a/Source/core/scripts/in_file.py
+++ b/Source/core/scripts/in_file.py
@@ -53,16 +53,17 @@ def _is_comment(line):
return line.startswith("//") or line.startswith("#")
class InFile(object):
- def __init__(self, lines, defaults, default_parameters):
+ def __init__(self, lines, defaults, valid_values=None, default_parameters=None):
self.name_dictionaries = []
self.parameters = copy.deepcopy(default_parameters if default_parameters else {})
self._defaults = defaults
+ self._valid_values = copy.deepcopy(valid_values if valid_values else {})
self._parse(map(str.strip, lines))
@classmethod
- def load_from_path(self, path, defaults, default_parameters):
+ def load_from_path(self, path, defaults, valid_values, default_parameters):
with open(os.path.abspath(path)) as in_file:
- return InFile(in_file.readlines(), defaults, default_parameters)
+ return InFile(in_file.readlines(), defaults, valid_values, default_parameters)
def _is_sequence(self, arg):
return (not hasattr(arg, "strip")
@@ -107,6 +108,9 @@ class InFile(object):
arg_name, arg_value = arg_string, True
if arg_name not in self._defaults:
self._fatal("Unknown argument: '%s' in line:\n%s\nKnown arguments: %s" % (arg_name, line, self._defaults.keys()))
+ valid_values = self._valid_values.get(arg_name)
+ if valid_values and arg_value not in valid_values:
+ self._fatal("Unknown value: '%s' in line:\n%s\nKnown values: %s" % (arg_value, line, valid_values))
if self._is_sequence(args[arg_name]):
args[arg_name].append(arg_value)
else:
« no previous file with comments | « Source/core/page/RuntimeEnabledFeatures.in ('k') | Source/core/scripts/in_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698