| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 """ | 5 """ |
| 6 GN-related configuration functions, e.g., to produce a Config object from a GN | 6 GN-related configuration functions, e.g., to produce a Config object from a GN |
| 7 args.gn file). | 7 args.gn file). |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 | 10 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 values = {} | 114 values = {} |
| 115 with open(gn_file, "r") as f: | 115 with open(gn_file, "r") as f: |
| 116 for line in f.readlines(): | 116 for line in f.readlines(): |
| 117 line = re.sub("\s*#.*", "", line) | 117 line = re.sub("\s*#.*", "", line) |
| 118 result = re.match("^\s*(\w+)\s*=\s*(.*)\s*$", line) | 118 result = re.match("^\s*(\w+)\s*=\s*(.*)\s*$", line) |
| 119 if result: | 119 if result: |
| 120 key = result.group(1) | 120 key = result.group(1) |
| 121 value = result.group(2) | 121 value = result.group(2) |
| 122 values[key] = ast.literal_eval(TRANSLATIONS.get(value, value)) | 122 values[key] = ast.literal_eval(TRANSLATIONS.get(value, value)) |
| 123 return values | 123 return values |
| OLD | NEW |