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

Side by Side Diff: build/symlink.py

Issue 2101243005: Add a snapshot of flutter/engine/src/build to our sdk (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: add README.dart Created 4 years, 5 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 | « build/some.gyp ('k') | build/temp_gyp/README.chromium » ('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/bin/env python
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5 """Make a symlink and optionally touch a file (to handle dependencies)."""
6 import errno
7 import optparse
8 import os.path
9 import shutil
10 import sys
11 def Main(argv):
12 parser = optparse.OptionParser()
13 parser.add_option('-f', '--force', action='store_true')
14 parser.add_option('--touch')
15 options, args = parser.parse_args(argv[1:])
16 if len(args) < 2:
17 parser.error('at least two arguments required.')
18 target = args[-1]
19 sources = args[:-1]
20 for s in sources:
21 t = os.path.join(target, os.path.basename(s))
22 if len(sources) == 1 and not os.path.isdir(target):
23 t = target
24 try:
25 os.symlink(s, t)
26 except OSError, e:
27 if e.errno == errno.EEXIST and options.force:
28 if os.path.isdir(t):
29 shutil.rmtree(t, ignore_errors=True)
30 else:
31 os.remove(t)
32 os.symlink(s, t)
33 else:
34 raise
35 if options.touch:
36 with open(options.touch, 'w') as f:
37 pass
38 if __name__ == '__main__':
39 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « build/some.gyp ('k') | build/temp_gyp/README.chromium » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698