def compare_versions(ver1='', oper='==', ver2='', cmp_func=None, ignore_epoch=False):
 cmp_map = {'<': ((-1),), '<=': ((-1), 0), '==': (0,), '>=': (0, 1), '>': (1,)}
 if ((oper not in ('!=',)) and (oper not in cmp_map)):
  log.error("Invalid operator '%s' for version comparison", oper)
  return False
 if (cmp_func is None):
  cmp_func = version_cmp
 cmp_result = cmp_func(ver1, ver2, ignore_epoch=ignore_epoch)
 if (cmp_result is None):
  return False
 if (not isinstance(cmp_result, numbers.Integral)):
  log.error('The version comparison function did not return an integer/long.')
  return False
 if (oper == '!='):
  return (cmp_result not in cmp_map['=='])
 else:
  if (cmp_result < (-1)):
   cmp_result = (-1)
  elif (cmp_result > 1):
   cmp_result = 1
  return (cmp_result in cmp_map[oper])

def compare_versions ( ver1 = '' , oper = '==' , ver2 = '' , cmp_func = None , ignore_epoch = False ) : cmp_map = { '<' : ( ( - 1 ) , ) , '<=' : ( ( - 1 ) , 0 ) , '==' : ( 0 , ) , '>=' : ( 0 , 1 ) , '>' : ( 1 , ) } if ( ( oper not in ( '!=' , ) ) and ( oper not in cmp_map ) ) : log . error ( "Invalid operator '%s' for version comparison" , oper ) return False if ( cmp_func is None ) : cmp_func = version_cmp cmp_result = cmp_func ( ver1 , ver2 , ignore_epoch = ignore_epoch ) if ( cmp_result is None ) : return False if ( not isinstance ( cmp_result , numbers . Integral ) ) : log . error ( 'The version comparison function did not return an integer/long.' ) return False if ( oper == '!=' ) : return ( cmp_result not in cmp_map [ '==' ] ) else : if ( cmp_result < ( - 1 ) ) : cmp_result = ( - 1 ) elif ( cmp_result > 1 ) : cmp_result = 1 return ( cmp_result in cmp_map [ oper ] )
return true if a is greater than or equal to b .