60b7c78
diff --git a/openpgm/pgm/version_generator.py b/openpgm/pgm/version_generator.py
60b7c78
index e489aef..581eabe 100755
60b7c78
--- a/openpgm/pgm/version_generator.py
60b7c78
+++ b/openpgm/pgm/version_generator.py
60b7c78
@@ -1,19 +1,25 @@
60b7c78
-#!/usr/bin/python
60b7c78
+#!/usr/bin/python3
60b7c78
 
60b7c78
 import os
60b7c78
 import platform
60b7c78
 import time
60b7c78
 
60b7c78
-build_date = time.strftime ("%Y-%m-%d")
60b7c78
-build_time = time.strftime ("%H:%M:%S")
60b7c78
-build_rev = filter (str.isdigit, "$Revision$")
60b7c78
+timestamp = time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
60b7c78
+build_date = time.strftime ("%Y-%m-%d", timestamp)
60b7c78
+build_time = time.strftime ("%H:%M:%S", timestamp)
60b7c78
+build_rev = ''.join (list (filter (str.isdigit, "$Revision$")))
60b7c78
+build_system = platform.system()
60b7c78
+build_machine = platform.machine()
60b7c78
+if 'SOURCE_DATE_EPOCH' in os.environ:
60b7c78
+        build_system = 'BuildSystem'
60b7c78
+        build_machine = 'BuildMachine'
60b7c78
 
60b7c78
-print """
60b7c78
+print ("""
60b7c78
 /* vim:ts=8:sts=8:sw=4:noai:noexpandtab
60b7c78
  * 
60b7c78
  * OpenPGM version.
60b7c78
  *
60b7c78
- * Copyright (c) 2006-2011 Miru Limited.
60b7c78
+ * Copyright (c) 2006-2014 Miru Limited.
60b7c78
  *
60b7c78
  * This library is free software; you can redistribute it and/or
60b7c78
  * modify it under the terms of the GNU Lesser General Public
60b7c78
@@ -41,15 +47,16 @@
60b7c78
 
60b7c78
 const unsigned pgm_major_version = 5;
60b7c78
 const unsigned pgm_minor_version = 2;
edfbcd6
 const unsigned pgm_micro_version = 122;
60b7c78
-const char* pgm_build_date = "%s";
60b7c78
-const char* pgm_build_time = "%s";
60b7c78
-const char* pgm_build_system = "%s";
60b7c78
-const char* pgm_build_machine = "%s";
60b7c78
-const char* pgm_build_revision = "%s";
60b7c78
+const char* pgm_build_date = "{0}";
60b7c78
+const char* pgm_build_time = "{1}";
60b7c78
+const char* pgm_build_system = "{2}";
60b7c78
+const char* pgm_build_machine = "{3}";
60b7c78
+const char* pgm_build_revision = "{4}";
60b7c78
 
60b7c78
 
60b7c78
 /* eof */
60b7c78
-"""%(build_date, build_time, platform.system(), platform.machine(), build_rev)
60b7c78
+""".format (build_date, build_time, build_system, build_machine, build_rev))
60b7c78
 
60b7c78
 # end of file
60b7c78
+