# HG changeset patch # User Andre Heinecke # Date 1288015203 0 # Node ID 44a005311f622a8c4d995bfc8eff9c08bec76d57 # Parent 35759274aeb4db533787b98b1bc3495382780cda * 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. diff -r 35759274aeb4 -r 44a005311f62 treepkg/packager.py --- 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.""" @@ -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