(os_name, artifact_mode=False, no_interactive=False)
Ensure the Android SDK (and NDK, if `artifact_mode` is falsy) are
    installed.  If not, fetch and unpack the SDK and/or NDK from the
    given URLs.  Ensure the required Android SDK packages are
    installed.

    `os_name` can be 'linux' or 'macosx'.
Ensure the Android SDK (and NDK, if `artifact_mode` is falsy) are
    installed.  If not, fetch and unpack the SDK and/or NDK from the
    given URLs.  Ensure the required Android SDK packages are
    installed.
Ensure the Android SDK ( and NDK if artifact_mode is falsy ) are installed . If not fetch and unpack the SDK and / or NDK from the given URLs . Ensure the required Android SDK packages are installed .
def ensure_android(os_name, artifact_mode=False, no_interactive=False):
    '''
    Ensure the Android SDK (and NDK, if `artifact_mode` is falsy) are
    installed.  If not, fetch and unpack the SDK and/or NDK from the
    given URLs.  Ensure the required Android SDK packages are
    installed.

    `os_name` can be 'linux' or 'macosx'.
    '''
    # The user may have an external Android SDK (in which case we
    # save them a lengthy download), or they may have already
    # completed the download. We unpack to
    # ~/.mozbuild/{android-sdk-$OS_NAME, android-ndk-$VER}.
    mozbuild_path, sdk_path, ndk_path = get_paths(os_name)
    os_tag = 'darwin' if os_name == 'macosx' else os_name
    sdk_url = 'https://dl.google.com/android/repository/sdk-tools-{0}-3859397.zip'.format(os_tag)
    ndk_url = android_ndk_url(os_name)

    ensure_android_sdk_and_ndk(mozbuild_path, os_name,
                               sdk_path=sdk_path, sdk_url=sdk_url,
                               ndk_path=ndk_path, ndk_url=ndk_url,
                               artifact_mode=artifact_mode)

    if no_interactive:
        # Cribbed from observation and https://stackoverflow.com/a/38381577.
        path = os.path.join(mozbuild_path, 'android-sdk-{0}'.format(os_name), 'licenses')
        ensure_dir(path)

        licenses = {
            'android-sdk-license': '8933bad161af4178b1185d1a37fbf41ea5269c55',
            'android-sdk-preview-license': '84831b9409646a918e30573bab4c9c91346d8abd',
        }
        for license, tag in licenses.items():
            lname = os.path.join(path, license)
            if not os.path.isfile(lname):
                open(lname, 'w').write('\n{0}\n'.format(tag))


    # We expect the |sdkmanager| tool to be at
    # ~/.mozbuild/android-sdk-$OS_NAME/tools/bin/sdkmanager.
    sdkmanager_tool = os.path.join(sdk_path, 'tools', 'bin', 'sdkmanager')
    ensure_android_packages(sdkmanager_tool=sdkmanager_tool)
def ensure_android ( os_name , artifact_mode = False , no_interactive = False ) : # The user may have an external Android SDK (in which case we # save them a lengthy download), or they may have already # completed the download. We unpack to # ~/.mozbuild/{android-sdk-$OS_NAME, android-ndk-$VER}. mozbuild_path , sdk_path , ndk_path = get_paths ( os_name ) os_tag = 'darwin' if os_name == 'macosx' else os_name sdk_url = 'https://dl.google.com/android/repository/sdk-tools-{0}-3859397.zip' . format ( os_tag ) ndk_url = android_ndk_url ( os_name ) ensure_android_sdk_and_ndk ( mozbuild_path , os_name , sdk_path = sdk_path , sdk_url = sdk_url , ndk_path = ndk_path , ndk_url = ndk_url , artifact_mode = artifact_mode ) if no_interactive : # Cribbed from observation and https://stackoverflow.com/a/38381577. path = os . path . join ( mozbuild_path , 'android-sdk-{0}' . format ( os_name ) , 'licenses' ) ensure_dir ( path ) licenses = { 'android-sdk-license' : '8933bad161af4178b1185d1a37fbf41ea5269c55' , 'android-sdk-preview-license' : '84831b9409646a918e30573bab4c9c91346d8abd' , } for license , tag in licenses . items ( ) : lname = os . path . join ( path , license ) if not os . path . isfile ( lname ) : open ( lname , 'w' ) . write ( '\n{0}\n' . format ( tag ) ) # We expect the |sdkmanager| tool to be at # ~/.mozbuild/android-sdk-$OS_NAME/tools/bin/sdkmanager. sdkmanager_tool = os . path . join ( sdk_path , 'tools' , 'bin' , 'sdkmanager' ) ensure_android_packages ( sdkmanager_tool = sdkmanager_tool )