copy2->copyfile

copy2() will throw an OSError on Linux+fat32 partitions, and we don't really
need the original mode bits or stat data anyway.
This commit is contained in:
Damien Elmes 2012-04-22 07:33:04 +09:00
parent ae3e775fdd
commit 68da292ddb
2 changed files with 4 additions and 5 deletions

View file

@ -98,8 +98,7 @@ def _buildImg(col, latex, fname, model):
stdout=log, stderr=log):
return _errMsg("dvipng")
# add to media
shutil.copy2(png,
os.path.join(mdir, fname))
shutil.copyfile(png, os.path.join(mdir, fname))
return
finally:
os.chdir(oldcwd)

View file

@ -69,7 +69,7 @@ If the same name exists, compare checksums."""
dst = os.path.join(mdir, base)
# if it doesn't exist, copy it directly
if not os.path.exists(dst):
shutil.copy2(opath, dst)
shutil.copyfile(opath, dst)
return base
# if it's identical, reuse
if self.filesIdentical(opath, dst):
@ -89,7 +89,7 @@ If the same name exists, compare checksums."""
else:
root = re.sub(reg, repl, root)
# copy and return
shutil.copy2(opath, path)
shutil.copyfile(opath, path)
return os.path.basename(os.path.basename(path))
def filesIdentical(self, path1, path2):
@ -192,7 +192,7 @@ If the same name exists, compare checksums."""
src = os.path.join(ldir, f)
dst = os.path.join(rdir, f)
if not os.path.exists(dst):
shutil.copy2(src, dst)
shutil.copyfile(src, dst)
cnt += 1
return cnt