changeset 503:44a005311f62

* Only check the time once per version calculation * Check if a dictionary is supplied to determine_package_version by checking the type instead the name of the type.
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 25 Oct 2010 14:00:03 +0000
parents 35759274aeb4
children dcec034fed97
files treepkg/packager.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/treepkg/packager.py	Mon Oct 25 08:18:21 2010 +0000
+++ b/treepkg/packager.py	Mon Oct 25 14:00:03 2010 +0000
@@ -28,6 +28,7 @@
 from cmdexpand import cmdexpand
 from builder import PBuilder
 from sbuilder import SbdmockBuilder
+from types import DictType
 
 def _fromparent(attr):
     """Creates a property that delegates its value to self.parent.<attr>"""
@@ -97,7 +98,7 @@
 
         Default variables that can be resolved are:
              revision - The revision of the package
-             short_revision - the first seven characters of the revision
+             short_revision - The first seven characters of the revision
              rules_revision - The revision of the packaging rules
              pkg_date - The current date in the form: YYYYMMDD
              pkg_time - The current ime in the form: HHMM
@@ -113,11 +114,12 @@
         short_revision = revision
         if len(pkg_revision) > 7:
             short_revision = short_revision[:7]
-        pkg_date = time.strftime("%Y%m%d", time.localtime())
-        pkg_time = time.strftime("%H%M", time.localtime())
+        localtime = time.localtime()
+        pkg_date = time.strftime("%Y%m%d", localtime)
+        pkg_time = time.strftime("%H%M", localtime)
         upstream_version = self.determine_upstream_version(directory)
         version_dict = locals().copy()
-        if type(additionals).__name__=='dict':
+        if type(additionals) is DictType:
             version_dict.update(additionals)
         return self.track.version_template % version_dict
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)