git » pygen » commit 96ab53a

Preserve directories' modification time.

author Alberto Bertogli
2006-03-07 17:34:31 UTC
committer Alberto Bertogli
2006-03-07 17:34:31 UTC
parent 6150fc92f5ee9cd5712efb508f8ea17ad73dbaf9

Preserve directories' modification time.

pygen +10 -0

diff --git a/pygen b/pygen
index 2a634fe..3ba06ab 100644
--- a/pygen
+++ b/pygen
@@ -150,6 +150,16 @@ def autogen(src, dst):
 					print 'copy', diff
 					shutil.copy2(fullf, t)
 
+	# second pass to preserve directories' modification time
+	tree = os.walk(srcroot)
+	for path, dirs, files in tree:
+		for d in dirs:
+			fulld = path + '/' + d
+			diff = fulld[len(srcroot):]
+			p = os.path.normpath(dst + '/' + diff)
+			print 'copystat', p
+			shutil.copystat(fulld, p)
+
 
 if __name__ == '__main__':