def main():
    common.config = {
        'accepted_formats': 'yml',
        'sdk_path': os.getenv('ANDROID_HOME'),
    }
    common.fill_config_defaults(common.config)
    parser = argparse.ArgumentParser(
        usage="%(prog)s [options] [APPID[:VERCODE] [APPID[:VERCODE] ...]]")
    common.setup_global_opts(parser)
    parser.add_argument(
        "appid",
        nargs='*',
        help=
        _("applicationId with optional versionCode in the form APPID[:VERCODE]"
          ))
    metadata.add_metadata_arguments(parser)
    options = parser.parse_args()
    common.options = options
    pkgs = common.read_pkg_args(options.appid, True)
    allapps = metadata.read_metadata(pkgs)
    apps = common.read_app_args(options.appid, allapps, True)
    srclib_dir = os.path.join('build', 'srclib')
    os.makedirs(srclib_dir, exist_ok=True)
    srclibpaths = []
    for appid, app in apps.items():
        for build in app.get('Builds', []):
            for lib in build.srclibs:
                srclibpaths.append(
                    common.getsrclib(lib, srclib_dir, build=build))
    print('Set up srclibs:')
    pprint.pprint(srclibpaths)
Ejemplo n.º 2
0
 def get_config(self):
     config = {}
     common.fill_config_defaults(config)
     common.config = config
     common.options = Options
     update.config = config
     update.options = Options
     server.config = config
     server.options = Options
     return config
Ejemplo n.º 3
0
def requirements_check(app_configs, **kwargs):  # pylint: disable=unused-argument
    errors = []
    config = {}
    common.fill_config_defaults(config)
    common.config = config
    if 'keytool' not in config:
        errors.append(
            Error(
                'Could not find `keytool` program.',
                hint='This program usually comes with Java. Try to install JRE. '
                'On Debian-based system you can try to run '
                '`apt install openjdk-8-jre-headless`.',
            ))
    if 'jarsigner' not in config and not common.set_command_in_config(
            'apksigner'):
        errors.append(
            Error(
                'Could not find `jarsigner` or `apksigner`. At least one of them is required.',
                hint=
                'Please install the missing tool. On Debian-based systems you can try to run '
                '`apt install apksigner`.',
            ))
    # aapt
    try:
        common.SdkToolsPopen(['aapt', 'version'], output=False)
    except FDroidException:
        errors.append(
            Error(
                'Could not find `aapt` program.',
                hint='This program can be found in the Android SDK. '
                'On Debian-based systems you can also try to run `apt install aapt` '
                'to install it.',
            ))
    # rsync
    if common.find_command('rsync') is None:
        errors.append(
            Error(
                'Could not find `rsync` program.',
                hint=
                'Please install it before continuing. On Debian-based systems you can run '
                '`apt install rsync`.',
            ))
    # git
    if common.find_command('git') is None:
        errors.append(
            Error(
                'Could not find `git` program.',
                hint=
                'Please install it before continuing. On Debian-based systems you can run '
                '`apt install git`.',
            ))
    return errors
Ejemplo n.º 4
0
def requirements_check(app_configs, **kwargs):  # pylint: disable=unused-argument
    errors = []
    config = {}
    common.fill_config_defaults(config)
    common.config = config
    if 'keytool' not in config:
        errors.append(
            Error(
                'Could not find `keytool` program.',
                hint='This program usually comes with Java. Try to install JRE. '
                'On Debian-based system you can try to run '
                '`apt install default-jre-headless`.',
            ))
    if 'jarsigner' not in config and not common.set_command_in_config(
            'apksigner'):
        errors.append(
            Error(
                'Could not find `jarsigner` or `apksigner`. At least one of them is required.',
                hint=
                'Please install the missing tool. On Debian-based systems you can try to run '
                '`apt install apksigner`.',
            ))
    # rsync
    if common.find_command('rsync') is None:
        errors.append(
            Error(
                'Could not find `rsync` program.',
                hint=
                'Please install it before continuing. On Debian-based systems you can run '
                '`apt install rsync`.',
            ))
    # git
    if common.find_command('git') is None:
        errors.append(
            Error(
                'Could not find `git` program.',
                hint=
                'Please install it before continuing. On Debian-based systems you can run '
                '`apt install git`.',
            ))
    return errors