Beispiel #1
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)
Beispiel #2
0
    def run(self):
        # Matching version codes will be added during runtime.
        apks = {
            'armv7_v15': {
                'file': self.config.apk_file_armv7_v15.name,
            },
            'x86': {
                'file': self.config.apk_file_x86.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(self.config.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, l10n_strings)
Beispiel #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)
def test_download_files(package_name):
    with tempfile.NamedTemporaryFile('w+t', encoding='utf-8') as f:
        get_l10n_strings(package_name, f)

        f.seek(0)
        data = json.load(f)
        # In reality, this call is already done by GetL10nStrings, but better safe than sorry
        check_translations_schema(data)
def test_download_files(package_name):
    with tempfile.NamedTemporaryFile('w+t', encoding='utf-8') as f:
        config = {
            'package_name': package_name,
            'output_file': f.name,
        }
        GetL10nStrings(config).run()

        f.seek(0)
        data = json.load(f)
        # In reality, this call is already done by GetL10nStrings, but better safe than sorry
        check_translations_schema(data)
 def get_strings(self, _):
     logger.info('Loaded listings and what\'s new section from "{}"'.format(
         self.file))
     strings = json.load(self.file)
     store_l10n.check_translations_schema(strings)
     return strings
Beispiel #7
0
def test_check_translations_schema(translations):
    check_translations_schema(translations)
Beispiel #8
0
def test_bad_check_translations_schema(translations, exception):
    with pytest.raises(exception):
        check_translations_schema(translations)