Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: third_party/closure_compiler/compile_modules.py

Issue 410333002: Closure compilation config: switch from JSON to Python dict (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@flattenhtml
Patch Set: Print raw config file content Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « compiled_resources.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/closure_compiler/compile_modules.py
diff --git a/third_party/closure_compiler/compile_modules.py b/third_party/closure_compiler/compile_modules.py
index e661cc0b3ffb42674e9d2ca9eca64546bdb8434a..b05d5e87edfaa4c024eebbea59e66016ff803a76 100755
--- a/third_party/closure_compiler/compile_modules.py
+++ b/third_party/closure_compiler/compile_modules.py
@@ -4,13 +4,9 @@
# found in the LICENSE file.
import argparse
+import ast
from checker import Checker as Checker
import os
-try:
- import json
-except:
- import simplejson as json
-
class Module(object):
@@ -50,12 +46,12 @@ class ModuleParser(object):
return self._cache[file_path]
file = open(file_path, "r")
- data = json.load(file)
+ file_content = file.read()
Dan Beam 2014/07/24 18:34:42 nit: file_contents = open(file_path, "r").read()
Vitaly Pavlenko 2014/07/25 22:09:22 I think that's better: with open(file_path) as fil
+ data = ast.literal_eval(file_content)
file.close()
if self._verbose:
- pretty_json = json.dumps(data, indent=2, separators=(',', ': ')).strip()
- print "(INFO) Layout: " + os.linesep + pretty_json + os.linesep
+ print "(INFO) Layout: " + os.linesep + file_content + os.linesep
self._cache[file_path] = [Module.from_dict(m) for m in data]
return self._cache[file_path]
« no previous file with comments | « compiled_resources.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698