def test_eval_content(self):
     try:
         # Intrinsics are not available.
         isolate_format.eval_content('map(str, [1, 2])')
         self.fail()
     except NameError:
         pass
Ejemplo n.º 2
0
 def test_eval_content(self):
   try:
     # Intrinsics are not available.
     isolate_format.eval_content('map(str, [1, 2])')
     self.fail()
   except NameError:
     pass
Ejemplo n.º 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)
  """
  # pylint: disable=W0212
  configs = isolate_format.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 = isolate_format.load_isolate_as_config(
        os.path.dirname(item),
        isolate_format.eval_content(content),
        isolate_format.extract_comment(content))
    logging.debug('has configs: ' + ','.join(map(repr, new_config._by_config)))
    configs = configs.union(new_config)
  logging.debug('Total configs: ' + ','.join(map(repr, configs._by_config)))
  return configs
Ejemplo n.º 4
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)
  """
    # pylint: disable=W0212
    configs = isolate_format.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 = isolate_format.load_isolate_as_config(
            os.path.dirname(item), isolate_format.eval_content(content),
            isolate_format.extract_comment(content))
        logging.debug('has configs: ' +
                      ','.join(map(repr, new_config._by_config)))
        configs = configs.union(new_config)
    logging.debug('Total configs: ' + ','.join(map(repr, configs._by_config)))
    return configs
Ejemplo n.º 5
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)
  """
    # pylint: disable=W0212
    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