| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """This module holds utilities which make writing recipes easier.""" | 5 """This module holds utilities which make writing configs easier.""" |
| 6 | 6 |
| 7 import json | 7 import json |
| 8 | 8 |
| 9 | 9 |
| 10 class Recipe(object): | 10 class Config(object): |
| 11 """Base class for all recipes. | 11 """Base class for all configs. |
| 12 | 12 |
| 13 Provides methods that are expected to be overridden by child classes. Also | 13 Provides methods that are expected to be overridden by child classes. Also |
| 14 provides an command-line parsing method that converts the unified command-line | 14 provides an command-line parsing method that converts the unified command-line |
| 15 interface used in depot_tools to the unified python interface defined here.""" | 15 interface used in depot_tools to the unified python interface defined here.""" |
| 16 | 16 |
| 17 @staticmethod | 17 @staticmethod |
| 18 def fetch_spec(_props): | 18 def fetch_spec(_props): |
| 19 """Returns instructions to check out the project, conditioned on |props|.""" | 19 """Returns instructions to check out the project, conditioned on |props|.""" |
| 20 raise NotImplementedError | 20 raise NotImplementedError |
| 21 | 21 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 41 return 1 | 41 return 1 |
| 42 | 42 |
| 43 method = methods[argv[1]] | 43 method = methods[argv[1]] |
| 44 props = dict(x.split('=', 1) for x in (y.lstrip('-') for y in argv[2:])) | 44 props = dict(x.split('=', 1) for x in (y.lstrip('-') for y in argv[2:])) |
| 45 | 45 |
| 46 self.output(method(props)) | 46 self.output(method(props)) |
| 47 | 47 |
| 48 @staticmethod | 48 @staticmethod |
| 49 def output(data): | 49 def output(data): |
| 50 print(json.dumps(data)) | 50 print(json.dumps(data)) |
| OLD | NEW |