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.
6 """Make a symlink and optionally touch a file (to handle dependencies)."""
17 parser
= optparse
.OptionParser()
18 parser
.add_option('-f', '--force', action
='store_true')
19 parser
.add_option('--touch')
21 options
, args
= parser
.parse_args(argv
[1:])
23 parser
.error('at least two arguments required.')
28 t
= os
.path
.join(target
, os
.path
.basename(s
))
29 if len(sources
) == 1 and not os
.path
.isdir(target
):
34 if e
.errno
== errno
.EEXIST
and options
.force
:
36 shutil
.rmtree(t
, ignore_errors
=True)
45 with
open(options
.touch
, 'w') as f
:
49 if __name__
== '__main__':
50 sys
.exit(Main(sys
.argv
))