--- Ft/Lib/DistExt/Version.py +++ Ft/Lib/DistExt/Version.py @@ -1,4 +1,5 @@ import re +import warnings from distutils.version import Version, StrictVersion __all__ = ['CommonVersion', 'VersionPredicate', 'SplitProvision', @@ -40,6 +41,7 @@ def parse(self, vstring): # save the original string for use by __str__ self._original = vstring + vstring = vstring.rstrip('+') def versiontuple(vstring): """ @@ -53,9 +55,12 @@ # Get the version number match = self.version_re.match(vstring) - if not match: - raise ValueError("invalid version number: %r" % vstring) - self.version = versiontuple(match.group()) + if match: + self.version = versiontuple(match.group()) + else: + warnings.filterwarnings("always", "invalid version number: .*, treating it as '0'", Warning) + warnings.warn("invalid version number: %r, treating it as '0'" % vstring, Warning) + self.version = (0,) # Check for pre- and post-release tags tags = [] @@ -64,7 +69,9 @@ while start < end: match = self.tag_re.match(vstring, start) if not match: - raise ValueError("invalid release tag: %r" % vstring[start:]) + warnings.filterwarnings("always", "invalid release tag: .*, ignoring it", Warning) + warnings.warn("invalid release tag: %r, ignoring it" % vstring[start:], Warning) + break tag, version = match.groups() tag = tag and tag.lower() if tag in self.tag_aliases: