From 9bd213abe794ec91747f49db22de9a4ca5a5a2e7 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Thu, 3 May 2007 20:31:27 -0700 Subject: [PATCH] version.py: handle both '0.2.0' and '0.2.0-1', remove 'tags' for now --- src/allmydata/util/version.py | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) 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 -- 2.45.2