Index: deps2git.py |
=================================================================== |
--- deps2git.py (revision 292133) |
+++ deps2git.py (working copy) |
@@ -280,6 +280,11 @@ |
return results |
+def convert_json(option, _, value, parser): |
+ """Provide an OptionParser callback to unmarshal a JSON string.""" |
+ setattr(parser.values, option.dest, json.loads(value)) |
+ |
+ |
def main(): |
parser = optparse.OptionParser() |
parser.add_option('-d', '--deps', default='DEPS', |
@@ -300,6 +305,10 @@ |
help='top level of a gclient git cache diretory.') |
parser.add_option('-s', '--shallow', action='store_true', |
help='Use shallow checkouts when populating cache dirs.') |
+ parser.add_option('--var_overrides', action='callback', callback=convert_json, |
+ type='string', default=None, |
+ help='A dict in JSON format containing key-value pairs ' |
+ 'that will override variables used in the DEPS file.') |
parser.add_option('--no_fail_fast', action='store_true', |
help='Try to process the whole DEPS, rather than failing ' |
'on the first bad entry.') |
@@ -311,7 +320,7 @@ |
# Get the content of the DEPS file. |
deps, deps_os, include_rules, skip_child_includes, hooks, deps_vars = ( |
- deps_utils.GetDepsContent(options.deps)) |
+ deps_utils.GetDepsContent(options.deps, options.var_overrides)) |
if options.extra_rules and options.type: |
parser.error('Can\'t specify type and extra-rules at the same time.') |