Esempio n. 1
0
def main(name=None):
    if name not in ('__main__', None):
        return

    from mozapkpublisher.common import main_logging
    main_logging.init()

    parser = ArgumentParser(
        description="""Update the descriptions of an application (multilang)

        Example for updating beta:
        $ python update_apk_description.py --service-account [email protected] \
        --package-name org.mozilla.firefox_beta --credentials key.p12""",
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )

    googleplay.add_general_google_play_arguments(parser)
    parser.add_argument(
        '--package-name',
        choices=store_l10n.STORE_PRODUCT_DETAILS_PER_PACKAGE_NAME.keys(),
        help='The Google play name of the app',
        required=True)
    parser.add_argument('--force-locale',
                        help='Force to a specific locale (instead of all)')
    config = parser.parse_args()
    update_apk_description(config.package_name, config.force_locale,
                           config.commit, config.service_account,
                           config.google_play_credentials_file,
                           config.contact_google_play)
Esempio n. 2
0
    def _init_parser(cls):
        cls.parser = ArgumentParser(
            description="""Upload the apk of a Firefox app on Google play.

    Example for a beta upload:
    $ python push_apk.py --package-name org.mozilla.firefox_beta --track production \
    --service-account [email protected] --credentials key.p12 \
    --apk-x86=/path/to/fennec-XX.0bY.multi.android-i386.apk \
    --apk-armv7-v15=/path/to/fennec-XX.0bY.multi.android-arm-v15.apk""",
            formatter_class=argparse.RawDescriptionHelpFormatter,
        )

        googleplay.add_general_google_play_arguments(cls.parser)

        cls.parser.add_argument('--track', choices=googleplay.TRACK_VALUES, default='alpha',
                                help='Track on which to upload')
        cls.parser.add_argument('--rollout-percentage', type=int, choices=range(0, 101), metavar='[0-100]',
                                default=None,
                                help='The percentage of user who will get the update. Specify only if track is rollout')

        cls.parser.add_argument('--apk-x86', dest='apk_file_x86', type=argparse.FileType(),
                                help='The path to the x86 APK file', required=True)
        cls.parser.add_argument('--apk-armv7-v15', dest='apk_file_armv7_v15', type=argparse.FileType(),
                                help='The path to the ARM v7 API v15 APK file', required=True)

        google_play_strings_group = cls.parser.add_mutually_exclusive_group(required=True)
        google_play_strings_group.add_argument('--no-gp-string-update', dest='update_google_play_strings', action='store_false',
                                               help="Don't update listings and what's new sections on Google Play")
        google_play_strings_group.add_argument('--update-gp-strings-from-l10n-store', dest='update_google_play_strings_from_store',
                                               action='store_true',
                                               help="Download listings and what's new sections from the l10n store and use them \
                                               to update Google Play")
        google_play_strings_group.add_argument('--update-gp-strings-from-file', dest='google_play_strings_file', type=argparse.FileType(),
                                               help="Use file to update listing and what's new section on Google Play.\
                                               Such file can be obtained by calling fetch_l10n_strings.py")
def test_add_general_google_play_arguments():
    parser = argparse.ArgumentParser()
    add_general_google_play_arguments(parser)

    with tempfile.NamedTemporaryFile('wb') as f:
        config = parser.parse_args(
            ['--service-account', 'dummy@dummy', '--credentials', f.name])
        assert config.google_play_credentials_file.name == f.name

    assert config.service_account == 'dummy@dummy'
def test_add_general_google_play_arguments_wrong_package():
    parser = argparse.ArgumentParser()
    add_general_google_play_arguments(parser)

    with tempfile.NamedTemporaryFile('wb') as f:
        with pytest.raises(SystemExit):
            parser.parse_args([
                '--package-name', 'wrong.package.name', '--service-account',
                'dummy@dummy', '--credentials', f.name
            ])
Esempio n. 5
0
    def _init_parser(cls):
        cls.parser = ArgumentParser(
            description='Upload APKs of Firefox for Android on Google play.')

        googleplay.add_general_google_play_arguments(cls.parser)

        cls.parser.add_argument('--track',
                                action='store',
                                required=True,
                                help='Track on which to upload')
        cls.parser.add_argument(
            '--rollout-percentage',
            type=int,
            choices=range(0, 101),
            metavar='[0-100]',
            default=None,
            help=
            'The percentage of user who will get the update. Specify only if track is rollout'
        )

        cls.parser.add_argument(
            'apks',
            metavar='path_to_apk',
            type=argparse.FileType(),
            nargs='+',
            help=
            'The path to the APK to upload. You have to provide every APKs for each architecture/API level. \
                                Missing or extra APKs exit the program without uploading anything'
        )

        google_play_strings_group = cls.parser.add_mutually_exclusive_group(
            required=True)
        google_play_strings_group.add_argument(
            '--no-gp-string-update',
            dest='update_google_play_strings',
            action='store_false',
            help="Don't update listings and what's new sections on Google Play"
        )
        google_play_strings_group.add_argument(
            '--update-gp-strings-from-l10n-store',
            dest='update_google_play_strings_from_store',
            action='store_true',
            help=
            "Download listings and what's new sections from the l10n store and use them \
                                               to update Google Play")
        google_play_strings_group.add_argument(
            '--update-gp-strings-from-file',
            dest='google_play_strings_file',
            type=argparse.FileType(),
            help=
            "Use file to update listing and what's new section on Google Play.\
                                               Such file can be obtained by calling fetch_l10n_strings.py"
        )
