def _get_comparison_spec(pkgver):
 match = re.match('^([<>])?(=)?([^<>=]+)$', pkgver)
 if (not match):
  raise CommandExecutionError("Invalid version specification '{0}'.".format(pkgver))
 (gt_lt, eq, verstr) = match.groups()
 oper = (gt_lt or '')
 oper += (eq or '')
 if (oper in ('=', '')):
  oper = '=='
 return (oper, verstr)

def _get_comparison_spec ( pkgver ) : match = re . match ( '^([<>])?(=)?([^<>=]+)$' , pkgver ) if ( not match ) : raise CommandExecutionError ( "Invalid version specification '{0}'." . format ( pkgver ) ) ( gt_lt , eq , verstr ) = match . groups ( ) oper = ( gt_lt or '' ) oper += ( eq or '' ) if ( oper in ( '=' , '' ) ) : oper = '==' return ( oper , verstr )
return a tuple containing the comparison operator and the version .