def _link_package_versions(self, link, search, ignore_compatibility=True):<EOL>
version = None<EOL>if link.egg_fragment:<EOL><INDENT>egg_info = link.egg_fragment<EOL>ext = link.ext<EOL><DEDENT>else:<EOL><INDENT>egg_info, ext = link.splitext()<EOL>if not ext:<EOL><INDENT>self._log_skipped_link(link, '<STR_LIT>')<EOL>return None<EOL><DEDENT>if ext not in SUPPORTED_EXTENSIONS:<EOL><INDENT>self._log_skipped_link(<EOL>link, '<STR_LIT>' % ext,<EOL>)<EOL>return None<EOL><DEDENT>if "<STR_LIT>" not in search.formats and ext == WHEEL_EXTENSION and not ignore_compatibility:<EOL><INDENT>self._log_skipped_link(<EOL>link, '<STR_LIT>' % search.supplied,<EOL>)<EOL>return None<EOL><DEDENT>if "<STR_LIT>" in link.path and ext == '<STR_LIT>' and not ignore_compatibility:<EOL><INDENT>self._log_skipped_link(link, '<STR_LIT>')<EOL>return None<EOL><DEDENT>if ext == WHEEL_EXTENSION:<EOL><INDENT>try:<EOL><INDENT>wheel = Wheel(link.filename)<EOL><DEDENT>except InvalidWheelFilename:<EOL><INDENT>self._log_skipped_link(link, '<STR_LIT>')<EOL>return None<EOL><DEDENT>if canonicalize_name(wheel.name) != search.canonical:<EOL><INDENT>self._log_skipped_link(<EOL>link, '<STR_LIT>' % search.supplied)<EOL>return None<EOL><DEDENT>if not wheel.supported(self.valid_tags) and not ignore_compatibility:<EOL><INDENT>self._log_skipped_link(<EOL>link, '<STR_LIT>')<EOL>return None<EOL><DEDENT>version = wheel.version<EOL><DEDENT><DEDENT>if "<STR_LIT:source>" not in search.formats and ext != WHEEL_EXTENSION:<EOL><INDENT>self._log_skipped_link(<EOL>link, '<STR_LIT>' % search.supplied,<EOL>)<EOL>return None<EOL><DEDENT>if not version:<EOL><INDENT>version = _egg_info_matches(egg_info, search.canonical)<EOL><DEDENT>if not version:<EOL><INDENT>self._log_skipped_link(<EOL>link, '<STR_LIT>' % search.supplied)<EOL>return None<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>self._log_skipped_link(<EOL>link, '<STR_LIT>')<EOL>return None<EOL><DEDENT><DEDENT>try:<EOL><INDENT>support_this_python = check_requires_python(link.requires_python)<EOL><DEDENT>except specifiers.InvalidSpecifier:<EOL><INDENT>logger.debug("<STR_LIT>",<EOL>link.filename, link.requires_python)<EOL>support_this_python = True<EOL><DEDENT>if not support_this_python and not ignore_compatibility:<EOL><INDENT>logger.debug("<STR_LIT>"<EOL>"<STR_LIT>",<EOL>link, link.requires_python)<EOL>return None<EOL><DEDENT>logger.debug('<STR_LIT>', link, version)<EOL>return InstallationCandidate(search.supplied, version, link, link.requires_python)<EOL>
Return an InstallationCandidate or None