Lines Matching refs:dst
16 def _copy_file_contents(src, dst, buffer_size=16*1024): argument
33 if os.path.exists(dst):
35 os.unlink(dst)
38 "could not delete '%s': %s" % (dst, e.strerror))
41 fdst = open(dst, 'wb')
44 "could not create '%s': %s" % (dst, e.strerror))
60 "could not write to '%s': %s" % (dst, e.strerror))
67 def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0, argument
107 if os.path.isdir(dst):
108 dir = dst
109 dst = os.path.join(dst, os.path.basename(src))
111 dir = os.path.dirname(dst)
113 if update and not newer(src, dst):
116 return (dst, 0)
124 if os.path.basename(dst) == os.path.basename(src):
127 log.info("%s %s -> %s", action, src, dst)
130 return (dst, 1)
135 if not (os.path.exists(dst) and os.path.samefile(src, dst)):
137 os.link(src, dst)
138 return (dst, 1)
145 if not (os.path.exists(dst) and os.path.samefile(src, dst)):
146 os.symlink(src, dst)
147 return (dst, 1)
151 _copy_file_contents(src, dst)
158 os.utime(dst, (st[ST_ATIME], st[ST_MTIME]))
160 os.chmod(dst, S_IMODE(st[ST_MODE]))
162 return (dst, 1)
166 def move_file (src, dst, argument
181 log.info("moving %s -> %s", src, dst)
184 return dst
189 if isdir(dst):
190 dst = os.path.join(dst, basename(src))
191 elif exists(dst):
194 (src, dst))
196 if not isdir(dirname(dst)):
199 (src, dst))
203 os.rename(src, dst)
210 "couldn't move '%s' to '%s': %s" % (src, dst, msg))
213 copy_file(src, dst, verbose=verbose)
219 os.unlink(dst)
225 % (src, dst, src, msg))
226 return dst