diff options
| author | Steven Knight <knight@baldmt.com> | 2002-12-22 19:17:19 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2002-12-22 19:17:19 (GMT) |
| commit | ed5697feb65d129a082d59408ddfcfac4ee2134b (patch) | |
| tree | a54fddb1c55f55b94863e851688a3a80ce6f3e38 /src/engine/SCons/Node/FS.py | |
| parent | 28a061162bbfc8f889e09aab3c4c4282860b1a7a (diff) | |
| download | SCons-ed5697feb65d129a082d59408ddfcfac4ee2134b.zip SCons-ed5697feb65d129a082d59408ddfcfac4ee2134b.tar.gz SCons-ed5697feb65d129a082d59408ddfcfac4ee2134b.tar.bz2 | |
Support Repositories on a different file system, when hard links to the local directory won't work. (Derrick 'dman' Hudson)
Diffstat (limited to 'src/engine/SCons/Node/FS.py')
| -rw-r--r-- | src/engine/SCons/Node/FS.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 4ed4664..5c01c9d 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -48,22 +48,24 @@ import SCons.Warnings execute_actions = 1 -try: - import os - _link = os.link -except AttributeError: - import shutil - import stat - def _link(src, dest): - shutil.copy2(src, dest) - st=os.stat(src) - os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) - def file_link(src, dest): dir, file = os.path.split(dest) if dir and not os.path.isdir(dir): os.makedirs(dir) - _link(src, dest) + # Now actually link the files. First try to make a hard link. If that + # fails, try a symlink. If that fails then just copy it. + try : + os.link(src, dest) + except (AttributeError, OSError) : + try : + os.symlink(src, dest) + except (AttributeError, OSError) : + import shutil + import stat + shutil.copy2(src, dest) + st=os.stat(src) + os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE) + class ParentOfRoot: """ |
