diff --git a/pipenv/patched/pip/index.py b/pipenv/patched/pip/index.py index f653f6e6a6..369679cb20 100644 --- a/pipenv/patched/pip/index.py +++ b/pipenv/patched/pip/index.py @@ -168,6 +168,9 @@ def __init__(self, find_links, index_urls, allow_all_prereleases=False, # The Session we'll use to make requests self.session = session + # Kenneth's Hack. + self.extra = None + # The valid tags to check potential found wheel candidates against self.valid_tags = get_supported( versions=versions, @@ -202,6 +205,30 @@ def add_dependency_links(self, links): ) self.dependency_links.extend(links) + def get_extras_links(self, links): + requires = [] + extras = {} + + current_section = None + + for link in links: + if not link: + current_section = None + + if not current_section: + if not (link.startswith('[')): + requires.append(link) + else: + current_section = link[1:-1] + extras[current_section] = [] + else: + extras[current_section].append(link) + + return extras + + + + @staticmethod def _sort_locations(locations, expand_dir=False): """ diff --git a/pipenv/patched/pip/req/req_set.py b/pipenv/patched/pip/req/req_set.py index ac04b9b1c9..79753861ba 100644 --- a/pipenv/patched/pip/req/req_set.py +++ b/pipenv/patched/pip/req/req_set.py @@ -123,6 +123,11 @@ def dist(self, finder): finder.add_dependency_links( dist.get_metadata_lines('dependency_links.txt') ) + if dist.has_metadata('requires.txt'): + dist.extra = finder.get_extras_links( + dist.get_metadata_lines('requires.txt') + ) + return dist def prep_for_dist(self): @@ -679,6 +684,7 @@ def add_req(subreq, extras_requested): isolated=self.isolated, wheel_cache=self._wheel_cache, ) + more_reqs.extend(self.add_requirement( sub_install_req, req_to_install.name, extras_requested=extras_requested)) @@ -686,9 +692,13 @@ def add_req(subreq, extras_requested): # We add req_to_install before its dependencies, so that we # can refer to it when adding dependencies. if not self.has_requirement(req_to_install.name): + available_requested = sorted( + set(dist.extras) & set(req_to_install.extras) + ) # 'unnamed' requirements will get added here - self.add_requirement(req_to_install, None) + self.add_requirement(req_to_install, None, extras_requested=available_requested) + # self.add_requirement(req_to_install) if not ignore_dependencies: if (req_to_install.extras): logger.debug( @@ -707,9 +717,23 @@ def add_req(subreq, extras_requested): 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) + # Hack for deep-resolving extras. + for available in available_requested: + if hasattr(dist, '_DistInfoDistribution__dep_map'): + for req in dist._DistInfoDistribution__dep_map[available]: + req = InstallRequirement( + str(req), + req_to_install, + isolated=self.isolated, + wheel_cache=self._wheel_cache, + ) + + more_reqs.append(req) + # cleanup tmp src self.reqs_to_cleanup.append(req_to_install) @@ -719,7 +743,13 @@ def add_req(subreq, extras_requested): # action on them. self.successfully_downloaded.append(req_to_install) - return more_reqs + # print(self.requirements) + # print() + # print(more_reqs) + # print('\n') + # print('\n') + + return self.requirements.values() + more_reqs def cleanup_files(self): """Clean up files, remove builds.""" diff --git a/pipenv/patched/piptools/repositories/pypi.py b/pipenv/patched/piptools/repositories/pypi.py index f6b58cc89d..ee804b1afe 100755 --- a/pipenv/patched/piptools/repositories/pypi.py +++ b/pipenv/patched/piptools/repositories/pypi.py @@ -166,8 +166,10 @@ def get_dependencies(self, ireq): self.source_dir, download_dir=download_dir, wheel_download_dir=self._wheel_download_dir, - session=self.session) - self._dependencies_cache[ireq] = reqset._prepare_file(self.finder, ireq) + session=self.session, + ignore_installed=True) + result = reqset._prepare_file(self.finder, ireq) + self._dependencies_cache[ireq] = result return set(self._dependencies_cache[ireq]) def get_hashes(self, ireq): diff --git a/pipenv/patched/piptools/resolver.py b/pipenv/patched/piptools/resolver.py index 67cd11abed..e57fc52b7b 100755 --- a/pipenv/patched/piptools/resolver.py +++ b/pipenv/patched/piptools/resolver.py @@ -277,6 +277,9 @@ def _iter_dependencies(self, ireq): elif ireq.markers: for dependency in self.repository.get_dependencies(ireq): yield dependency + elif ireq.extras: + for dependency in self.repository.get_dependencies(ireq): + yield dependency return elif not is_pinned_requirement(ireq): raise TypeError('Expected pinned or editable requirement, got {}'.format(ireq))