def _get_filtered_builds()

in bedrock/firefox/firefox_details.py [0:0]


    def _get_filtered_builds(self, builds, channel, version=None, query=None):
        """
        Get a list of builds, sorted by english locale name, for a specific
        Firefox version.
        :param builds: a build dict from the JSON
        :param channel: one of self.version_map.keys().
        :param version: a firefox version. one of self.latest_versions.
        :param query: a string to match against native or english locale name
        :return: list
        """
        locales = [build["locale"]["code"] for build in builds]
        f_builds = []

        # For now, only list the multi-locale builds because the single-locale
        # builds are fragile (Bug 1301650)
        locales = ["multi"]

        for locale in locales:
            if locale == "multi":
                name_en = "Multi-locale"
                name_native = ""
            elif locale in self.languages:
                name_en = self.languages[locale]["English"]
                name_native = self.languages[locale]["native"]
            else:
                continue

            build_info = {
                "locale": locale,
                "name_en": name_en,
                "name_native": name_native,
                "platforms": {},
            }

            # only include builds that match a search query
            if query is not None and not self._matches_query(build_info, query):
                continue

            for arch, platform in self.platform_map.items():
                # x86 builds are not localized yet
                if arch == "x86" and locale not in ["multi", "en-US"]:
                    continue

                # Use a direct link instead of Google Play for the /all/ page
                url = self.get_download_url(channel, arch, locale, True)
                build_info["platforms"][platform] = {"download_url": url}

            f_builds.append(build_info)

        return f_builds