def _link_package_versions(self, link, search_name):
platform = get_platform()<EOL>version = None<EOL>if link.egg_fragment:<EOL><INDENT>egg_info = link.egg_fragment<EOL><DEDENT>else:<EOL><INDENT>egg_info, ext = link.splitext()<EOL>if not ext:<EOL><INDENT>if link not in self.logged_links:<EOL><INDENT>logger.debug('<STR_LIT>', link)<EOL>self.logged_links.add(link)<EOL><DEDENT>return<EOL><DEDENT>if egg_info.endswith('<STR_LIT>'):<EOL><INDENT>egg_info = egg_info[:-<NUM_LIT:4>]<EOL>ext = '<STR_LIT>' + ext<EOL><DEDENT>if ext not in self._known_extensions():<EOL><INDENT>if link not in self.logged_links:<EOL><INDENT>logger.debug(<EOL>'<STR_LIT>',<EOL>link,<EOL>ext,<EOL>)<EOL>self.logged_links.add(link)<EOL><DEDENT>return<EOL><DEDENT>if "<STR_LIT>" in link.path and ext == '<STR_LIT>':<EOL><INDENT>if link not in self.logged_links:<EOL><INDENT>logger.debug('<STR_LIT>', link)<EOL>self.logged_links.add(link)<EOL><DEDENT>return<EOL><DEDENT>if ext == wheel_ext:<EOL><INDENT>try:<EOL><INDENT>wheel = Wheel(link.filename)<EOL><DEDENT>except InvalidWheelFilename:<EOL><INDENT>logger.debug(<EOL>'<STR_LIT>',<EOL>link<EOL>)<EOL>return<EOL><DEDENT>if (pkg_resources.safe_name(wheel.name).lower()<EOL>!= pkg_resources.safe_name(search_name).lower()):<EOL><INDENT>logger.debug(<EOL>'<STR_LIT>',<EOL>link,<EOL>search_name,<EOL>)<EOL>return<EOL><DEDENT>if not wheel.supported():<EOL><INDENT>logger.debug(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>',<EOL>link,<EOL>)<EOL>return<EOL><DEDENT>comes_from = getattr(link, "<STR_LIT>", None)<EOL>if (<EOL>(<EOL>not platform.startswith('<STR_LIT>')<EOL>and not platform.startswith('<STR_LIT>')<EOL>and not platform == '<STR_LIT>'<EOL>)<EOL>and comes_from is not None<EOL>and urllib_parse.urlparse(<EOL>comes_from.url<EOL>).netloc.endswith(PyPI.netloc)):<EOL><INDENT>if not wheel.supported(tags=supported_tags_noarch):<EOL><INDENT>logger.debug(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>link,<EOL>)<EOL>return<EOL><DEDENT><DEDENT>version = wheel.version<EOL><DEDENT><DEDENT>if not version:<EOL><INDENT>version = self._egg_info_matches(egg_info, search_name, link)<EOL><DEDENT>if version is None:<EOL><INDENT>logger.debug(<EOL>'<STR_LIT>',<EOL>link,<EOL>search_name,<EOL>)<EOL>return<EOL><DEDENT>if (link.internal is not None<EOL>and not link.internal<EOL>and not normalize_name(search_name).lower()<EOL>in self.allow_external<EOL>and not self.allow_all_external):<EOL><INDENT>logger.debug("<STR_LIT>", link)<EOL>self.need_warn_external = True<EOL>return<EOL><DEDENT>if (link.verifiable is not None<EOL>and not link.verifiable<EOL>and not (normalize_name(search_name).lower()<EOL>in self.allow_unverified)):<EOL><INDENT>logger.debug(<EOL>"<STR_LIT>",<EOL>link,<EOL>)<EOL>self.need_warn_unverified = True<EOL>return<EOL><DEDENT>match = self._py_version_re.search(version)<EOL>if match:<EOL><INDENT>version = version[:match.start()]<EOL>py_version = match.group(<NUM_LIT:1>)<EOL>if py_version != sys.version[:<NUM_LIT:3>]:<EOL><INDENT>logger.debug(<EOL>'<STR_LIT>', link<EOL>)<EOL>return<EOL><DEDENT><DEDENT>logger.debug('<STR_LIT>', link, version)<EOL>return InstallationCandidate(search_name, version, link)<EOL>
Return an iterable of triples (pkg_resources_version_key,
link, python_version) that can be extracted from the given
link.

Meant to be overridden by subclasses, not called by clients.