-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from abarth/fix_symlink
Fix build issues related to symlink.py
- Loading branch information
Showing
4 changed files
with
48 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/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. | ||
|
||
import errno | ||
import optparse | ||
import os.path | ||
import shutil | ||
import sys | ||
|
||
|
||
def main(argv): | ||
parser = optparse.OptionParser() | ||
parser.add_option('--touch') | ||
|
||
options, args = parser.parse_args(argv[1:]) | ||
if len(args) != 2: | ||
parser.error('Two arguments required.') | ||
|
||
source = os.path.abspath(args[0]) | ||
target = os.path.abspath(args[1]) | ||
try: | ||
os.symlink(source, target) | ||
except OSError, e: | ||
if e.errno == errno.EEXIST: | ||
os.remove(target) | ||
os.symlink(source, target) | ||
|
||
if options.touch: | ||
with open(os.path.abspath(options.touch), 'w') as f: | ||
pass | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main(sys.argv)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters