Commit 3cee1929 authored by Christophe Dumez's avatar Christophe Dumez

- work on compatibility with windows (should be ok now), please report any problem left


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@6783 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3f56844f
...@@ -42,7 +42,7 @@ from zExceptions import Unauthorized ...@@ -42,7 +42,7 @@ from zExceptions import Unauthorized
from OFS.Image import manage_addFile from OFS.Image import manage_addFile
from cStringIO import StringIO from cStringIO import StringIO
from tempfile import mktemp from tempfile import mktemp
from shutil import copy2 from shutil import copy
try: try:
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
...@@ -74,18 +74,15 @@ def removeAll(entry): ...@@ -74,18 +74,15 @@ def removeAll(entry):
pass pass
def copytree(src, dst, symlinks=False): def copytree(src, dst, symlinks=False):
"""Recursively copy a directory tree using copy2(). """Recursively copy a directory tree using copy().
The destination directory must not already exist.
If exception(s) occur, an Error is raised with a list of reasons. If exception(s) occur, an Error is raised with a list of reasons.
dst dir must exist
If the optional symlinks flag is true, symbolic links in the If the optional symlinks flag is true, symbolic links in the
source tree result in symbolic links in the destination tree; if source tree result in symbolic links in the destination tree; if
it is false, the contents of the files pointed to by symbolic it is false, the contents of the files pointed to by symbolic
links are copied. links are copied.
XXX Consider this example code rather than the ultimate tool.
""" """
if not os.path.exists(dst): if not os.path.exists(dst):
os.mkdir(dst) os.mkdir(dst)
...@@ -101,8 +98,7 @@ def copytree(src, dst, symlinks=False): ...@@ -101,8 +98,7 @@ def copytree(src, dst, symlinks=False):
elif os.path.isdir(srcname): elif os.path.isdir(srcname):
copytree(srcname, dstname, symlinks) copytree(srcname, dstname, symlinks)
else: else:
copy2(srcname, dstname) copy(srcname, dstname)
# XXX What about devices, sockets etc.?
except (IOError, os.error), why: except (IOError, os.error), why:
errors.append((srcname, dstname, why)) errors.append((srcname, dstname, why))
if errors: if errors:
...@@ -781,8 +777,8 @@ class SubversionTool(UniqueObject, Folder): ...@@ -781,8 +777,8 @@ class SubversionTool(UniqueObject, Folder):
# detect created files # detect created files
files_set = self.getNewFiles(old_dir, new_dir) files_set = self.getNewFiles(old_dir, new_dir)
# Copy files # Copy files
os.system('cp -af %s/* %s'%(new_dir, old_dir)) #os.system('cp -af %s/* %s'%(new_dir, old_dir))
#copytree(new_dir, old_dir) copytree(new_dir, old_dir)
# svn add # svn add
for file in files_set: for file in files_set:
self.add(os.path.join(old_dir, file)) self.add(os.path.join(old_dir, file))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment