Home | History | Annotate | Download | only in distutils

Lines Matching refs:src

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
32 fsrc = open(src, 'rb')
34 raise DistutilsFileError("could not open '%s': %s" % (src, errstr))
54 "could not read from '%s': %s" % (src, 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 # changing it (ie. it's not already a hard/soft link to src OR
103 # (not update) and (src newer than dst).
108 if not os.path.isfile(src):
110 "can't copy '%s': doesn't exist or not a regular file" % src)
114 dst = os.path.join(dst, os.path.basename(src))
118 if update and not newer(src, dst):
120 log.debug("not copying %s (output up-to-date)", src)
129 if os.path.basename(dst) == os.path.basename(src):
130 log.info("%s %s -> %s", action, src, dir)
132 log.info("%s %s -> %s", action, src, dst)
140 if not (os.path.exists(dst) and os.path.samefile(src, dst)):
142 os.link(src, dst)
150 if not (os.path.exists(dst) and os.path.samefile(src, dst)):
151 os.symlink(src, dst)
156 _copy_file_contents(src, dst)
158 st = os.stat(src)
170 def move_file (src, dst, verbose=1, dry_run=0):
171 """Move a file 'src' to 'dst'.
174 name; otherwise, 'src' is just renamed to 'dst'. Return the new
184 log.info("moving %s -> %s", src, dst)
189 if not isfile(src):
190 raise DistutilsFileError("can't move '%s': not a regular file" % src)
193 dst = os.path.join(dst, basename(src))
197 (src, dst))
202 (src, dst))
206 os.rename(src, dst)
212 "couldn't move '%s' to '%s': %s" % (src, dst, msg))
215 copy_file(src, dst, verbose=verbose)
217 os.unlink(src)
226 (src, dst, src, msg))