예제 #1
0
    def _basic_resolver(self, finder, require_hashes=False):
        make_install_req = partial(
            install_req_from_req_string,
            isolated=False,
            use_pep517=None,
        )
        session = PipSession()

        with get_requirement_tracker() as tracker:
            preparer = RequirementPreparer(
                build_dir=os.path.join(self.tempdir, 'build'),
                src_dir=os.path.join(self.tempdir, 'src'),
                download_dir=None,
                build_isolation=True,
                req_tracker=tracker,
                session=session,
                progress_bar='on',
                finder=finder,
                require_hashes=require_hashes,
                use_user_site=False,
                lazy_wheel=False,
            )
            yield Resolver(
                preparer=preparer,
                make_install_req=make_install_req,
                finder=finder,
                wheel_cache=None,
                use_user_site=False,
                upgrade_strategy="to-satisfy-only",
                ignore_dependencies=False,
                ignore_installed=False,
                ignore_requires_python=False,
                force_reinstall=False,
            )
예제 #2
0
 def make_resolver(
     preparer,  # type: RequirementPreparer
     finder,  # type: PackageFinder
     options,  # type: Values
     wheel_cache=None,  # type: Optional[WheelCache]
     use_user_site=False,  # type: bool
     ignore_installed=True,  # type: bool
     ignore_requires_python=False,  # type: bool
     force_reinstall=False,  # type: bool
     upgrade_strategy="to-satisfy-only",  # type: str
     use_pep517=None,  # type: Optional[bool]
     py_version_info=None  # type: Optional[Tuple[int, ...]]
 ):
     # type: (...) -> Resolver
     """
     Create a Resolver instance for the given parameters.
     """
     make_install_req = partial(
         install_req_from_req_string,
         isolated=options.isolated_mode,
         wheel_cache=wheel_cache,
         use_pep517=use_pep517,
     )
     return Resolver(
         preparer=preparer,
         finder=finder,
         make_install_req=make_install_req,
         use_user_site=use_user_site,
         ignore_dependencies=options.ignore_dependencies,
         ignore_installed=ignore_installed,
         ignore_requires_python=ignore_requires_python,
         force_reinstall=force_reinstall,
         upgrade_strategy=upgrade_strategy,
         py_version_info=py_version_info,
     )
예제 #3
0
    def _make_test_resolver(self, monkeypatch, mock_candidates):
        def _find_candidates(project_name):
            return mock_candidates

        finder = make_test_finder()
        monkeypatch.setattr(finder, "find_all_candidates", _find_candidates)

        return Resolver(
            finder=finder,
            preparer=mock.Mock(),  # Not used.
            make_install_req=install_req_from_line,
            wheel_cache=None,
            use_user_site=False,
            force_reinstall=False,
            ignore_dependencies=False,
            ignore_installed=False,
            ignore_requires_python=False,
            upgrade_strategy="to-satisfy-only",
        )
예제 #4
0
    def _basic_resolver(
        self,
        finder: PackageFinder,
        require_hashes: bool = False,
        wheel_cache: Optional[WheelCache] = None,
    ) -> Iterator[Resolver]:
        make_install_req = partial(
            install_req_from_req_string,
            isolated=False,
            use_pep517=None,
        )
        session = PipSession()

        with get_build_tracker() as tracker:
            preparer = RequirementPreparer(
                build_dir=os.path.join(self.tempdir, "build"),
                src_dir=os.path.join(self.tempdir, "src"),
                download_dir=None,
                build_isolation=True,
                check_build_deps=False,
                build_tracker=tracker,
                session=session,
                progress_bar="on",
                finder=finder,
                require_hashes=require_hashes,
                use_user_site=False,
                lazy_wheel=False,
                verbosity=0,
            )
            yield Resolver(
                preparer=preparer,
                make_install_req=make_install_req,
                finder=finder,
                wheel_cache=wheel_cache,
                use_user_site=False,
                upgrade_strategy="to-satisfy-only",
                ignore_dependencies=False,
                ignore_installed=False,
                ignore_requires_python=False,
                force_reinstall=False,
            )