git » pygen » commit b5db548

Fix is_newer_than() when the destination does not exist

author Alberto Bertogli
2011-05-15 22:51:08 UTC
committer Alberto Bertogli
2011-05-15 22:51:08 UTC
parent fbaa4b9ceb38b1784fb7a243a4e2288e6a689a8d

Fix is_newer_than() when the destination does not exist

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

pygen +3 -1

diff --git a/pygen b/pygen
index af70d77..fc7dccf 100755
--- a/pygen
+++ b/pygen
@@ -14,7 +14,9 @@ def printd(*args):
 def is_newer_than(src, dst):
 	"""Determine if "src" is newer than "dst"."""
 	if not os.path.exists(dst):
-		return False
+		# To simplify callers, return as if src is newer when there is
+		# no dst, so that it will be copied
+		return True
 	# We have to use the integer part because copystat() is not accurate
 	# and loses precision when copying mtimes, causing the mtimes to be
 	# different and sometimes the new file has an older mtime than the old