Пример #1
0
 def test_eval_content(self):
     try:
         # Intrinsics are not available.
         merge_isolate.eval_content('map(str, [1, 2])')
         self.fail()
     except NameError:
         pass
Пример #2
0
 def test_eval_content(self):
   try:
     # Intrinsics are not available.
     merge_isolate.eval_content('map(str, [1, 2])')
     self.fail()
   except NameError:
     pass
Пример #3
0
def CMDmerge(args):
  """Reads and merges the data from the trace back into the original .isolate.

  Ignores --outdir.
  """
  parser = OptionParserIsolate(command='merge', require_result=False)
  options, _ = parser.parse_args(args)
  complete_state = load_complete_state(options, NO_INFO)
  value = read(complete_state)

  # Now take that data and union it into the original .isolate file.
  with open(complete_state.saved_state.isolate_file, 'r') as f:
    prev_content = f.read()
  prev_config = merge_isolate.load_gyp(
      merge_isolate.eval_content(prev_content),
      merge_isolate.extract_comment(prev_content),
      merge_isolate.DEFAULT_OSES)
  new_config = merge_isolate.load_gyp(
      value,
      '',
      merge_isolate.DEFAULT_OSES)
  config = merge_isolate.union(prev_config, new_config)
  # pylint: disable=E1103
  data = merge_isolate.convert_map_to_gyp(
      *merge_isolate.reduce_inputs(*merge_isolate.invert_map(config.flatten())))
  print 'Updating %s' % complete_state.saved_state.isolate_file
  with open(complete_state.saved_state.isolate_file, 'wb') as f:
    merge_isolate.print_all(config.file_comment, data, f)

  return 0
Пример #4
0
def load_isolate(content, error):
    """Loads the .isolate file. Returns the command, dependencies and read_only
  flag.
  """
    # Load the .isolate file, process its conditions, retrieve the command and
    # dependencies.
    configs = merge_isolate.load_gyp(merge_isolate.eval_content(content))
    flavor = trace_inputs.get_flavor()
    config = configs.per_os.get(flavor) or configs.per_os.get(None)
    if not config:
        error('Failed to load configuration for \'%s\'' % flavor)
    # Merge tracked and untracked dependencies, isolate.py doesn't care about the
    # trackability of the dependencies, only the build tool does.
    return config.command, config.tracked + config.untracked, config.read_only
Пример #5
0
def load_isolate(content, error):
  """Loads the .isolate file. Returns the command, dependencies and read_only
  flag.
  """
  # Load the .isolate file, process its conditions, retrieve the command and
  # dependencies.
  configs = merge_isolate.load_gyp(merge_isolate.eval_content(content))
  flavor = trace_inputs.get_flavor()
  config = configs.per_os.get(flavor) or configs.per_os.get(None)
  if not config:
    error('Failed to load configuration for \'%s\'' % flavor)
  # Merge tracked and untracked dependencies, isolate.py doesn't care about the
  # trackability of the dependencies, only the build tool does.
  return config.command, config.tracked + config.untracked, config.read_only
Пример #6
0
def load_isolate(content, error):
    """Loads the .isolate file and returns the information unprocessed.

  Returns the command, dependencies and read_only flag. The dependencies are
  fixed to use os.path.sep.
  """
    # Load the .isolate file, process its conditions, retrieve the command and
    # dependencies.
    configs = merge_isolate.load_gyp(merge_isolate.eval_content(content))
    flavor = trace_inputs.get_flavor()
    config = configs.per_os.get(flavor) or configs.per_os.get(None)
    if not config:
        error("Failed to load configuration for '%s'" % flavor)
    # Merge tracked and untracked dependencies, isolate.py doesn't care about the
    # trackability of the dependencies, only the build tool does.
    dependencies = [f.replace("/", os.path.sep) for f in config.tracked + config.untracked]
    return config.command, dependencies, config.read_only
Пример #7
0
def load_isolate(content, variables, error):
    """Loads the .isolate file. Returns the command, dependencies and read_only
  flag.
  """
    # Load the .isolate file, process its conditions, retrieve the command and
    # dependencies.
    configs = merge_isolate.load_gyp(merge_isolate.eval_content(content))
    flavor = trace_inputs.get_flavor()
    config = configs.per_os.get(flavor) or configs.per_os.get(None)
    if not config:
        error('Failed to load configuration for \'%s\'' % flavor)

    # Convert the variables and merge tracked and untracked dependencies.
    # isolate.py doesn't care about the trackability of the dependencies.
    infiles = [eval_variables(f, variables) for f in config.tracked
               ] + [eval_variables(f, variables) for f in config.untracked]
    command = [eval_variables(i, variables) for i in config.command]
    return command, infiles, config.read_only
Пример #8
0
def load_isolate(content, error):
    """Loads the .isolate file and returns the information unprocessed.

  Returns the command, dependencies and read_only flag. The dependencies are
  fixed to use os.path.sep.
  """
    # Load the .isolate file, process its conditions, retrieve the command and
    # dependencies.
    configs = merge_isolate.load_gyp(merge_isolate.eval_content(content), None,
                                     merge_isolate.DEFAULT_OSES)
    flavor = isolate_common.get_flavor()
    config = configs.per_os.get(flavor) or configs.per_os.get(None)
    if not config:
        error('Failed to load configuration for \'%s\'' % flavor)
    # Merge tracked and untracked dependencies, isolate.py doesn't care about the
    # trackability of the dependencies, only the build tool does.
    dependencies = [
        f.replace('/', os.path.sep) for f in config.tracked + config.untracked
    ]
    return config.command, dependencies, config.read_only
Пример #9
0
def load_isolate(content):
  """Loads the .isolate file and returns the information unprocessed.

  Returns the command, dependencies and read_only flag. The dependencies are
  fixed to use os.path.sep.
  """
  # Load the .isolate file, process its conditions, retrieve the command and
  # dependencies.
  configs = merge_isolate.load_gyp(
      merge_isolate.eval_content(content), None, merge_isolate.DEFAULT_OSES)
  flavor = isolate_common.get_flavor()
  config = configs.per_os.get(flavor) or configs.per_os.get(None)
  if not config:
    raise ExecutionError('Failed to load configuration for \'%s\'' % flavor)
  # Merge tracked and untracked dependencies, isolate.py doesn't care about the
  # trackability of the dependencies, only the build tool does.
  dependencies = [
    f.replace('/', os.path.sep) for f in config.tracked + config.untracked
  ]
  touched = [f.replace('/', os.path.sep) for f in config.touched]
  return config.command, dependencies, touched, config.read_only