parameters: (env)
docstring: Takes a dict |env| whose values are strings that can refer to other keys,
    for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of
    env such that key2 is after key1 in L if env[key2] refers to env[key1].
  
    Throws an Exception in case of dependency cycles.
docstring_summary: Takes a dict |env| whose values are strings that can refer to other keys,
    for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of
    env such that key2 is after key1 in L if env[key2] refers to env[key1].
docstring_tokens: Takes a dict |env| whose values are strings that can refer to other keys for example env [ foo ] = $ ( bar ) and $ ( baz ) . Returns a list L of all keys of env such that key2 is after key1 in L if env [ key2 ] refers to env [ key1 ] .
function: def _TopologicallySortedEnvVarKeys(env):
      """Takes a dict |env| whose values are strings that can refer to other keys,
    for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of
    env such that key2 is after key1 in L if env[key2] refers to env[key1].
  
    Throws an Exception in case of dependency cycles.
    """
      # Since environment variables can refer to other variables, the evaluation
      # order is important. Below is the logic to compute the dependency graph
      # and sort it.
      regex = re.compile(r"\$\{([a-zA-Z0-9\-_]+)\}")
  
      def GetEdges(node):
          # Use a definition of edges such that user_of_variable -> used_varible.
          # This happens to be easier in this case, since a variable's
          # definition contains all variables it references in a single string.
          # We can then reverse the result of the topological sort at the end.
          # Since: reverse(topsort(DAG)) = topsort(reverse_edges(DAG))
          matches = {v for v in regex.findall(env[node]) if v in env}
          for dependee in matches:
              assert "${" not in dependee, "Nested variables not supported: " + dependee
          return matches
  
      try:
          # Topologically sort, and then reverse, because we used an edge definition
          # that's inverted from the expected result of this function (see comment
          # above).
          order = gyp.common.TopologicallySorted(env.keys(), GetEdges)
          order.reverse()
          return order
      except gyp.common.CycleError as e:
          raise GypError(
              "Xcode environment variables are cyclically dependent: " + str(e.nodes)
          )
function_tokens: def _TopologicallySortedEnvVarKeys ( env ) : # Since environment variables can refer to other variables, the evaluation # order is important. Below is the logic to compute the dependency graph # and sort it. regex = re . compile ( r"\$\{([a-zA-Z0-9\-_]+)\}" ) def GetEdges ( node ) : # Use a definition of edges such that user_of_variable -> used_varible. # This happens to be easier in this case, since a variable's # definition contains all variables it references in a single string. # We can then reverse the result of the topological sort at the end. # Since: reverse(topsort(DAG)) = topsort(reverse_edges(DAG)) matches = { v for v in regex . findall ( env [ node ] ) if v in env } for dependee in matches : assert "${" not in dependee , "Nested variables not supported: " + dependee return matches try : # Topologically sort, and then reverse, because we used an edge definition # that's inverted from the expected result of this function (see comment # above). order = gyp . common . TopologicallySorted ( env . keys ( ) , GetEdges ) order . reverse ( ) return order except gyp . common . CycleError as e : raise GypError ( "Xcode environment variables are cyclically dependent: " + str ( e . nodes ) )