Permalink
Browse files

Merge pull request #98 from jhoekx/no-touch-file

Make copy module idempotent.
  • Loading branch information...
mpdehaan committed Mar 31, 2012
2 parents ba7d0b8 + 38a33c5 commit b4a07fea3b2e17bc77785ae8a0c78f07140c7956
Showing with 2 additions and 3 deletions.
  1. +2 −3 library/copy
View
@@ -54,11 +54,10 @@ changed = False
if os.path.exists(dest):
md5sum = os.popen("md5sum %s" % dest).read().split()[0]
-os.system("cp %s %s" % (src, dest))
-
-md5sum2 = os.popen("md5sum %s" % dest).read().split()[0]
+md5sum2 = os.popen("md5sum %s" % src).read().split()[0]
if md5sum != md5sum2:
+ os.system("cp %s %s" % (src, dest))
changed = True
# mission accomplished

0 comments on commit b4a07fe

Please sign in to comment.