#NEWLINE# def _candidate_sort_key( self , candidate ) : #NEWLINE# #INDENT# '\n        Function used to generate link sort key for link tuples.\n        The greater the return value, the more preferred it is.\n        If not finding wheels, then sorted by version only.\n        If finding wheels, then the sort order is by version, then:\n          1. existing installs\n          2. wheels ordered via Wheel.support_index_min()\n          3. source archives\n        Note: it was considered to embed this logic into the Link\n              comparison operators, but then different sdist links\n              with the same version, would have to be considered equal\n        ' #NEWLINE# support_num = len ( supported_tags ) #NEWLINE# if candidate . location . is_wheel : #NEWLINE# #INDENT# wheel = Wheel ( candidate . location . filename ) #NEWLINE# if ( not wheel . supported ( ) ) : #NEWLINE# #INDENT# raise UnsupportedWheel ( ( "%s is not a supported wheel for this platform. It can't be sorted." % wheel . filename ) ) #NEWLINE# #UNINDENT# pri = ( - wheel . support_index_min ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pri = ( - support_num ) #NEWLINE# #UNINDENT# return ( candidate . version , pri )