def _dist_flags_allows_release(self, flags, pkg_data, release):
        """
        Check if a release is allowed by the distribution flags.
        :param flags: the (distribution) flags
        :type flags: int
        :param pkg_data: package information
        :type pkg_data: dict
        :param release: the release to check
        :type release: str
        :return: whether the flags allow this release or not
        :rtype: boolean
        """
        downloads = self._package_downloads(pkg_data, release)
        for download in downloads:
            pt = download.get("packagetype", None)
            if pt is None:
                continue
            elif pt in ("source", "sdist"):
                # source distribution
                if (flags & FLAG_DIST_ALLOW_SRC > 0):
                    return True
            elif pt in ("bdist_wheel", "wheel", "whl"):
                # wheel
                if (flags & FLAG_DIST_ALLOW_WHL > 0):
                    return True
        # no allowed downloads found
        return False

        Check if a release is allowed by the distribution flags.
        :param flags: the (distribution) flags
        :type flags: int
        :param pkg_data: package information
        :type pkg_data: dict
        :param release: the release to check
        :type release: str
        :return: whether the flags allow this release or not
        :rtype: boolean
        
bin/pip.py