(paths, inputs)
return result_list
Calculates the dependencies for given inputs.

  Description:
    This method takes a list of paths (files, directories) and builds a
    searchable data structure based on the namespaces that each .js file
    provides.  It then parses through each input, resolving dependencies
    against this data structure.  The final output is a list of files,
    including the inputs, that represent all of the code that is needed to
    compile the given inputs.

  Args:
    paths: the references (files, directories) that are used to build the
      dependency hash.
    inputs: the inputs (files, directories, namespaces) that have dependencies
      that need to be calculated.

  Raises:
    Exception: if a provided input is invalid.

  Returns:
    A list of all files, including inputs, that are needed to compile the given
    inputs.
Calculates the dependencies for given inputs.
Calculates the dependencies for given inputs .
def CalculateDependencies(paths, inputs):
  """Calculates the dependencies for given inputs.

  Description:
    This method takes a list of paths (files, directories) and builds a
    searchable data structure based on the namespaces that each .js file
    provides.  It then parses through each input, resolving dependencies
    against this data structure.  The final output is a list of files,
    including the inputs, that represent all of the code that is needed to
    compile the given inputs.

  Args:
    paths: the references (files, directories) that are used to build the
      dependency hash.
    inputs: the inputs (files, directories, namespaces) that have dependencies
      that need to be calculated.

  Raises:
    Exception: if a provided input is invalid.

  Returns:
    A list of all files, including inputs, that are needed to compile the given
    inputs.
  """
  deps = BuildDependenciesFromFiles(paths + inputs)
  search_hash = BuildDependencyHashFromDependencies(deps)
  result_list = []
  seen_list = []
  for input_file in inputs:
    if IsNamespace(input_file):
      namespace = re.search(ns_regex, input_file).group(1)
      if namespace not in search_hash:
        raise Exception('Invalid namespace (%s)' % namespace)
      input_file = search_hash[namespace].filename
    if not IsValidFile(input_file) or not IsJsFile(input_file):
      raise Exception('Invalid file (%s)' % input_file)
    seen_list.append(input_file)
    file_handle = open(input_file, 'r')
    try:
      for line in file_handle:
        if re.match(req_regex, line):
          require = re.search(req_regex, line).group(1)
          ResolveDependencies(require, search_hash, result_list, seen_list)
    finally:
      file_handle.close()
    result_list.append(input_file)

  # All files depend on base.js, so put it first.
  base_js_path = FindClosureBasePath(paths)
  if base_js_path:
    result_list.insert(0, base_js_path)
  else:
    logging.warning('Closure Library base.js not found.')

  return result_list
def CalculateDependencies ( paths , inputs ) : deps = BuildDependenciesFromFiles ( paths + inputs ) search_hash = BuildDependencyHashFromDependencies ( deps ) result_list = [ ] seen_list = [ ] for input_file in inputs : if IsNamespace ( input_file ) : namespace = re . search ( ns_regex , input_file ) . group ( 1 ) if namespace not in search_hash : raise Exception ( 'Invalid namespace (%s)' % namespace ) input_file = search_hash [ namespace ] . filename if not IsValidFile ( input_file ) or not IsJsFile ( input_file ) : raise Exception ( 'Invalid file (%s)' % input_file ) seen_list . append ( input_file ) file_handle = open ( input_file , 'r' ) try : for line in file_handle : if re . match ( req_regex , line ) : require = re . search ( req_regex , line ) . group ( 1 ) ResolveDependencies ( require , search_hash , result_list , seen_list ) finally : file_handle . close ( ) result_list . append ( input_file ) # All files depend on base.js, so put it first. base_js_path = FindClosureBasePath ( paths ) if base_js_path : result_list . insert ( 0 , base_js_path ) else : logging . warning ( 'Closure Library base.js not found.' ) return result_list