| Index: dart/tools/make_links.py
|
| diff --git a/dart/tools/make_links.py b/dart/tools/make_links.py
|
| index 66f94e6b134d2a6b24f0c7ef1eeb51a878ccb025..6c08144d2f1b4ea1b45b2970d9547877a55a72ff 100644
|
| --- a/dart/tools/make_links.py
|
| +++ b/dart/tools/make_links.py
|
| @@ -10,12 +10,16 @@ For each SOURCE in SOURCES create a link from SOURCE to TARGET. If a
|
| SOURCE ends with .../lib, the lib suffix is ignored when determining
|
| the name of the target link.
|
|
|
| +Before creating any links, the old entries of the TARGET directory will be
|
| +removed.
|
| +
|
| Usage:
|
| python tools/make_links.py OPTIONS TARGET SOURCES...
|
| '''
|
|
|
| import optparse
|
| import os
|
| +import shutil
|
| import subprocess
|
| import sys
|
| import utils
|
| @@ -53,13 +57,18 @@ def create_timestamp_file(options):
|
| if not os.path.exists(dir_name):
|
| os.mkdir(dir_name)
|
| open(options.timestamp_file, 'w').close()
|
| -
|
| +
|
|
|
| def main(argv):
|
| (options, args) = get_options()
|
| target = os.path.relpath(args[0])
|
| - if not os.path.exists(target):
|
| - os.makedirs(target)
|
| + if os.path.exists(target):
|
| + # Remove the packages directory if it already exists.
|
| + # This is necessary, otherwise we can end up having links in there
|
| + # pointing to directories which no longer exist (on incremental builds).
|
| + print 'Removing %s' % target
|
| + shutil.rmtree(target)
|
| + os.makedirs(target)
|
| for source in args[1:]:
|
| # Assume the source directory is named ".../NAME/lib".
|
| (name, lib) = os.path.split(source)
|
|
|