Пример #1
0
def install(package_file=None, verbose=False, dry_run=False):
    version(warning_only=True)

    try:
        configuration = Configuration.auto_discover(package_file)
    except yaml.YAMLError as e:
        if verbose:
            console.error('Cannot parse package file: {}'.format(e))
        task.exit(2)
        return  # suppress pycharm warning

    if configuration:
        if verbose:
            console.info('resolved package file: {}'.format(configuration.config_file_path))
    else:
        if verbose:
            console.error('Cannot find package file.')
        task.exit(1)
        return  # suppress pycharm warning

    # Go
    if dry_run and verbose:
        console.info('dry run: depot-pm won\'t perfom following commands.')

    for command in configuration.commands:
        if verbose:
            console.info('Execute command: {}'.format(command))
        if not dry_run:
            run(command, should_raise_when_fail=True)
        else:
            console.show(command)

    if verbose:
        console.success('done')
Пример #2
0
def check(test_name, args=(), verbose=False):
    try:
        check_core(test_name, *args)
    except ValueError as e:
        if verbose:
            console.error(str(e))
        task.exit(1)
    else:
        task.exit(0)