From f441eb2a4c66bca41ed89302251b5cc4b4b25e57 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Thu, 1 Jul 2010 13:25:00 +0200 Subject: [PATCH] read_copyonly.py: don't use os.system() with "cp -l" command, but use shutil.copy() instead --- plugins/read_copyonly.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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) -- 2.39.2