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

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

Issue 11416281: Ensure the packages directory exists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | « 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 # 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 sys.stdout.flush() 43 sys.stdout.flush()
44 44
45 if utils.GuessOS() == 'win32': 45 if utils.GuessOS() == 'win32':
46 return subprocess.call(['mklink', '/j', target, source], shell=True) 46 return subprocess.call(['mklink', '/j', target, source], shell=True)
47 else: 47 else:
48 return subprocess.call(['ln', '-s', source, target]) 48 return subprocess.call(['ln', '-s', source, target])
49 49
50 50
51 def main(argv): 51 def main(argv):
52 target = os.path.relpath(argv[1]) 52 target = os.path.relpath(argv[1])
53 if not os.path.exists(target):
54 os.makedirs(target)
53 for source in argv[2:]: 55 for source in argv[2:]:
54 # Assume the source directory is named ".../TARGET_NAME/lib". 56 # Assume the source directory is named ".../NAME/lib".
55 (name, lib) = os.path.split(source) 57 (name, lib) = os.path.split(source)
56 if lib != 'lib': 58 if lib != 'lib':
57 name = source 59 name = source
58 # Remove any addtional path components preceding TARGET_NAME. 60 # Remove any addtional path components preceding NAME.
59 (path, name) = os.path.split(name) 61 (path, name) = os.path.split(name)
60 if utils.GuessOS() == 'win32': 62 if utils.GuessOS() == 'win32':
61 source = os.path.relpath(source) 63 source = os.path.relpath(source)
62 else: 64 else:
63 source = os.path.relpath(source, start=target) 65 source = os.path.relpath(source, start=target)
64 exit_code = make_link(source, os.path.join(target, name)) 66 exit_code = make_link(source, os.path.join(target, name))
65 if exit_code != 0: 67 if exit_code != 0:
66 return exit_code 68 return exit_code
67 return 0 69 return 0
68 70
69 71
70 if __name__ == '__main__': 72 if __name__ == '__main__':
71 sys.exit(main(sys.argv)) 73 sys.exit(main(sys.argv))
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