Example #1
0
def run(args, project_options):
    lifecycle_command = _get_lifecycle_command(args)
    argless_command = _get_command_from_arg(args)
    if lifecycle_command:
        lifecycle.execute(
            lifecycle_command, project_options, args['<part>'])
    elif argless_command:
        argless_command()
    elif args['clean']:
        step = args['--step']
        if step == 'strip':
            logger.warning('DEPRECATED: Use `prime` instead of `strip` '
                           'as the step to clean')
            step = 'prime'
        lifecycle.clean(project_options, args['<part>'], step)
    elif args['upload']:
        snapcraft.upload(args['<snap-file>'])
    elif args['cleanbuild']:
        lifecycle.cleanbuild(project_options),
    # disable until the tour command is activated
    # elif args['tour']:
    #    _scaffold_examples(args['<directory>'] or _SNAPCRAFT_TOUR_DIR)
    elif args['help']:
        snapcraft.topic_help(args['<topic>'] or args['<plugin>'],
                             args['--devel'], args['topics'])
    else:  # snap by default:
        lifecycle.snap(project_options, args['<directory>'], args['--output'])

    return project_options
Example #2
0
def run(args, project_options):
    lifecycle_command = _get_lifecycle_command(args)
    argless_command = _get_command_from_arg(args)
    if lifecycle_command:
        lifecycle.execute(lifecycle_command, project_options, args['<part>'])
    elif argless_command:
        argless_command()
    elif args['clean']:
        step = args['--step']
        if step == 'strip':
            logger.warning('DEPRECATED: Use `prime` instead of `strip` '
                           'as the step to clean')
            step = 'prime'
        lifecycle.clean(project_options, args['<part>'], step)
    elif args['upload']:
        snapcraft.upload(args['<snap-file>'])
    elif args['cleanbuild']:
        lifecycle.cleanbuild(project_options),
    elif args['tour']:
        _scaffold_examples(args['<directory>'] or _SNAPCRAFT_TOUR_DIR)
    elif args['help']:
        snapcraft.topic_help(args['<topic>'] or args['<plugin>'],
                             args['--devel'], args['topics'])
    else:  # snap by default:
        lifecycle.snap(project_options, args['<directory>'], args['--output'])

    return project_options
Example #3
0
def run(args, project_options):  # noqa
    lifecycle_command = _get_lifecycle_command(args)
    argless_command = _get_command_from_arg(args)
    if lifecycle_command:
        lifecycle.execute(lifecycle_command, project_options, args['<part>'])
    elif argless_command:
        argless_command()
    elif args['clean']:
        _run_clean(args, project_options)
    elif args['cleanbuild']:
        lifecycle.cleanbuild(project_options, remote=args['--remote']),
    elif _is_store_command(args):
        _run_store_command(args)
    elif args['tour']:
        _scaffold_examples(args['<directory>'] or _SNAPCRAFT_TOUR_DIR)
    elif args['help']:
        snapcraft.topic_help(args['<topic>'] or args['<plugin>'],
                             args['--devel'], args['topics'])
    elif args['enable-ci']:
        enable_ci(args['<ci-system>'], args['--refresh'])
    elif args['update']:
        parts.update()
    elif args['define']:
        parts.define(args['<part-name>'])
    elif args['search']:
        parts.search(' '.join(args['<query>']))
    else:  # snap by default:
        lifecycle.snap(project_options, args['<directory>'], args['--output'])

    return project_options
Example #4
0
def run(args, project_options):  # noqa
    lifecycle_command = _get_lifecycle_command(args)
    argless_command = _get_command_from_arg(args)
    if lifecycle_command:
        lifecycle.execute(
            lifecycle_command, project_options, args['<part>'])
    elif argless_command:
        argless_command()
    elif args['clean']:
        _run_clean(args, project_options)
    elif args['cleanbuild']:
        lifecycle.cleanbuild(project_options),
    elif _is_store_command(args):
        _run_store_command(args)
    elif args['tour']:
        _scaffold_examples(args['<directory>'] or _SNAPCRAFT_TOUR_DIR)
    elif args['help']:
        snapcraft.topic_help(args['<topic>'] or args['<plugin>'],
                             args['--devel'], args['topics'])
    elif args['update']:
        parts.update()
    elif args['define']:
        parts.define(args['<part-name>'])
    elif args['search']:
        parts.search(' '.join(args['<query>']))
    else:  # snap by default:
        lifecycle.snap(project_options, args['<directory>'], args['--output'])

    return project_options
Example #5
0
def run(args, project_options):
    lifecycle_command = _get_lifecycle_command(args)
    argless_command = _get_command_from_arg(args)
    if lifecycle_command:
        lifecycle.execute(lifecycle_command, project_options, args['<part>'])
    elif argless_command:
        argless_command()
    elif args['clean']:
        lifecycle.clean(project_options, args['<part>'], args['--step'])
    elif args['upload']:
        snapcraft.upload(args['<snap-file>'])
    elif args['cleanbuild']:
        lifecycle.cleanbuild(project_options),
    elif args['help']:
        snapcraft.topic_help(args['<topic>'] or args['<plugin>'],
                             args['--devel'], args['topics'])
    else:  # snap by default:
        lifecycle.snap(project_options, args['<directory>'], args['--output'])

    return project_options
Example #6
0
def run(args, project_options):
    lifecycle_command = _get_lifecycle_command(args)
    argless_command = _get_command_from_arg(args)
    if lifecycle_command:
        lifecycle.execute(
            lifecycle_command, project_options, args['<part>'])
    elif argless_command:
        argless_command()
    elif args['clean']:
        lifecycle.clean(project_options, args['<part>'], args['--step'])
    elif args['upload']:
        snapcraft.upload(args['<snap-file>'])
    elif args['cleanbuild']:
        lifecycle.cleanbuild(project_options),
    elif args['help']:
        snapcraft.topic_help(args['<topic>'] or args['<plugin>'],
                             args['--devel'], args['topics'])
    else:  # snap by default:
        lifecycle.snap(project_options, args['<directory>'], args['--output'])

    return project_options
