| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 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 import fnmatch | 5 import fnmatch |
| 6 import json | 6 import json |
| 7 import os | 7 import os |
| 8 import pipes | 8 import pipes |
| 9 import shlex | 9 import shlex |
| 10 import shutil | 10 import shutil |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 # https://code.google.com/p/gyp/issues/detail?id=327 | 52 # https://code.google.com/p/gyp/issues/detail?id=327 |
| 53 # is addressed. | 53 # is addressed. |
| 54 gyp_string = gyp_string.replace('##', '$') | 54 gyp_string = gyp_string.replace('##', '$') |
| 55 return shlex.split(gyp_string) | 55 return shlex.split(gyp_string) |
| 56 | 56 |
| 57 | 57 |
| 58 def CheckOptions(options, parser, required=None): | 58 def CheckOptions(options, parser, required=None): |
| 59 if not required: | 59 if not required: |
| 60 return | 60 return |
| 61 for option_name in required: | 61 for option_name in required: |
| 62 if not getattr(options, option_name): | 62 if getattr(options, option_name) is None: |
| 63 parser.error('--%s is required' % option_name.replace('_', '-')) | 63 parser.error('--%s is required' % option_name.replace('_', '-')) |
| 64 | 64 |
| 65 def WriteJson(obj, path, only_if_changed=False): | 65 def WriteJson(obj, path, only_if_changed=False): |
| 66 old_dump = None | 66 old_dump = None |
| 67 if os.path.exists(path): | 67 if os.path.exists(path): |
| 68 with open(path, 'r') as oldfile: | 68 with open(path, 'r') as oldfile: |
| 69 old_dump = oldfile.read() | 69 old_dump = oldfile.read() |
| 70 | 70 |
| 71 new_dump = json.dumps(obj) | 71 new_dump = json.dumps(obj) |
| 72 | 72 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 | 144 |
| 145 def PrintWarning(message): | 145 def PrintWarning(message): |
| 146 print 'WARNING: ' + message | 146 print 'WARNING: ' + message |
| 147 | 147 |
| 148 | 148 |
| 149 def PrintBigWarning(message): | 149 def PrintBigWarning(message): |
| 150 print '***** ' * 8 | 150 print '***** ' * 8 |
| 151 PrintWarning(message) | 151 PrintWarning(message) |
| 152 print '***** ' * 8 | 152 print '***** ' * 8 |
| OLD | NEW |