OLD | NEW |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # 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 |
4 # found in the LICENSE file. | 3 # found in the LICENSE file. |
5 | 4 |
6 import json | 5 import json |
7 | 6 |
8 MANIFEST_VERSION = 2 | 7 MANIFEST_VERSION = 2 |
9 | 8 |
10 # Some commonly-used key names. | 9 # Some commonly-used key names. |
11 ARCHIVES_KEY = 'archives' | 10 ARCHIVES_KEY = 'archives' |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 self._manifest_data[key] = value | 343 self._manifest_data[key] = value |
345 self.Validate() | 344 self.Validate() |
346 | 345 |
347 def GetManifestString(self): | 346 def GetManifestString(self): |
348 """Returns the current JSON manifest object, pretty-printed""" | 347 """Returns the current JSON manifest object, pretty-printed""" |
349 pretty_string = json.dumps(self._manifest_data, sort_keys=False, indent=2) | 348 pretty_string = json.dumps(self._manifest_data, sort_keys=False, indent=2) |
350 # json.dumps sometimes returns trailing whitespace and does not put | 349 # json.dumps sometimes returns trailing whitespace and does not put |
351 # a newline at the end. This code fixes these problems. | 350 # a newline at the end. This code fixes these problems. |
352 pretty_lines = pretty_string.split('\n') | 351 pretty_lines = pretty_string.split('\n') |
353 return '\n'.join([line.rstrip() for line in pretty_lines]) + '\n' | 352 return '\n'.join([line.rstrip() for line in pretty_lines]) + '\n' |
OLD | NEW |