Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(33)

Delta Between Two Patch Sets: Lib/shutil.py

Issue 2384: Remove WindowsError reference on non-windows systems (Closed) SVN Base: http://svn.python.org/view/*checkout*/python/trunk/
Left Patch Set: Created 1 year, 5 months ago
Right Patch Set: A slight mistake corrected. Created 1 year, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 """Utility functions for copying files and directory trees. 1 """Utility functions for copying files and directory trees.
2 2
3 XXX The functions here don't copy the resource fork or other metadata on Mac. 3 XXX The functions here don't copy the resource fork or other metadata on Mac.
4 4
5 """ 5 """
6 6
7 import os 7 import os
8 import sys 8 import sys
9 import stat 9 import stat
10 from os.path import abspath 10 from os.path import abspath
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 # XXX What about devices, sockets etc.? 130 # XXX What about devices, sockets etc.?
131 except (IOError, os.error), why: 131 except (IOError, os.error), why:
132 errors.append((srcname, dstname, str(why))) 132 errors.append((srcname, dstname, str(why)))
133 # catch the Error from the recursive copytree so that we can 133 # catch the Error from the recursive copytree so that we can
134 # continue with other files 134 # continue with other files
135 except Error, err: 135 except Error, err:
136 errors.extend(err.args[0]) 136 errors.extend(err.args[0])
137 try: 137 try:
138 copystat(src, dst) 138 copystat(src, dst)
139 except OSError, why: 139 except OSError, why:
140 if WindowsError is not None and isinstance(err, WindowsError): 140 if WindowsError is not None and isinstance(why, WindowsError):
141 # Copying file access times may fail on Windows 141 # Copying file access times may fail on Windows
142 pass 142 pass
143 else: 143 else:
144 errors.extend((src, dst, str(why))) 144 errors.extend((src, dst, str(why)))
145 if errors: 145 if errors:
146 raise Error, errors 146 raise Error, errors
147 147
148 def rmtree(path, ignore_errors=False, onerror=None): 148 def rmtree(path, ignore_errors=False, onerror=None):
149 """Recursively delete a directory tree. 149 """Recursively delete a directory tree.
150 150
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if destinsrc(src, dst): 228 if destinsrc(src, dst):
229 raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst) 229 raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst)
230 copytree(src, real_dst, symlinks=True) 230 copytree(src, real_dst, symlinks=True)
231 rmtree(src) 231 rmtree(src)
232 else: 232 else:
233 copy2(src, real_dst) 233 copy2(src, real_dst)
234 os.unlink(src) 234 os.unlink(src)
235 235
236 def destinsrc(src, dst): 236 def destinsrc(src, dst):
237 return abspath(dst).startswith(abspath(src)) 237 return abspath(dst).startswith(abspath(src))
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r497