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

Side by Side Diff: mojo/public/tools/dart_pkg.py

Issue 1710193002: Remove dead code from dart_pkg.py (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2015 The Chromium Authors. All rights reserved. 3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Utility for dart_pkg and dart_pkg_app rules""" 7 """Utility for dart_pkg and dart_pkg_app rules"""
8 8
9 import argparse 9 import argparse
10 import errno 10 import errno
11 import json 11 import json
12 import os 12 import os
13 import shutil 13 import shutil
14 import subprocess 14 import subprocess
15 import sys 15 import sys
16 16
17 # Disable lint check for finding modules:
18 # pylint: disable=F0401
19
20 sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),
21 "bindings/pylib"))
22
23 from mojom.parse.parser import Parse
24 from mojom.parse.translate import Translate
25
26 USE_LINKS = sys.platform != "win32" 17 USE_LINKS = sys.platform != "win32"
27 18
28 DART_ANALYZE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 19 DART_ANALYZE = os.path.join(os.path.dirname(os.path.abspath(__file__)),
29 "dart_analyze.py") 20 "dart_analyze.py")
30 21
31 def mojom_dart_filter(path): 22 def mojom_dart_filter(path):
32 if os.path.isdir(path): 23 if os.path.isdir(path):
33 return True 24 return True
34 # Don't include all .dart, just .mojom.dart. 25 # Don't include all .dart, just .mojom.dart.
35 return path.endswith('.mojom.dart') 26 return path.endswith('.mojom.dart')
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 remove_if_exists(path) 144 remove_if_exists(path)
154 145
155 146
156 def remove_broken_symlinks(root_dir): 147 def remove_broken_symlinks(root_dir):
157 for current_dir, _, child_files in os.walk(root_dir): 148 for current_dir, _, child_files in os.walk(root_dir):
158 for filename in child_files: 149 for filename in child_files:
159 path = os.path.join(current_dir, filename) 150 path = os.path.join(current_dir, filename)
160 remove_broken_symlink(path) 151 remove_broken_symlink(path)
161 152
162 153
163 def mojom_path(filename):
164 with open(filename) as f:
165 source = f.read()
166 tree = Parse(source, filename)
167 _, name = os.path.split(filename)
168 mojom = Translate(tree, name)
169 elements = mojom['namespace'].split('.')
170 elements.append("%s" % mojom['name'])
171 return os.path.join(*elements)
172
173
174 def analyze_entrypoints(dart_sdk, package_root, entrypoints): 154 def analyze_entrypoints(dart_sdk, package_root, entrypoints):
175 cmd = [ "python", DART_ANALYZE ] 155 cmd = [ "python", DART_ANALYZE ]
176 cmd.append("--dart-sdk") 156 cmd.append("--dart-sdk")
177 cmd.append(dart_sdk) 157 cmd.append(dart_sdk)
178 cmd.append("--entrypoints") 158 cmd.append("--entrypoints")
179 cmd.extend(entrypoints) 159 cmd.extend(entrypoints)
180 cmd.append("--package-root") 160 cmd.append("--package-root")
181 cmd.append(package_root) 161 cmd.append(package_root)
182 cmd.append("--no-hints") 162 cmd.append("--no-hints")
183 try: 163 try:
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 f.write(entrypoint + '\n') 303 f.write(entrypoint + '\n')
324 304
325 # Write stamp file. 305 # Write stamp file.
326 with open(args.stamp_file, 'w'): 306 with open(args.stamp_file, 'w'):
327 pass 307 pass
328 308
329 return 0 309 return 0
330 310
331 if __name__ == '__main__': 311 if __name__ == '__main__':
332 sys.exit(main()) 312 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698