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

Unified Diff: third_party/polymer/v1_0/find_unused_elements.py

Issue 2920003002: Polymer: Update find_unused_elements.py (Closed)
Patch Set: Remove tempfile Created 3 years, 6 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 | « no previous file | third_party/polymer/v1_0/reproduce.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/polymer/v1_0/find_unused_elements.py
diff --git a/third_party/polymer/v1_0/find_unused_elements.py b/third_party/polymer/v1_0/find_unused_elements.py
index 5dbacdbdcbcec33a1c587eb987f182fc234e3025..1097d800604dfff4fd49762c7c89019cd18e9b10 100644
--- a/third_party/polymer/v1_0/find_unused_elements.py
+++ b/third_party/polymer/v1_0/find_unused_elements.py
@@ -11,7 +11,13 @@ to check if other elements have become unused.
import os
import re
import subprocess
+import sys
+_HERE_PATH = os.path.dirname(__file__)
+_SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..'))
+sys.path.append(os.path.join(_SRC_PATH, 'third_party', 'node'))
+import node
+import node_modules
class UnusedElementsDetector(object):
"""Finds unused Polymer elements."""
@@ -58,8 +64,7 @@ class UnusedElementsDetector(object):
text = re.sub('<if .*?>', '', text, flags=re.IGNORECASE)
text = re.sub('</if>', '', text, flags=re.IGNORECASE)
- proc = subprocess.Popen(['uglifyjs', filename], stdout=subprocess.PIPE)
- return proc.stdout.read()
+ return node.RunNode([node_modules.PathToUglify(), filename])
@staticmethod
def __StripComments(filename):
@@ -133,11 +138,6 @@ class UnusedElementsDetector(object):
if not filename.endswith('.html') and not filename.endswith('.js'):
continue
- # Skip generated files that may include the element source.
- if filename in ('crisper.js', 'vulcanized.html',
- 'app.crisper.js', 'app.vulcanized.html'):
- continue
-
with open(os.path.join(dirpath, filename)) as f:
text = f.read()
if not re.search('/%s/' % element_dir, text):
« no previous file with comments | « no previous file | third_party/polymer/v1_0/reproduce.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698