Exemplo n.º 1
0
def get_architecture_and_build_type_and_product_from_variant(variant):
    for supported_product in _SUPPORTED_PRODUCTS:
        if variant.startswith(supported_product):
            product = supported_product
            break
    else:
        raise ValueError(
            'Cannot identify product in "{}". '
            'Expected to find one of these supported ones: {}'.format(
                variant, _SUPPORTED_PRODUCTS))

    for supported_build_type in _SUPPORTED_BUILD_TYPES:
        if variant.endswith(supported_build_type):
            build_type = lower_case_first_letter(supported_build_type)
            break
    else:
        raise ValueError(
            'Cannot identify build type in "{}". '
            'Expected to find one of these supported ones: {}'.format(
                variant, _SUPPORTED_BUILD_TYPES))

    remaining_variant_data = variant[len(product):-len(build_type)]
    remaining_variant_data = remaining_variant_data.lower()
    for supported_architecture in _SUPPORTED_ARCHITECTURES:
        if remaining_variant_data == supported_architecture:
            architecture = supported_architecture
            break
    else:
        raise ValueError(
            'Cannot identify architecture in "{}". '
            'Expected to find one of these supported ones: {}'.format(
                variant, _SUPPORTED_ARCHITECTURES))

    return architecture, build_type, product
Exemplo n.º 2
0
def get_architecture_and_build_type_from_variant(variant):
    for supported_architecture in _SUPPORTED_ARCHITECTURES:
        if variant.startswith(supported_architecture):
            architecture = supported_architecture
            break
    else:
        raise ValueError(
            'Cannot identify architecture in "{}". '
            'Expected to find one of these supported ones: {}'.format(
                variant, _SUPPORTED_ARCHITECTURES))

    build_type = variant[len(architecture):]
    build_type = lower_case_first_letter(build_type)
    return architecture, build_type
Exemplo n.º 3
0
def _craft_apk_full_path_from_variant(variant):
    architecture, build_type, product = _get_architecture_and_build_type_and_product_from_variant(
        variant)

    short_variant = variant[:-len(build_type)]
    postfix = '-unsigned' if build_type.startswith('release') else ''
    product = lower_case_first_letter(product)

    return '/opt/fenix/app/build/outputs/apk/{short_variant}/{build_type}/app-{architecture}-{product}-{build_type}{postfix}.apk'.format(  # noqa: E501
        architecture=architecture,
        build_type=build_type,
        product=product,
        short_variant=short_variant,
        postfix=postfix)