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

Side by Side Diff: dart/tools/make_links.py

Issue 11414056: Pass package-root option to dart2js in browser tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Correctly compute relative source on Unix Created 8 years, 1 month 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 | « no previous file | dart/tools/testing/dart/test_suite.dart » ('j') | 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 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 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. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 6
7 '''Tool for creating symlinks from SOURCES to TARGET. 7 '''Tool for creating symlinks from SOURCES to TARGET.
8 8
9 For each SOURCE in SOURCES create a link from SOURCE to TARGET. If a 9 For each SOURCE in SOURCES create a link from SOURCE to TARGET. If a
10 SOURCE ends with .../lib, the lib suffix is ignored when determining 10 SOURCE ends with .../lib, the lib suffix is ignored when determining
(...skipping 21 matching lines...) Expand all
32 if os.path.islink(target): 32 if os.path.islink(target):
33 print 'Removing %s' % target 33 print 'Removing %s' % target
34 sys.stdout.flush() 34 sys.stdout.flush()
35 os.unlink(target) 35 os.unlink(target)
36 36
37 if os.path.isdir(target): 37 if os.path.isdir(target):
38 print 'Removing %s' % target 38 print 'Removing %s' % target
39 sys.stdout.flush() 39 sys.stdout.flush()
40 os.rmdir(target) 40 os.rmdir(target)
41 41
42 print 'Creating link from %s to %s' % (source, target)
43 sys.stdout.flush()
44
42 if utils.GuessOS() == 'win32': 45 if utils.GuessOS() == 'win32':
43 source = os.path.relpath(source)
44 return subprocess.call(['mklink', '/j', target, source], shell=True) 46 return subprocess.call(['mklink', '/j', target, source], shell=True)
45 else: 47 else:
46 source = os.path.relpath(source, start=target)
47 return subprocess.call(['ln', '-s', source, target]) 48 return subprocess.call(['ln', '-s', source, target])
48 49
49 50
50 def main(argv): 51 def main(argv):
51 target = os.path.relpath(argv[1]) 52 target = os.path.relpath(argv[1])
52 for source in argv[2:]: 53 for source in argv[2:]:
53 # Assume the source directory is named ".../TARGET_NAME/lib". 54 # Assume the source directory is named ".../TARGET_NAME/lib".
54 (name, lib) = os.path.split(source) 55 (name, lib) = os.path.split(source)
55 if lib != 'lib': 56 if lib != 'lib':
56 name = source 57 name = source
57 # Remove any addtional path components preceding TARGET_NAME. 58 # Remove any addtional path components preceding TARGET_NAME.
58 (path, name) = os.path.split(name) 59 (path, name) = os.path.split(name)
60 if utils.GuessOS() == 'win32':
61 source = os.path.relpath(source)
62 else:
63 source = os.path.relpath(source, start=target)
59 exit_code = make_link(source, os.path.join(target, name)) 64 exit_code = make_link(source, os.path.join(target, name))
60 if exit_code != 0: 65 if exit_code != 0:
61 return exit_code 66 return exit_code
62 return 0 67 return 0
63 68
64 69
65 if __name__ == '__main__': 70 if __name__ == '__main__':
66 sys.exit(main(sys.argv)) 71 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | dart/tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698