mavenversioncmp.py
def _isContained (version, versionRangeExpr):
  """ Compares version against given version range in order to see if
  it matches given criteria.
  """
  version = re.sub (r'\s+', '', version)
  versionRangeExpr = re.sub (r'\s+', '', versionRangeExpr)
  if version == versionRangeExpr:
    return True

  versionRanges = versionRangeExpr.split(',')
  if len(versionRanges) == 0:
    return False

  elif len(versionRanges) == 1:
    # has no braces/brackets, it means it is like '1.0' 
    # and should be normalized to '[1.0,]'
    if len(versionRanges[0]) == len(versionRanges[0].strip('[]()')):
      lowerBound = '[%s' % versionRanges[0]
      upperBound = ']'

    # has braces/brackets like '[1.2]', and will normalize to '[1.2,1.2]'
    else:
      lowerBound = '[%s' % versionRanges[0].strip('()[],')
      upperBound = '%s]' % versionRanges[0].strip('()[],')

    return _isContainedInBounds (version, lowerBound, upperBound)

  elif len(versionRanges) == 2:
    return _isContainedInBounds (
      version,
      lowerBound = versionRanges[0],
      upperBound = versionRanges[1]
    )

  else:
    raise Exception ("Version ranges expression not well formed: %s" % versionRangeExpr)

  return False
 Compares version against given version range in order to see if
  it matches given criteria.
  
Compares version against given version range in order to see if
it matches given criteria.
Compares version against given version range in order to see if it matches given criteria .
def _isContained (version, versionRangeExpr):
  version = re.sub (r'\s+', '', version)
  versionRangeExpr = re.sub (r'\s+', '', versionRangeExpr)
  if version == versionRangeExpr:
    return True
  versionRanges = versionRangeExpr.split(',')
  if len(versionRanges) == 0:
    return False
  elif len(versionRanges) == 1:
    if len(versionRanges[0]) == len(versionRanges[0].strip('[]()')):
      lowerBound = '[%s' % versionRanges[0]
      upperBound = ']'
    else:
      lowerBound = '[%s' % versionRanges[0].strip('()[],')
      upperBound = '%s]' % versionRanges[0].strip('()[],')
    return _isContainedInBounds (version, lowerBound, upperBound)
  elif len(versionRanges) == 2:
    return _isContainedInBounds (
      version,
      lowerBound = versionRanges[0],
      upperBound = versionRanges[1]
    )
  else:
    raise Exception ("Version ranges expression not well formed: %s" % versionRangeExpr)
  return False
def _isContained ( version , versionRangeExpr ) : version = re . sub ( r'\s+' , '' , version ) versionRangeExpr = re . sub ( r'\s+' , '' , versionRangeExpr ) if version == versionRangeExpr : return True versionRanges = versionRangeExpr . split ( ',' ) if len ( versionRanges ) == 0 : return False elif len ( versionRanges ) == 1 : if len ( versionRanges [ 0 ] ) == len ( versionRanges [ 0 ] . strip ( '[]()' ) ) : lowerBound = '[%s' % versionRanges [ 0 ] upperBound = ']' else : lowerBound = '[%s' % versionRanges [ 0 ] . strip ( '()[],' ) upperBound = '%s]' % versionRanges [ 0 ] . strip ( '()[],' ) return _isContainedInBounds ( version , lowerBound , upperBound ) elif len ( versionRanges ) == 2 : return _isContainedInBounds ( version , lowerBound = versionRanges [ 0 ] , upperBound = versionRanges [ 1 ] ) else : raise Exception ( "Version ranges expression not well formed: %s" % versionRangeExpr ) return False
Compares version against given version range in order to see if
it matches given criteria.
Compares version against given version range in order to see if it matches given criteria .
""" Compares version against given version range in order to see if
  it matches given criteria.
  """ # has no braces/brackets, it means it is like '1.0'  # and should be normalized to '[1.0,]' # has braces/brackets like '[1.2]', and will normalize to '[1.2,1.2]'
version
versionRangeExpr