Exemplo n.º 1
0
def read_settings(args=None):
    global _ARGS
    if args is not None:
        _ARGS = args

    def _make(name, tags, project, show_error):
        Name.set_name(name)
        Name.set_tags(tags)
        Path.set_project_path(project_path=project, show_error=show_error)

        DataFile.compute_command_path(force=True)
        return MergeSettings(args)

    # Read a settings file with a given name, tags, and project.
    # First, make a settings with the default information.
    merge_settings = _make(None, [], None, False)

    # Now, use the name, tags and project to get the correct configuration.
    get = merge_settings.args.get

    name = get('name') or Name.lookup(get('map', {}).get('name', {}))
    tags = get('tag') or Name.lookup(get('map', {}).get('tag', {})) or []
    project = get('project')

    if not isinstance(tags, (list, tuple)):
        tags = [tags]

    prompt = not get('execution', 'autostart')
    global MERGE_SETTINGS
    MERGE_SETTINGS = _make(name, tags, project, prompt)
Exemplo n.º 2
0
def read_settings(args=None):
    global _ARGS
    if args is not None:
        _ARGS = args

    def _make(name, tags, project, show_error):
        Name.set_name(name)
        Name.set_tags(tags)
        Path.set_project_path(project_path=project, show_error=show_error)

        DataFile.compute_command_path(force=True)
        return MergeSettings(args)

    # Read a settings file with a given name, tags, and project.
    # First, make a settings with the default information.
    merge_settings = _make(None, [], None, False)

    # Now, use the name, tags and project to get the correct configuration.
    get = merge_settings.args.get

    name = get('name') or Name.lookup(get('map', {}).get('name', {}))
    tags = get('tag') or Name.lookup(get('map', {}).get('tag', {})) or []
    project = get('project')

    if not isinstance(tags, (list, tuple)):
        tags = [tags]

    prompt = not get('execution', 'autostart')
    global MERGE_SETTINGS
    MERGE_SETTINGS = _make(name, tags, project, prompt)
Exemplo n.º 3
0
def _get_name_and_tags():
  name = Name.lookup(get('map', 'name'))
  if name:
    Name.set_name(name)

  tags = Name.lookup(get('map', 'tag'))
  if tags:
    if isinstance(tags, six.string_types):
      tags = [tags]
    Name.TAGS = tags

  if name or tags:
    CommandFile.compute_command_path()
Exemplo n.º 4
0
def reconfigure(args):
  # Read a configuration file with a given name, tags, and project.
  # First, make a config with the default information.
  merge_config = _make(None, [], None, False, args)

  # Now, use the name, tags and project to get the correct configuration.
  get = merge_config.config.get

  name = get('name') or Name.lookup(get('map', {}).get('name', {}))
  tags = get('tag') or Name.lookup(get('map', {}).get('tag', {})) or []
  project = get('project')

  if not isinstance(tags, (list, tuple)):
    tags = [tags]

  prompt = not get('autostart')
  return _make(name, tags, project, prompt, args)