meld r1133 - trunk
- From: stevek svn gnome org
- To: svn-commits-list gnome org
- Subject: meld r1133 - trunk
- Date: Sat, 24 Jan 2009 12:05:42 +0000 (UTC)
Author: stevek
Date: Sat Jan 24 12:05:42 2009
New Revision: 1133
URL: http://svn.gnome.org/viewvc/meld?rev=1133&view=rev
Log:
Bug 568000 â Copying to NTFS fails
Modified:
trunk/dirdiff.py
trunk/misc.py
Modified: trunk/dirdiff.py
==============================================================================
--- trunk/dirdiff.py (original)
+++ trunk/dirdiff.py Sat Jan 24 12:05:42 2009
@@ -535,7 +535,7 @@
dstdir = os.path.dirname( dst )
if not os.path.exists( dstdir ):
os.makedirs( dstdir )
- shutil.copy2( src, dstdir )
+ misc.copy2( src, dstdir )
self.file_created( path, dst_pane)
elif os.path.isdir(src):
if os.path.exists(dst):
Modified: trunk/misc.py
==============================================================================
--- trunk/misc.py (original)
+++ trunk/misc.py Sat Jan 24 12:05:42 2009
@@ -29,6 +29,7 @@
import shutil
import re
import signal
+import errno
whitespace_re = re.compile(r"\s")
@@ -229,6 +230,19 @@
s = s.replace(e[1:], e[0])
return s
+def copy2(src, dst):
+ """Like shutil.copy2 but ignores chmod errors.
+ See [Bug 568000] Copying to NTFS fails
+ """
+ if os.path.isdir(dst):
+ dst = os.path.join(dst, os.path.basename(src))
+ shutil.copyfile(src, dst)
+ try:
+ shutil.copystat(src, dst)
+ except OSError, e:
+ if e.errno != errno.EPERM:
+ raise
+
def copytree(src, dst, symlinks=1):
try:
os.mkdir(dst)
@@ -245,7 +259,7 @@
elif os.path.isdir(srcname):
copytree(srcname, dstname, symlinks)
else:
- shutil.copy2(srcname, dstname)
+ copy2(srcname, dstname)
def shell_to_regex(pat):
"""Translate a shell PATTERN to a regular expression.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]