Exemple #1
0
def test_cross_check_apks(apks_metadata_per_paths, package_names_check,
                          skip_checks_fennec, skip_check_multiple_locales,
                          skip_check_same_locales,
                          skip_check_ordered_version_codes):
    cross_check_apks(apks_metadata_per_paths, package_names_check,
                     skip_checks_fennec, skip_check_multiple_locales,
                     skip_check_same_locales, skip_check_ordered_version_codes)
Exemple #2
0
    def run(self):
        apks_paths = [apk.name for apk in self.config.apks]
        apks_metadata_per_paths = {
            apk_path: extractor.extract_metadata(apk_path)
            for apk_path in apks_paths
        }

        checker.cross_check_apks(apks_metadata_per_paths)

        # Each distinct product must be uploaded in different Google Play transaction, so we split them by package name here.
        split_apk_metadata = _split_apk_metadata_per_package_name(
            apks_metadata_per_paths)

        for (package_name, apks_metadata) in split_apk_metadata.items():
            if self.config.google_play_strings_file:
                l10n_strings = json.load(self.config.google_play_strings_file)
                store_l10n.check_translations_schema(l10n_strings)
                logger.info(
                    'Loaded listings and what\'s new section from "{}"'.format(
                        self.config.google_play_strings_file.name))
            elif self.config.update_google_play_strings_from_store:
                logger.info(
                    "Downloading listings and what's new section from L10n Store..."
                )
                l10n_strings = store_l10n.get_translations_per_google_play_locale_code(
                    package_name)
            elif not self.config.update_google_play_strings:
                logger.warn("Listing and what's new section won't be updated.")
                l10n_strings = None
            else:
                raise WrongArgumentGiven(
                    "Option missing. You must provide what to do in regards to Google Play strings."
                )

            self.upload_apks(apks_metadata, package_name, l10n_strings)
Exemple #3
0
    def run(self):
        apks_paths = [apk.name for apk in self.config.apks]
        apks_metadata_per_paths = {
            apk_path: extractor.extract_metadata(apk_path)
            for apk_path in apks_paths
        }

        checker.cross_check_apks(apks_metadata_per_paths)
        package_name = list(
            apks_metadata_per_paths.values())[0]['package_name']

        if self.config.google_play_strings_file:
            l10n_strings = json.load(self.config.google_play_strings_file)
            store_l10n.check_translations_schema(l10n_strings)
            logger.info(
                'Loaded listings and what\'s new section from "{}"'.format(
                    self.config.google_play_strings_file.name))
        elif self.config.update_google_play_strings_from_store:
            logger.info(
                "Downloading listings and what's new section from L10n Store..."
            )
            l10n_strings = store_l10n.get_translations_per_google_play_locale_code(
                package_name)
        elif not self.config.update_google_play_strings:
            logger.warn("Listing and what's new section won't be updated.")
            l10n_strings = None
        else:
            raise WrongArgumentGiven(
                "Option missing. You must provide what to do in regards to Google Play strings."
            )

        self.upload_apks(apks_metadata_per_paths, package_name, l10n_strings)
