From: Brian Warner Date: Fri, 4 May 2007 03:31:27 +0000 (-0700) Subject: version.py: handle both '0.2.0' and '0.2.0-1', remove 'tags' for now X-Git-Tag: allmydata-tahoe-0.3.0~98 X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/vdrive?a=commitdiff_plain;h=9bd213abe794ec91747f49db22de9a4ca5a5a2e7;p=tahoe-lafs%2Ftahoe-lafs.git version.py: handle both '0.2.0' and '0.2.0-1', remove 'tags' for now --- diff --git a/src/allmydata/util/version.py b/src/allmydata/util/version.py index d5cbb36c..ef65212b 100644 --- a/src/allmydata/util/version.py +++ b/src/allmydata/util/version.py @@ -44,10 +44,10 @@ from distutils import version # Developers see "full version strings", like this: -# "1.0.0a1-55-UNSTABLE" -# ^ ^ ^^^ ^ ^ -# | | ||| | | -# | | ||| | '- tags +# "1.0.0a1-55" +# ^ ^ ^^^ ^ +# | | ||| | +# | | ||| | # | | ||| '- nano version number # | | ||'- release number # | | |'- alpha or beta (or none) @@ -59,9 +59,6 @@ from distutils import version # developers. It gets bumped whenever a developer changes anything that another # developer might care about. -# The last part is the "tags" separated by "_". Standard tags are -# "STABLE" and "UNSTABLE". - class Tag(str): def __cmp__(t1, t2): if t1 == t2: @@ -79,7 +76,7 @@ class Version: def parse(self, vstring): i = vstring.find('-') - if i: + if i != -1: svstring = vstring[:i] estring = vstring[i+1:] else: @@ -88,17 +85,17 @@ class Version: self.strictversion = version.StrictVersion(svstring) + self.nanovernum = None + self.tags = [] if estring: - try: - (self.nanovernum, tags,) = estring.split('-') - except: - print estring - raise - self.tags = map(Tag, tags.split('_')) - self.tags.sort() - - self.fullstr = '-'.join([str(self.strictversion), str(self.nanovernum), '_'.join(self.tags)]) - + self.nanovernum = estring + + self.fullstr = str(self.strictversion) + if self.nanovernum is not None: + self.fullstr += "-" + str(self.nanovernum) + if self.tags: + self.fullstr += '_'.join(self.tags) + def tags(self): return self.tags