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

Side by Side Diff: frog/tip/copy_libs.py

Issue 8889031: move tip to utils so it can be picked up in the SDK (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « frog/tip/background.html ('k') | frog/tip/create_fftip.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/local/evn python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file.
5
6 # TODO(jimhug): THIS IS CURRENTLY BROKEN - NEEDS FIX BEFORE EXTENSIONS WORK!
7
8 # A script that copies dart/frog/lib under dart/frog/tip/lib/. This script
9 # internally uses copy_dart to resolve relative paths used in the libraries and
10 # merge source files together.
11
12 # Note: The current setup assumes that all libraries used by frog (except some
13 # sources) are within the frog/lib. If frog/lib contains a #import outside that
14 # directory, we need to update this script to contain a deeper hierarchy of
15 # directories.
16
17 import os
18 import fileinput
19 import re
20 import subprocess
21 import sys
22
23 TIP_PATH = os.path.dirname(os.path.abspath(__file__))
24 FROG_PATH = os.path.dirname(TIP_PATH)
25 LIB_PATH = os.path.join(FROG_PATH, 'lib')
26
27 re_library = re.compile(r'^#library\([\'"]([^\'"]*)[\'"]\);$')
28
29 def find_libraries(path):
30 """ finds .dart files containing the #library directive. """
31 libs = []
32 for root, dirs, files in os.walk(path):
33 for fname in files:
34 if fname.endswith('.dart') and not root.endswith('lib/node'):
35 relpath = os.path.relpath(os.path.join(root, fname))
36 for line in fileinput.input(relpath):
37 if re_library.match(line):
38 libs.append(relpath)
39 break
40 fileinput.close()
41 return libs
42
43 def main():
44 os.chdir(LIB_PATH)
45 libs = find_libraries(LIB_PATH)
46 return subprocess.call([sys.executable,
47 '../../client/tools/copy_dart.py', os.path.join(TIP_PATH, 'lib')] + libs)
48
49 if __name__ == '__main__':
50 sys.exit(main())
OLDNEW
« no previous file with comments | « frog/tip/background.html ('k') | frog/tip/create_fftip.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698