]> oss.titaniummirror.com Git - webber.git/commitdiff
read_copyonly.py: don't use os.system() with "cp -l" command, but use
authorHolger Schurig <holgerschurig@gmail.com>
Thu, 1 Jul 2010 11:25:00 +0000 (13:25 +0200)
committerHolger Schurig <holgerschurig@gmail.com>
Thu, 1 Jul 2010 11:25:00 +0000 (13:25 +0200)
shutil.copy() instead

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)