Lines Matching refs:src

16 def _copy_file_contents(src, dst, buffer_size=16*1024):
17 """Copy the file 'src' to 'dst'; both must be filenames. Any error
18 opening either file, reading from 'src', or writing to 'dst', raises
29 fsrc = open(src, 'rb')
31 raise DistutilsFileError("could not open '%s': %s" % (src, e.strerror))
51 "could not read from '%s': %s" % (src, e.strerror))
67 def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0,
69 """Copy a file 'src' to 'dst'. If 'dst' is a directory, then 'src' is
75 last-access times are copied as well. If 'update' is true, 'src' will
77 older than 'src'.
97 # changing it (ie. it's not already a hard/soft link to src OR
98 # (not update) and (src newer than dst).
103 if not os.path.isfile(src):
105 "can't copy '%s': doesn't exist or not a regular file" % src)
109 dst = os.path.join(dst, os.path.basename(src))
113 if update and not newer(src, dst):
115 log.debug("not copying %s (output up-to-date)", src)
124 if os.path.basename(dst) == os.path.basename(src):
125 log.info("%s %s -> %s", action, src, dir)
127 log.info("%s %s -> %s", action, src, dst)
135 if not (os.path.exists(dst) and os.path.samefile(src, dst)):
137 os.link(src, dst)
145 if not (os.path.exists(dst) and os.path.samefile(src, dst)):
146 os.symlink(src, dst)
151 _copy_file_contents(src, dst)
153 st = os.stat(src)
166 def move_file (src, dst,
170 """Move a file 'src' to 'dst'. If 'dst' is a directory, the file will
171 be moved into it with the same name; otherwise, 'src' is just renamed
181 log.info("moving %s -> %s", src, dst)
186 if not isfile(src):
187 raise DistutilsFileError("can't move '%s': not a regular file" % src)
190 dst = os.path.join(dst, basename(src))
194 (src, 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)
215 os.unlink(src)
225 % (src, dst, src, msg))