Beispiel #1
0
 def test_eval_content(self):
   try:
     # Intrinsics are not available.
     isolate.eval_content('map(str, [1, 2])')
     self.fail()
   except NameError:
     pass
Beispiel #2
0
def load_isolates(items):
  """Parses each .isolate file and returns the merged results.

  It only loads what load_isolate_as_config() can process.

  Return values:
    files: dict(filename, set(OS where this filename is a dependency))
    dirs:  dict(dirame, set(OS where this dirname is a dependency))
    oses:  set(all the OSes referenced)
    """
  configs = None
  for item in items:
    item = os.path.abspath(item)
    logging.debug('loading %s' % item)
    if item == '-':
      content = sys.stdin.read()
    else:
      with open(item, 'r') as f:
        content = f.read()
    new_config = load_isolate_as_config(
        os.path.dirname(item),
        eval_content(content),
        extract_comment(content))
    logging.debug('has configs: ' + ','.join(map(repr, new_config.by_config)))
    configs = union(configs, new_config)
  logging.debug('Total configs: ' + ','.join(map(repr, configs.by_config)))
  return configs
Beispiel #3
0
def load_isolates(items):
    """Parses each .isolate file and returns the merged results.

  It only loads what load_isolate_as_config() can process.

  Return values:
    files: dict(filename, set(OS where this filename is a dependency))
    dirs:  dict(dirame, set(OS where this dirname is a dependency))
    oses:  set(all the OSes referenced)
    """
    configs = None
    for item in items:
        item = os.path.abspath(item)
        logging.debug('loading %s' % item)
        if item == '-':
            content = sys.stdin.read()
        else:
            with open(item, 'r') as f:
                content = f.read()
        new_config = load_isolate_as_config(os.path.dirname(item),
                                            eval_content(content),
                                            extract_comment(content))
        logging.debug('has configs: ' +
                      ','.join(map(repr, new_config.by_config)))
        configs = union(configs, new_config)
    logging.debug('Total configs: ' + ','.join(map(repr, configs.by_config)))
    return configs
Beispiel #4
0
def load_isolates(items, default_oses):
  """Parses each .isolate file and returns the merged results.

  It only loads what load_isolate_as_config() can process.

  Return values:
    files: dict(filename, set(OS where this filename is a dependency))
    dirs:  dict(dirame, set(OS where this dirname is a dependency))
    oses:  set(all the OSes referenced)
    """
  configs = Configs(default_oses, None)
  for item in items:
    logging.debug('loading %s' % item)
    with open(item, 'r') as f:
      content = f.read()
    new_config = load_isolate_as_config(
        eval_content(content), extract_comment(content), default_oses)
    logging.debug('has OSes: %s' % ','.join(k for k in new_config.per_os if k))
    configs = union(configs, new_config)
  logging.debug('Total OSes: %s' % ','.join(k for k in configs.per_os if k))
  return configs