'Function used to generate link sort key for link tuples.
The greater the return value, the more preferred it is.
If not finding wheels, then sorted by version only.
If finding wheels, then the sort order is by version, then:
1. existing installs
2. wheels ordered via Wheel.support_index_min()
3. source archives
Note: it was considered to embed this logic into the Link
comparison operators, but then different sdist links
with the same version, would have to be considered equal'

def _candidate_sort_key(self, candidate):

    support_num = len(supported_tags)
    if candidate.location.is_wheel:
        wheel = Wheel(candidate.location.filename)
        if (not wheel.supported()):
            raise UnsupportedWheel(("%s    is    not    a    supported    wheel    for    this    platform.    It    can't    be    sorted." % wheel.filename))
        pri = (- wheel.support_index_min())
    else:
        pri = (- support_num)
    return (candidate.version, pri)