Example #7
0
    def _create_core_snap(self):
        core_path = os.path.join(self.path, 'core')
        snap_yaml_path = os.path.join(core_path, 'meta', 'snap.yaml')
        os.makedirs(os.path.dirname(snap_yaml_path))
        with open(snap_yaml_path, 'w') as f:
            print('name: core', file=f)
            print('version: 1', file=f)
            print('architectures: [{}]'.format(self.project_options.deb_arch),
                  file=f)
            print('summary: summary', file=f)
            print('description: description', file=f)

        return lifecycle.snap(self.project_options, directory=core_path)
Example #8
0
    def _create_core_snap(self):
        core_path = os.path.join(self.path, 'core')
        snap_yaml_path = os.path.join(core_path, 'meta', 'snap.yaml')
        os.makedirs(os.path.dirname(snap_yaml_path))
        with open(snap_yaml_path, 'w') as f:
            print('name: core', file=f)
            print('version: 1', file=f)
            print('architectures: [{}]'.format(
                self.project_options.deb_arch), file=f)
            print('summary: summary', file=f)
            print('description: description', file=f)

        return lifecycle.snap(self.project_options, directory=core_path)
Example #9
0
def snap(directory, output, **kwargs):
    """Create a snap.

    \b
    Examples:
        snapcraft snap
        snapcraft snap --output renamed-snap.snap

    If you want to snap a directory, you should use the snap-dir command
    instead.
    """
    project_options = get_project_options(**kwargs)
    if env.is_containerbuild():
        lifecycle.containerbuild('snap', project_options, output, directory)
    else:
        snap_name = lifecycle.snap(project_options,
                                   directory=directory,
                                   output=output)
        echo.info('Snapped {}'.format(snap_name))
Example #10
0
def snap(directory, output, **kwargs):
    """Create a snap.

    \b
    Examples:
        snapcraft snap
        snapcraft snap --output renamed-snap.snap

    If you want to snap a directory, you should use the pack command
    instead.
    """
    if directory:
        deprecations.handle_deprecation_notice('dn6')

    project_options = get_project_options(**kwargs)
    container_config = env.get_container_config()
    if container_config.use_container:
        lifecycle.containerbuild('snap', project_options,
                                 container_config, output, directory)
    else:
        snap_name = lifecycle.snap(
            project_options, directory=directory, output=output)
        echo.info('Snapped {}'.format(snap_name))
Example #11
0
def snap(directory, output, **kwargs):
    """Create a snap.

    \b
    Examples:
        snapcraft snap
        snapcraft snap --output renamed-snap.snap

    If you want to snap a directory, you should use the pack command
    instead.
    """
    if directory:
        deprecations.handle_deprecation_notice('dn6')

    project_options = get_project_options(**kwargs)
    container_config = env.get_container_config()
    if container_config.use_container:
        lifecycle.containerbuild('snap', project_options,
                                 container_config, output, directory)
    else:
        snap_name = lifecycle.snap(
            project_options, directory=directory, output=output)
        echo.info('Snapped {}'.format(snap_name))
Example #12
0
def run(args, project_options):  # noqa
    lifecycle_command = _get_lifecycle_command(args)
    argless_command = _get_command_from_arg(args)
    if lifecycle_command:
        if _is_containerbuild():
            lifecycle.containerbuild(lifecycle_command, project_options,
                                     args['<part>'])
        else:
            lifecycle.execute(
                lifecycle_command, project_options, args['<part>'])
    elif argless_command:
        argless_command()
    elif args['clean']:
        if _is_containerbuild():
            step = args['--step'] or 'pull'
            lifecycle.containerbuild('clean', project_options,
                                     args=['--step', step] + args['<part>'])
        else:
            _run_clean(args, project_options)
    elif args['cleanbuild']:
        lifecycle.cleanbuild(project_options, remote=args['--remote']),
    elif _is_store_command(args):
        _run_store_command(args)
    elif args['tour']:
        _scaffold_examples(args['<directory>'] or _SNAPCRAFT_TOUR_DIR)
    elif args['help']:
        snapcraft.topic_help(args['<topic>'] or args['<plugin>'],
                             args['--devel'], args['topics'])
    elif args['enable-ci']:
        enable_ci(args['<ci-system>'], args['--refresh'])
    elif args['update']:
        if _is_containerbuild():
            lifecycle.containerbuild('update', project_options)
        else:
            parts.update()
    elif args['define']:
        if _is_containerbuild():
            lifecycle.containerbuild('update', project_options,
                                     args=args['<part-name>'])
        else:
            parts.define(args['<part-name>'])
    elif args['search']:
        if _is_containerbuild():
            lifecycle.containerbuild('search', project_options,
                                     args=' '.join(args['<query>']))
        else:
            parts.search(' '.join(args['<query>']))
    else:  # snap by default:
        if _is_containerbuild():
            lifecycle.containerbuild('snap', project_options, args['--output'],
                                     args['<directory>'])
        elif os.getenv('SNAPCRAFT_COLLABORATE'):
            # this is only for testing
            snapcraft.collaborate(
                os.getenv('SNAPCRAFT_COLLABORATORS_SNAP_NAME'),
                os.getenv('SNAPCRAFT_COLLABORATORS_SIGN_KEY'))
        else:
            lifecycle.snap(project_options, args['<directory>'],
                           args['--output'])

    return project_options