OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 json | 5 import json |
6 import os.path | 6 import os.path |
7 import sys | 7 import sys |
8 | 8 |
9 # We need to get json_minify from the third_party directory. | 9 # We need to get json_minify from the third_party directory. |
10 # This is similar to what is done in chrome/common/extensions/docs/build.py | 10 # This is similar to what is done in chrome/common/extensions/docs/build.py |
11 third_party_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), | 11 third_party_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), |
12 os.pardir, os.pardir, 'third_party/') | 12 os.pardir, os.pardir, 'third_party/') |
13 if third_party_path not in sys.path: | 13 if third_party_path not in sys.path: |
14 sys.path.insert(0, third_party_path) | 14 sys.path.insert(0, third_party_path) |
15 import json_minify as minify | 15 import json_minify as minify |
16 | 16 |
17 def LoadJSON(filename): | 17 def Load(filename): |
18 with open(filename, 'r') as handle: | 18 with open(filename, 'r') as handle: |
19 return json.loads(minify.json_minify(handle.read())) | 19 return json.loads(minify.json_minify(handle.read())) |
OLD | NEW |