diff options
author | lloyd <[email protected]> | 2009-07-02 19:54:42 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-07-02 19:54:42 +0000 |
commit | d57ab4ff936c85b7ec5431e4684cf1ecb46745c9 (patch) | |
tree | 72e7f13246911a36f32406e9f8dcdcdd1627a58a | |
parent | df43e947c8dcae4c61948b84007a08369d5cdc37 (diff) |
Use symlink, link, or copy, depending on what we find in os.__dict__
-rwxr-xr-x | configure.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/configure.py b/configure.py index 4db0bf219..5c41f276f 100755 --- a/configure.py +++ b/configure.py @@ -748,18 +748,22 @@ def setup_build(build_config, options, template_vars): build_config.headers.append(os.path.join(build_config.build_dir, 'build.h')) def portable_symlink(filename, target_dir): - def count_dirs(dir): - (dir,basename) = os.path.split(dir) - cnt = 1 - while dir != '': + if False and 'symlink' in os.__dict__: + def count_dirs(dir): (dir,basename) = os.path.split(dir) - cnt += 1 - return cnt - - dirs_up = count_dirs(target_dir) - target = os.path.join(os.path.join(*[os.path.pardir]*dirs_up), filename) - - os.symlink(target, os.path.join(target_dir, os.path.basename(filename))) + cnt = 1 + while dir != '': + (dir,basename) = os.path.split(dir) + cnt += 1 + return cnt + + dirs_up = count_dirs(target_dir) + target = os.path.join(os.path.join(*[os.path.pardir]*dirs_up), filename) + os.symlink(target, os.path.join(target_dir, os.path.basename(filename))) + elif 'link' in os.__dict__: + os.link(filename, os.path.join(target_dir, os.path.basename(filename))) + else: + shutil.copy(filename, target_dir) for header_file in build_config.headers: portable_symlink(header_file, build_config.full_include_dir) |