]> oss.titaniummirror.com Git - webber.git/blobdiff - plugins/read_copyonly.py
Merge branch 'upstream'
[webber.git] / plugins / read_copyonly.py
index 3e6b1f2a650f401c37c4bfe189f6e0ac1c1517ac..8096de4267d8d73bd49dc439195fdcdae995950d 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: iso-8859-1 -*-
 from webber import *
-import os, fnmatch
+import os, shutil, fnmatch
 
 
 @set_hook("read")
@@ -23,9 +23,9 @@ def copyfile(params):
                os.makedirs(out_dir)
        except OSError:
                pass
-       cmd = "cp -l %s %s" % (
-               os.path.join(cfg.in_dir, file.rel_path),
-               out_path
-               )
-       #print cmd
-       os.system(cmd)
+       try:
+               shutil.copy(os.path.join(cfg.in_dir, file.rel_path), out_path)
+       except:
+               os.remove(out_path)
+               shutil.copy(os.path.join(cfg.in_dir, file.rel_path), out_path)
+       shutil.copystat(os.path.join(cfg.in_dir, file.rel_path), out_path)