comparison treepkg/packager.py @ 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
comparison
equal deleted inserted replaced
502:35759274aeb4 503:44a005311f62
26 import status 26 import status
27 import debian 27 import debian
28 from cmdexpand import cmdexpand 28 from cmdexpand import cmdexpand
29 from builder import PBuilder 29 from builder import PBuilder
30 from sbuilder import SbdmockBuilder 30 from sbuilder import SbdmockBuilder
31 from types import DictType
31 32
32 def _fromparent(attr): 33 def _fromparent(attr):
33 """Creates a property that delegates its value to self.parent.<attr>""" 34 """Creates a property that delegates its value to self.parent.<attr>"""
34 def get(self): 35 def get(self):
35 return getattr(self.parent, attr) 36 return getattr(self.parent, attr)
95 The addionals parameter may contain a dictionary with additional 96 The addionals parameter may contain a dictionary with additional
96 variables used in the version template. 97 variables used in the version template.
97 98
98 Default variables that can be resolved are: 99 Default variables that can be resolved are:
99 revision - The revision of the package 100 revision - The revision of the package
100 short_revision - the first seven characters of the revision 101 short_revision - The first seven characters of the revision
101 rules_revision - The revision of the packaging rules 102 rules_revision - The revision of the packaging rules
102 pkg_date - The current date in the form: YYYYMMDD 103 pkg_date - The current date in the form: YYYYMMDD
103 pkg_time - The current ime in the form: HHMM 104 pkg_time - The current ime in the form: HHMM
104 pkg_revision - The number of times a new package has 105 pkg_revision - The number of times a new package has
105 been created from this track. 106 been created from this track.
111 rules_revision = self.parent.rules_revision 112 rules_revision = self.parent.rules_revision
112 pkg_revision = self.parent.pkg_revision 113 pkg_revision = self.parent.pkg_revision
113 short_revision = revision 114 short_revision = revision
114 if len(pkg_revision) > 7: 115 if len(pkg_revision) > 7:
115 short_revision = short_revision[:7] 116 short_revision = short_revision[:7]
116 pkg_date = time.strftime("%Y%m%d", time.localtime()) 117 localtime = time.localtime()
117 pkg_time = time.strftime("%H%M", time.localtime()) 118 pkg_date = time.strftime("%Y%m%d", localtime)
119 pkg_time = time.strftime("%H%M", localtime)
118 upstream_version = self.determine_upstream_version(directory) 120 upstream_version = self.determine_upstream_version(directory)
119 version_dict = locals().copy() 121 version_dict = locals().copy()
120 if type(additionals).__name__=='dict': 122 if type(additionals) is DictType:
121 version_dict.update(additionals) 123 version_dict.update(additionals)
122 return self.track.version_template % version_dict 124 return self.track.version_template % version_dict
123 125
124 def export_sources(self): 126 def export_sources(self):
125 """Export the sources from the subversion working directory 127 """Export the sources from the subversion working directory
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)