summaryrefslogtreecommitdiffstats
path: root/libexec/poole
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2014-01-08 11:34:14 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2014-01-08 11:34:14 (GMT)
commitb0faee1209f21ca38066d4cdc02320444e402f97 (patch)
tree808d5cfbdbf86930c3ca2dc233753dfe48e7001c /libexec/poole
parent83a04d8974aa5d11c405d4e5c6de43bdf4a1c8b6 (diff)
downloadsite-b0faee1209f21ca38066d4cdc02320444e402f97.tar.gz
libexec/poole: Preserve symlinks and file metadata
Preserve any symlinks and file metadata when copying files from the source to the target directory.
Diffstat (limited to 'libexec/poole')
-rwxr-xr-xlibexec/poole11
1 files changed, 10 insertions, 1 deletions
diff --git a/libexec/poole b/libexec/poole
index ea66ccb..3735f90 100755
--- a/libexec/poole
+++ b/libexec/poole
@@ -452,6 +452,15 @@ def build(project, opts):
452 print(exc) 452 print(exc)
453 sys.exit(1) 453 sys.exit(1)
454 454
455 def copy(src, dst):
456 if os.path.islink(src):
457 linkto = os.readlink(src)
458 if os.path.isdir(dst):
459 dst = opj(dst, os.path.basename(src))
460 os.symlink(linkto, dst)
461 else:
462 shutil.copy2(src, opj(dir_out, cwd_site))
463
455 # ------------------------------------------------------------------------- 464 # -------------------------------------------------------------------------
456 # regex patterns and replacements 465 # regex patterns and replacements
457 # ------------------------------------------------------------------------- 466 # -------------------------------------------------------------------------
@@ -579,7 +588,7 @@ def build(project, opts):
579 else: 588 else:
580 src = opj(cwd, f) 589 src = opj(cwd, f)
581 try: 590 try:
582 shutil.copy(src, opj(dir_out, cwd_site)) 591 copy(src, opj(dir_out, cwd_site))
583 except OSError: 592 except OSError:
584 # some filesystems like FAT won't allow shutil.copy 593 # some filesystems like FAT won't allow shutil.copy
585 shutil.copyfile(src, opj(dir_out, cwd_site, f)) 594 shutil.copyfile(src, opj(dir_out, cwd_site, f))