Exemple #4
0
def test_cross_check_apks():
    cross_check_apks({
        'fennec-57.0.multi.android-arm.apk': {
            'api_level': 16,
            'architecture': 'armeabi-v7a',
            'firefox_build_id': '20171112125738',
            'firefox_version': '57.0',
            'locales': (
                'an', 'ar', 'as', 'ast', 'az', 'be', 'bg', 'bn-IN', 'br', 'ca', 'cak', 'cs', 'cy',
                'da', 'de', 'dsb', 'el', 'en-GB', 'en-US', 'en-ZA', 'eo', 'es-AR', 'es-CL', 'es-ES',
                'es-MX', 'et', 'eu', 'fa', 'ff', 'fi', 'fr', 'fy-NL', 'ga-IE', 'gd', 'gl', 'gn',
                'gu-IN', 'he', 'hi-IN', 'hr', 'hsb', 'hu', 'hy-AM', 'id', 'is', 'it', 'ja', 'ka',
                'kab', 'kk', 'kn', 'ko', 'lo', 'lt', 'lv', 'mai', 'ml', 'mr', 'ms', 'my', 'nb-NO',
                'nl', 'nn-NO', 'or', 'pa-IN', 'pl', 'pt-BR', 'pt-PT', 'rm', 'ro', 'ru', 'sk', 'sl',
                'son', 'sq', 'sr', 'sv-SE', 'ta', 'te', 'th', 'tr', 'uk', 'ur', 'uz', 'wo', 'xh',
                'zam', 'zh-CN', 'zh-TW',
            ),
            'package_name': 'org.mozilla.firefox',
            'version_code': '2015523297',
        },
        'fennec-57.0.multi.android-i386.apk': {
            'api_level': 16,
            'architecture': 'x86',
            'firefox_build_id': '20171112125738',
            'firefox_version': '57.0',
            'locales': (
                'an', 'ar', 'as', 'ast', 'az', 'be', 'bg', 'bn-IN', 'br', 'ca', 'cak', 'cs', 'cy',
                'da', 'de', 'dsb', 'el', 'en-GB', 'en-US', 'en-ZA', 'eo', 'es-AR', 'es-CL', 'es-ES',
                'es-MX', 'et', 'eu', 'fa', 'ff', 'fi', 'fr', 'fy-NL', 'ga-IE', 'gd', 'gl', 'gn',
                'gu-IN', 'he', 'hi-IN', 'hr', 'hsb', 'hu', 'hy-AM', 'id', 'is', 'it', 'ja', 'ka',
                'kab', 'kk', 'kn', 'ko', 'lo', 'lt', 'lv', 'mai', 'ml', 'mr', 'ms', 'my', 'nb-NO',
                'nl', 'nn-NO', 'or', 'pa-IN', 'pl', 'pt-BR', 'pt-PT', 'rm', 'ro', 'ru', 'sk', 'sl',
                'son', 'sq', 'sr', 'sv-SE', 'ta', 'te', 'th', 'tr', 'uk', 'ur', 'uz', 'wo', 'xh',
                'zam', 'zh-CN', 'zh-TW',
            ),
            'package_name': 'org.mozilla.firefox',
            'version_code': '2015523300',
        },
    })
    cross_check_apks({
        'Focus.apk': {
            'api_level': 21,
            'architecture': 'armeabi-v7',
            'package_name': 'org.mozilla.focus',
            'version_code': '11'
        },
        'Klar.apk': {
            'api_level': 21,
            'architecture': 'armeabi-v7',
            'package_name': 'org.mozilla.klar',
            'version_code': '11'
        }
    })
    def run(self):
        apks_paths = [apk.name for apk in self.apks]
        apks_metadata_per_paths = {
            apk_path: extractor.extract_metadata(apk_path,
                                                 not self.skip_checks_fennec)
            for apk_path in apks_paths
        }
        checker.cross_check_apks(apks_metadata_per_paths,
                                 self.package_names_check,
                                 self.skip_checks_fennec,
                                 self.skip_check_multiple_locales,
                                 self.skip_check_same_locales,
                                 self.skip_check_ordered_version_codes)

        # Each distinct product must be uploaded in different Google Play transaction, so we split them
        # by package name here.
        split_apk_metadata = _split_apk_metadata_per_package_name(
            apks_metadata_per_paths)

        for (package_name, apks_metadata) in split_apk_metadata.items():
            l10n_strings = self.google_play_strings.get_strings(package_name)
            self.upload_apks(apks_metadata, package_name, l10n_strings)
def extract_and_check_apks_metadata(
    apks,
    expected_package_names,
    skip_checks_fennec,
    skip_check_multiple_locales,
    skip_check_same_locales,
    skip_check_ordered_version_codes,
):
    apks_metadata = {
        apk: extract_metadata(apk.name, not skip_check_ordered_version_codes,
                              not skip_check_same_locales and not skip_check_multiple_locales,
                              not skip_checks_fennec)
        for apk in apks
    }
    cross_check_apks(
        apks_metadata,
        expected_package_names,
        skip_checks_fennec,
        skip_check_multiple_locales,
        skip_check_same_locales,
        skip_check_ordered_version_codes,
    )

    return apks_metadata