Retrieves dependencies for the given install requirement from the pip resolver.

    :param dep: A single InstallRequirement
    :type dep: :class:`~pip._internal.req.req_install.InstallRequirement`
    :param sources: Pipfile-formatted sources, defaults to None
    :type sources: list[dict], optional
    :return: A set of dependency lines for generating new InstallRequirements.
    :rtype: set(str) or None

def get_dependencies_from_index(dep, sources=None, pip_options=None, wheel_cache=None):
    """Retrieves dependencies for the given install requirement from the pip resolver.

    :param dep: A single InstallRequirement
    :type dep: :class:`~pip._internal.req.req_install.InstallRequirement`
    :param sources: Pipfile-formatted sources, defaults to None
    :type sources: list[dict], optional
    :return: A set of dependency lines for generating new InstallRequirements.
    :rtype: set(str) or None
    """

    finder = get_finder(sources=sources, pip_options=pip_options)
    if not wheel_cache:
        wheel_cache = WHEEL_CACHE
    dep.is_direct = True
    reqset = pip_shims.shims.RequirementSet()
    reqset.add_requirement(dep)
    requirements = None
    setup_requires = {}
    with temp_environ(), start_resolver(finder=finder, wheel_cache=wheel_cache) as resolver:
        os.environ['PIP_EXISTS_ACTION'] = 'i'
        dist = None
        if dep.editable and not dep.prepared and not dep.req:
            with cd(dep.setup_py_dir):
                from setuptools.dist import distutils
                try:
                    dist = distutils.core.run_setup(dep.setup_py)
                except (ImportError, TypeError, AttributeError):
                    dist = None
                else:
                    setup_requires[dist.get_name()] = dist.setup_requires
                if not dist:
                    try:
                        dist = dep.get_dist()
                    except (TypeError, ValueError, AttributeError):
                        pass
                    else:
                        setup_requires[dist.get_name()] = dist.setup_requires
        resolver.require_hashes = False
        try:
            results = resolver._resolve_one(reqset, dep)
        except Exception:
            # FIXME: Needs to bubble the exception somehow to the user.
            results = []
        finally:
            try:
                wheel_cache.cleanup()
            except AttributeError:
                pass
        resolver_requires_python = getattr(resolver, "requires_python", None)
        requires_python = getattr(reqset, "requires_python", resolver_requires_python)
        if requires_python:
            add_marker = fix_requires_python_marker(requires_python)
            reqset.remove(dep)
            if dep.req.marker:
                dep.req.marker._markers.extend(['and',].extend(add_marker._markers))
            else:
                dep.req.marker = add_marker
            reqset.add(dep)
        requirements = set()
        for r in results:
            if requires_python:
                if r.req.marker:
                    r.req.marker._markers.extend(['and',].extend(add_marker._markers))
                else:
                    r.req.marker = add_marker
            requirements.add(format_requirement(r))
        for section in setup_requires:
            python_version = section
            not_python = not is_python(section)

            # This is for cleaning up :extras: formatted markers
            # by adding them to the results of the resolver
            # since any such extra would have been returned as a result anyway
            for value in setup_requires[section]:

                # This is a marker.
                if is_python(section):
                    python_version = value[1:-1]
                else:
                    not_python = True

                if ':' not in value and not_python:
                    try:
                        requirement_str = "{0}{1}".format(value, python_version).replace(":", ";")
                        requirements.add(format_requirement(make_install_requirement(requirement_str).ireq))
                    # Anything could go wrong here -- can't be too careful.
                    except Exception:
                        pass

    if not dep.editable and is_pinned_requirement(dep) and requirements is not None:
        DEPENDENCY_CACHE[dep] = list(requirements)
    return requirements