(
        self,
        requirement_set,  # type: RequirementSet
        req_to_install  # type: InstallRequirement
    )
return more_reqs
Prepare a single requirements file.

        :return: A list of additional InstallRequirements to also install.
Prepare a single requirements file.
Prepare a single requirements file .
def _resolve_one(
        self,
        requirement_set,  # type: RequirementSet
        req_to_install  # type: InstallRequirement
    ):
        # type: (...) -> List[InstallRequirement]
        """Prepare a single requirements file.

        :return: A list of additional InstallRequirements to also install.
        """
        # Tell user what we are doing for this requirement:
        # obtain (editable), skipping, processing (local url), collecting
        # (remote url or package name)
        if req_to_install.constraint or req_to_install.prepared:
            return []

        req_to_install.prepared = True

        # register tmp src for cleanup in case something goes wrong
        requirement_set.reqs_to_cleanup.append(req_to_install)

        abstract_dist = self._get_abstract_dist_for(req_to_install)

        # Parse and return dependencies
        dist = abstract_dist.get_pkg_resources_distribution()
        # This will raise UnsupportedPythonVersion if the given Python
        # version isn't compatible with the distribution's Requires-Python.
        _check_dist_requires_python(
            dist, version_info=self._py_version_info,
            ignore_requires_python=self.ignore_requires_python,
        )

        more_reqs = []  # type: List[InstallRequirement]

        def add_req(subreq, extras_requested):
            sub_install_req = install_req_from_req_string(
                str(subreq),
                req_to_install,
                isolated=self.isolated,
                wheel_cache=self.wheel_cache,
                use_pep517=self.use_pep517
            )
            parent_req_name = req_to_install.name
            to_scan_again, add_to_parent = requirement_set.add_requirement(
                sub_install_req,
                parent_req_name=parent_req_name,
                extras_requested=extras_requested,
            )
            if parent_req_name and add_to_parent:
                self._discovered_dependencies[parent_req_name].append(
                    add_to_parent
                )
            more_reqs.extend(to_scan_again)

        with indent_log():
            # We add req_to_install before its dependencies, so that we
            # can refer to it when adding dependencies.
            if not requirement_set.has_requirement(req_to_install.name):
                # 'unnamed' requirements will get added here
                req_to_install.is_direct = True
                requirement_set.add_requirement(
                    req_to_install, parent_req_name=None,
                )

            if not self.ignore_dependencies:
                if req_to_install.extras:
                    logger.debug(
                        "Installing extra requirements: %r",
                        ','.join(req_to_install.extras),
                    )
                missing_requested = sorted(
                    set(req_to_install.extras) - set(dist.extras)
                )
                for missing in missing_requested:
                    logger.warning(
                        '%s does not provide the extra \'%s\'',
                        dist, missing
                    )

                available_requested = sorted(
                    set(dist.extras) & set(req_to_install.extras)
                )
                for subreq in dist.requires(available_requested):
                    add_req(subreq, extras_requested=available_requested)

            if not req_to_install.editable and not req_to_install.satisfied_by:
                # XXX: --no-install leads this to report 'Successfully
                # downloaded' for only non-editable reqs, even though we took
                # action on them.
                requirement_set.successfully_downloaded.append(req_to_install)

        return more_reqs
def _resolve_one ( self , requirement_set , # type: RequirementSet req_to_install # type: InstallRequirement ) : # type: (...) -> List[InstallRequirement] # Tell user what we are doing for this requirement: # obtain (editable), skipping, processing (local url), collecting # (remote url or package name) if req_to_install . constraint or req_to_install . prepared : return [ ] req_to_install . prepared = True # register tmp src for cleanup in case something goes wrong requirement_set . reqs_to_cleanup . append ( req_to_install ) abstract_dist = self . _get_abstract_dist_for ( req_to_install ) # Parse and return dependencies dist = abstract_dist . get_pkg_resources_distribution ( ) # This will raise UnsupportedPythonVersion if the given Python # version isn't compatible with the distribution's Requires-Python. _check_dist_requires_python ( dist , version_info = self . _py_version_info , ignore_requires_python = self . ignore_requires_python , ) more_reqs = [ ] # type: List[InstallRequirement] def add_req ( subreq , extras_requested ) : sub_install_req = install_req_from_req_string ( str ( subreq ) , req_to_install , isolated = self . isolated , wheel_cache = self . wheel_cache , use_pep517 = self . use_pep517 ) parent_req_name = req_to_install . name to_scan_again , add_to_parent = requirement_set . add_requirement ( sub_install_req , parent_req_name = parent_req_name , extras_requested = extras_requested , ) if parent_req_name and add_to_parent : self . _discovered_dependencies [ parent_req_name ] . append ( add_to_parent ) more_reqs . extend ( to_scan_again ) with indent_log ( ) : # We add req_to_install before its dependencies, so that we # can refer to it when adding dependencies. if not requirement_set . has_requirement ( req_to_install . name ) : # 'unnamed' requirements will get added here req_to_install . is_direct = True requirement_set . add_requirement ( req_to_install , parent_req_name = None , ) if not self . ignore_dependencies : if req_to_install . extras : logger . debug ( "Installing extra requirements: %r" , ',' . join ( req_to_install . extras ) , ) missing_requested = sorted ( set ( req_to_install . extras ) - set ( dist . extras ) ) for missing in missing_requested : logger . warning ( '%s does not provide the extra \'%s\'' , dist , missing ) available_requested = sorted ( set ( dist . extras ) & set ( req_to_install . extras ) ) for subreq in dist . requires ( available_requested ) : add_req ( subreq , extras_requested = available_requested ) if not req_to_install . editable and not req_to_install . satisfied_by : # XXX: --no-install leads this to report 'Successfully # downloaded' for only non-editable reqs, even though we took # action on them. requirement_set . successfully_downloaded . append ( req_to_install ) return more_reqs