File reproducible.patch of Package python-Cheetah

commit 779596f983c339610f678e2a5078cfb5d8fb951e
Author: Bernhard M. Wiedemann <bwiedemann@suse.de>
Date:   Wed Aug 30 20:26:04 2017 +0200

    Allow to override compile time
    
    in order to make builds reproducible
    without patching individual packages such as prewikka
    
    See https://reproducible-builds.org/ for why this is good
    and https://reproducible-builds.org/specs/source-date-epoch/
    for the definition of this variable.

diff --git a/cheetah/Compiler.py b/cheetah/Compiler.py
index 80847ff..3b66b5a 100644
--- a/cheetah/Compiler.py
+++ b/cheetah/Compiler.py
@@ -33,7 +33,9 @@ from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valu
 VFFSL=valueFromFrameOrSearchList
 VFSL=valueFromSearchList
 VFN=valueForName
-currentTime=time.time
+def currentTimeFunc():
+    return float(os.getenv('SOURCE_DATE_EPOCH', time.time()))
+currentTime=currentTimeFunc
 
 class Error(Exception): pass
 
@@ -1897,7 +1899,7 @@ class ModuleCompiler(SettingsManager, GenUtils):
         self.addModuleGlobal('__CHEETAH_version__ = %r'%Version)
         self.addModuleGlobal('__CHEETAH_versionTuple__ = %r'%(VersionTuple,))        
         if self.setting('addTimestampsToCompilerOutput'):
-            self.addModuleGlobal('__CHEETAH_genTime__ = %r'%time.time())
+            self.addModuleGlobal('__CHEETAH_genTime__ = %r'%currentTimeFunc())
             self.addModuleGlobal('__CHEETAH_genTimestamp__ = %r'%self.timestamp())
         if self._filePath:
             timestamp = self.timestamp(self._fileMtime)
@@ -1952,7 +1954,7 @@ if not hasattr(%(mainClassName)s, '_initCheetahAttributes'):
 
     def timestamp(self, theTime=None):
         if not theTime:
-            theTime = time.time()
+            theTime = currentTimeFunc()
         return time.asctime(time.localtime(theTime))
     
     def moduleHeader(self):