Home | History | Annotate | Download | only in distutils

Lines Matching refs:dst

18 def _copy_file_contents(src, dst, buffer_size=16*1024):
19 """Copy the file 'src' to 'dst'.
22 'src', or writing to 'dst', raises DistutilsFileError. Data is
36 if os.path.exists(dst):
38 os.unlink(dst)
41 "could not delete '%s': %s" % (dst, errstr))
44 fdst = open(dst, 'wb')
47 "could not create '%s': %s" % (dst, errstr))
63 "could not write to '%s': %s" % (dst, errstr))
71 def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0,
73 """Copy a file 'src' to 'dst'.
75 If 'dst' is a directory, then 'src' is copied there with the same name;
81 If 'update' is true, 'src' will only be copied if 'dst' does not exist,
82 or if 'dst' does exist but is older than 'src'.
102 # (not update) and (src newer than dst).
111 if os.path.isdir(dst):
112 dir = dst
113 dst = os.path.join(dst, os.path.basename(src))
115 dir = os.path.dirname(dst)
117 if update and not newer(src, dst):
120 return dst, 0
128 if os.path.basename(dst) == os.path.basename(src):
131 log.info("%s %s -> %s", action, src, dst)
134 return (dst, 1)
139 if not (os.path.exists(dst) and os.path.samefile(src, dst)):
140 os.link(src, dst)
142 if not (os.path.exists(dst) and os.path.samefile(src, dst)):
143 os.symlink(src, dst)
148 _copy_file_contents(src, dst)
155 os.utime(dst, (st[ST_ATIME], st[ST_MTIME]))
157 os.chmod(dst, S_IMODE(st[ST_MODE]))
159 return (dst, 1)
162 def move_file (src, dst, verbose=1, dry_run=0):
163 """Move a file 'src' to 'dst'.
165 If 'dst' is a directory, the file will be moved into it with the same
166 name; otherwise, 'src' is just renamed to 'dst'. Return the new
176 log.info("moving %s -> %s", src, dst)
179 return dst
184 if isdir(dst):
185 dst = os.path.join(dst, basename(src))
186 elif exists(dst):
189 (src, dst))
191 if not isdir(dirname(dst)):
194 (src, dst))
198 os.rename(src, dst)
204 "couldn't move '%s' to '%s': %s" % (src, dst, msg))
207 copy_file(src, dst, verbose=verbose)
212 os.unlink(dst)
218 (src, dst, src, msg))
219 return dst