code: def get_installation_order(self, req_set):
          # type: (RequirementSet) -> List[InstallRequirement]
          
          # The current implementation, which we may change at any point
          # installs the user specified things in the order given, except when
          # dependencies must come earlier to achieve topological order.
          order = []
          ordered_reqs = set()  # type: Set[InstallRequirement]
  
          def schedule(req):
              if req.satisfied_by or req in ordered_reqs:
                  return
              if req.constraint:
                  return
              ordered_reqs.add(req)
              for dep in self._discovered_dependencies[req.name]:
                  schedule(dep)
              order.append(req)
  
          for install_req in req_set.requirements.values():
              schedule(install_req)
          return order
docs: Create the installation order.
  
          The installation order is topological - requirements are installed
          before the requiring thing. We break cycles at an arbitrary point,
          and make no other guarantees.