def normalized_version(verstr, what=None): try: return verlib.NormalizedVersion(verlib.suggest_normalized_version(verstr)) except (StandardError, verlib.IrrationalVersionError): cls, value, trace = sys.exc_info() raise PackagingError, ("could not parse %s due to %s: %s" % (what or repr(verstr), cls.__name__, value)), trace
def normalized_version(verstr, what=None): try: suggested = verlib.suggest_normalized_version(verstr) or verstr return verlib.NormalizedVersion(suggested) except verlib.IrrationalVersionError: raise except StandardError: cls, value, trace = sys.exc_info() new_exc = PackagingError("could not parse %s due to %s: %s" % (what or repr(verstr), cls.__name__, value)) six.reraise(cls, new_exc, trace)