Chromium Code Reviews| 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..f26506f70b8b03c0bd310b02ca5231e6c23dfad0 100644 |
| --- a/third_party/polymer/v1_0/find_unused_elements.py |
| +++ b/third_party/polymer/v1_0/find_unused_elements.py |
| @@ -11,7 +11,14 @@ to check if other elements have become unused. |
| import os |
| import re |
| import subprocess |
| +import sys |
| +import tempfile |
|
michaelpg
2017/06/06 23:34:40
remove
dpapad
2017/06/07 00:16:13
Done.
|
| +_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 +65,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 +139,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): |