Skip to content

Commit

Permalink
Separate req set creation into a new method
Browse files Browse the repository at this point in the history
  • Loading branch information
McSinyx committed Jul 28, 2020
1 parent a8edffd commit 191f962
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Empty file.
13 changes: 10 additions & 3 deletions src/pip/_internal/resolution/resolvelib/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .factory import Factory

if MYPY_CHECK_RUNNING:
from typing import Dict, List, Optional, Set, Tuple
from typing import Dict, Iterable, List, Optional, Set, Tuple

from pip._vendor.packaging.specifiers import SpecifierSet
from pip._vendor.resolvelib.resolvers import Result
Expand All @@ -28,6 +28,7 @@
from pip._internal.operations.prepare import RequirementPreparer
from pip._internal.req.req_install import InstallRequirement
from pip._internal.resolution.base import InstallRequirementProvider
from pip._internal.resolution.resolvelib.base import Candidate


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -120,13 +121,19 @@ def resolve(self, root_reqs, check_supported_wheels):
self._result = resolver.resolve(
requirements, max_rounds=try_to_avoid_resolution_too_deep,
)

except ResolutionImpossible as e:
error = self.factory.get_installation_error(e)
six.raise_from(error, e)

return self._make_req_set(
self._result.mapping.values(),
check_supported_wheels,
)

def _make_req_set(self, candidates, check_supported_wheels):
# type: (Iterable[Candidate], bool) -> RequirementSet
req_set = RequirementSet(check_supported_wheels=check_supported_wheels)
for candidate in self._result.mapping.values():
for candidate in candidates:
ireq = candidate.get_install_requirement()
if ireq is None:
continue
Expand Down

0 comments on commit 191f962

Please sign in to comment.