parameters: (package_db)
docstring: This function should be the third pass through the package data when forming
      the package database.
  
      On entry, the package database should have only entries for Trilinos
      packages, and those packages' required and optional dependencies should be
      unordered lists of package names (not package IDs), and can contain
      duplicates.
  
      On exit, the package database will be updated so that Trilinos packages'
      required and optional dependencies are sorted lists of unique package IDs
      (not just names).  Also, the package database will be extended to include
      third-party libraries.
  
      Note that for now, TPL version strings will always be "Unspec".
docstring_summary: This function should be the third pass through the package data when forming
      the package database.
docstring_tokens: This function should be the third pass through the package data when forming the package database .
function: def process_dependencies(package_db):
      """
      This function should be the third pass through the package data when forming
      the package database.
  
      On entry, the package database should have only entries for Trilinos
      packages, and those packages' required and optional dependencies should be
      unordered lists of package names (not package IDs), and can contain
      duplicates.
  
      On exit, the package database will be updated so that Trilinos packages'
      required and optional dependencies are sorted lists of unique package IDs
      (not just names).  Also, the package database will be extended to include
      third-party libraries.
  
      Note that for now, TPL version strings will always be "Unspec".
      """
      trilinos_version = get_trilinos_version(package_db)
      tpl_version      = "Unspec"
      tpl_names        = extract_tpls(package_db)
  
      # Change dependency lists from package names to package IDs
      for packageData in package_db.values():
          for dep in ("required_dep", "optional_dep"):
              dependencies = packageData[dep]
              for i in range(len(dependencies)):
                  if dependencies[i] in tpl_names:
                      dependencies[i] = package_id(dependencies[i],
                                                   tpl_version)
                  else:
                      dependencies[i] = package_id(dependencies[i],
                                                   trilinos_version)
              # Remove duplicates and sort the dependencies
              new_dep = list(set(dependencies))
              new_dep.sort()
              packageData[dep] = new_dep
  
      # Add TPLs to the package database
      for tpl_name in tpl_names:
          tpl_dict = {"name"         : tpl_name,
                      "version"      : tpl_version,
                      "parent"       : "",
                      "maturity"     : "",
                      "sub_packages" : [],
                      "required_dep" : [],
                      "optional_dep" : []
                      }
          tpl_id = package_id(tpl_name, tpl_version)
          package_db[tpl_id] = tpl_dict
function_tokens: def process_dependencies ( package_db ) : trilinos_version = get_trilinos_version ( package_db ) tpl_version = "Unspec" tpl_names = extract_tpls ( package_db ) # Change dependency lists from package names to package IDs for packageData in package_db . values ( ) : for dep in ( "required_dep" , "optional_dep" ) : dependencies = packageData [ dep ] for i in range ( len ( dependencies ) ) : if dependencies [ i ] in tpl_names : dependencies [ i ] = package_id ( dependencies [ i ] , tpl_version ) else : dependencies [ i ] = package_id ( dependencies [ i ] , trilinos_version ) # Remove duplicates and sort the dependencies new_dep = list ( set ( dependencies ) ) new_dep . sort ( ) packageData [ dep ] = new_dep # Add TPLs to the package database for tpl_name in tpl_names : tpl_dict = { "name" : tpl_name , "version" : tpl_version , "parent" : "" , "maturity" : "" , "sub_packages" : [ ] , "required_dep" : [ ] , "optional_dep" : [ ] } tpl_id = package_id ( tpl_name , tpl_version ) package_db [ tpl_id ] = tpl_dict