diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-22 17:57:14 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-22 17:57:14 +0000 |
commit | a2e338edf518966c249037d474bc2c4cb8424164 (patch) | |
tree | 9357491c812524fc9ff2df8a224e460dc3525661 /build/symlink.py | |
parent | 22c50ca02cff7649dc812786e870a1840c471ffd (diff) | |
download | chromium_src-a2e338edf518966c249037d474bc2c4cb8424164.zip chromium_src-a2e338edf518966c249037d474bc2c4cb8424164.tar.gz chromium_src-a2e338edf518966c249037d474bc2c4cb8424164.tar.bz2 |
Make use_system_mesa switch work: make symlinks
for nacl untrusted build.
BUG=161389
Review URL: https://codereview.chromium.org/11862016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/symlink.py')
-rwxr-xr-x | build/symlink.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/build/symlink.py b/build/symlink.py new file mode 100755 index 0000000..e525731 --- /dev/null +++ b/build/symlink.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# Copyright (c) 2013 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Make a symlink and optionally touch a file (to handle dependencies).""" + + +import errno +import optparse +import os.path +import sys + + +def Main(argv): + parser = optparse.OptionParser() + parser.add_option('-f', '--force', action='store_true') + parser.add_option('--touch') + + options, args = parser.parse_args(argv) + if len(args) < 2: + parser.error('at least two arguments required.') + + target = args[-1] + sources = args[:-1] + for s in sources: + t = os.path.join(target, os.path.basename(s)) + try: + os.symlink(s, t) + except OSError, e: + if e.errno == errno.EEXIST and options.force: + os.remove(t) + os.symlink(s, t) + else: + raise + + + if options.touch: + with open(options.touch, 'w') as f: + pass + + +if __name__ == '__main__': + sys.exit(Main(sys.argv)) |