From: Holger Schurig Date: Thu, 1 Jul 2010 11:25:00 +0000 (+0200) Subject: read_copyonly.py: don't use os.system() with "cp -l" command, but use X-Git-Url: https://oss.titaniummirror.com/gitweb?p=webber.git;a=commitdiff_plain;h=f441eb2a4c66bca41ed89302251b5cc4b4b25e57 read_copyonly.py: don't use os.system() with "cp -l" command, but use shutil.copy() instead --- diff --git a/plugins/read_copyonly.py b/plugins/read_copyonly.py index 3e6b1f2..8096de4 100644 --- a/plugins/read_copyonly.py +++ b/plugins/read_copyonly.py @@ -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)