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

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

Issue 11359187: Allow tests to specify a package root. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix bug and add workaround 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
OLDNEW
(Empty)
1 #!/usr/bin/env python
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
4 # BSD-style license that can be found in the LICENSE file.
5
6
7 '''Tool for creating symlinks from SOURCES to TARGET.
8
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
11 the name of the target link.
12
13 Usage:
14 python tools/make_links.py TARGET SOURCES...
15 '''
16
17 import os
18 import subprocess
19 import sys
20 import utils
21
22
23 def make_link(source, target):
24 if os.path.islink(target):
25 os.unlink(target)
26 # TODO(ahe): Remove this code when the build bots are green again.
27 bug_cleanup = os.path.join(target, 'lib')
Mads Ager (google) 2012/11/19 11:32:03 source
ahe 2012/11/19 11:35:46 Done.
28 if os.path.islink(bug_cleanup):
29 os.unlink(target)
Mads Ager (google) 2012/11/19 11:32:03 bug_cleanup
ahe 2012/11/19 11:35:46 Done.
30 if utils.GuessOS() == 'win32':
31 return subprocess.call(['mklink', '/j', target, source])
32 else:
33 return subprocess.call(['ln', '-s', source, target])
34
35
36 def main(argv):
37 target = argv[1]
38 for source in argv[2:]:
39 # Assume the source directory is named ".../TARGET_NAME/lib".
40 (name, lib) = os.path.split(source)
41 if lib != 'lib':
42 name = source
43 # Remove any addtional path components preceding TARGET_NAME.
44 (path, name) = os.path.split(name)
45 exit_code = make_link(os.path.relpath(source, start=target),
46 os.path.join(target, name))
47 if exit_code != 0:
48 return exit_code
49 return 0
50
51
52 if __name__ == '__main__':
53 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « dart/tests/standalone/package/package_test.dart ('k') | dart/tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698