Esempio n. 6
0
    def _init_parser(cls):
        cls.parser = argparse.ArgumentParser(
            description="""Update the descriptions of an application (multilang)

    Example for updating beta:
    $ python update_apk_description.py --service-account [email protected] \
    --package-name org.mozilla.firefox_beta --credentials key.p12""",
            formatter_class=argparse.RawDescriptionHelpFormatter,
        )

        googleplay.add_general_google_play_arguments(cls.parser)
        cls.parser.add_argument(
            '--force-locale',
            help='Force to a specific locale (instead of all)')
Esempio n. 7
0
    def _init_parser(cls):
        cls.parser = argparse.ArgumentParser(
            description="""Update the descriptions of an application (multilang)

    Example for updating beta:
    $ python update_apk_description.py --service-account [email protected] \
    --package-name org.mozilla.firefox_beta --credentials key.p12""",
            formatter_class=argparse.RawDescriptionHelpFormatter,
        )

        googleplay.add_general_google_play_arguments(cls.parser)
        cls.parser.add_argument(
            '--package-name',
            choices=store_l10n.STORE_PRODUCT_DETAILS_PER_PACKAGE_NAME.keys(),
            help='The Google play name of the app',
            required=True)
        cls.parser.add_argument(
            '--force-locale',
            help='Force to a specific locale (instead of all)')
Esempio n. 8
0
def main(name=None):
    if name not in ('__main__', None):
        return

    parser = ArgumentParser(
        description='Upload APKs of Firefox for Android on Google play.')

    googleplay.add_general_google_play_arguments(parser)

    parser.add_argument('--track',
                        action='store',
                        required=True,
                        help='Track on which to upload')
    parser.add_argument(
        '--rollout-percentage',
        type=int,
        choices=range(0, 101),
        metavar='[0-100]',
        default=None,
        help=
        'The percentage of user who will get the update. Specify only if track is rollout'
    )
    parser.add_argument(
        '--skip-check-ordered-version-codes',
        action='store_true',
        help=
        'Skip check that asserts version codes are different, x86 code > arm code'
    )
    parser.add_argument(
        '--skip-check-multiple-locales',
        action='store_true',
        help='Skip check that asserts that apks all have multiple locales')
    parser.add_argument(
        '--skip-check-same-locales',
        action='store_true',
        help='Skip check that asserts that all apks have the same locales')
    parser.add_argument(
        '--skip-checks-fennec',
        action='store_true',
        help='Skip checks that are Fennec-specific (ini-checking, checking '
        'version-to-package-name compliance)')

    parser.add_argument(
        'apks',
        metavar='path_to_apk',
        type=argparse.FileType(),
        nargs='+',
        help=
        'The path to the APK to upload. You have to provide every APKs for each architecture/API level. \
                                            Missing or extra APKs exit the program without uploading anything'
    )

    expected_package_names_group = parser.add_mutually_exclusive_group(
        required=True)
    expected_package_names_group.add_argument(
        '--expected-package-name',
        dest='expected_package_names',
        action='append',
        help='Package names apks are expected to match')
    expected_package_names_group.add_argument(
        '--skip-check-package-names',
        action='store_true',
        help='Skip assertion that apks match a specified package name')

    google_play_strings_group = parser.add_mutually_exclusive_group(
        required=True)
    google_play_strings_group.add_argument(
        '--no-gp-string-update',
        dest='update_google_play_strings',
        action='store_false',
        help="Don't update listings and what's new sections on Google Play")
    google_play_strings_group.add_argument(
        '--update-gp-strings-from-l10n-store',
        dest='update_google_play_strings_from_store',
        action='store_true',
        help=
        "Download listings and what's new sections from the l10n store and use them \
                                                           to update Google Play"
    )
    google_play_strings_group.add_argument(
        '--update-gp-strings-from-file',
        dest='google_play_strings_file',
        type=argparse.FileType(),
        help="Use file to update listing and what's new section on Google Play.\
                                                           Such file can be obtained by calling fetch_l10n_strings.py"
    )

    config = parser.parse_args()
    if config.update_google_play_strings_from_store:
        google_play_strings = StoreGooglePlayStrings()
    elif config.google_play_strings_file:
        google_play_strings = FileGooglePlayStrings(
            config.google_play_strings_file)
    else:
        google_play_strings = NoGooglePlayStrings()

    if config.expected_package_names:
        package_names_check = ExpectedPackageNamesCheck(
            config.expected_package_names)
    else:
        package_names_check = AnyPackageNamesCheck()

    try:
        push_apk(config.apks, config.service_account,
                 config.google_play_credentials_file, config.track,
                 package_names_check, google_play_strings,
                 config.rollout_percentage, config.commit,
                 config.contact_google_play,
                 config.skip_check_ordered_version_codes,
                 config.skip_check_multiple_locales,
                 config.skip_check_same_locales, config.skip_checks_fennec)
    except WrongArgumentGiven as e:
        parser.error(e)