Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
def _make(name, tags, project, show_error, args):
  Name.set_name(name)
  Name.set_tags(tags)
  Path.set_project_path(project_path=project, show_error=show_error)

  CommandFile.compute_command_path()
  return MergeConfig.MergeConfig(args)
Exemplo n.º 3
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.º 4
0
    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)
Exemplo n.º 5
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.º 6
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.º 7
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)
Exemplo n.º 8
0
    def __init__(self, instance):
        super(Peers, self).__init__()
        self.lock = Lock()
        self.instance = instance
        self.type = Peers.TYPE
        source = Name.NAME
        self.data = dict(Name.info(),
                         type=self.type,
                         time=time.time(),
                         ascii_time=time.asctime(),
                         source=source)

        self._peers = {source: self.data}
Exemplo n.º 9
0
  def __init__(self, instance):
    super(Peers, self).__init__()
    self.lock = Lock()
    self.instance = instance
    self.type = Peers.TYPE
    source = Name.NAME
    self.data = dict(Name.info(),
                     type=self.type,
                     time=time.time(),
                     ascii_time=time.asctime(),
                     source=source)

    self._peers = {source: self.data}
Exemplo n.º 10
0
def names(_):
    _info(Name.names())
Exemplo n.º 11
0
def info(_):
    _info(Name.info())
Exemplo n.º 12
0
def addresses(_):
    _info(Name.addresses())