From 29af360d34a9e89dec59a8fa93b45eb33ef8e4ca Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Thu, 18 Nov 2021 14:32:57 +0800 Subject: [PATCH] Support index name in --index --- pipenv/project.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pipenv/project.py b/pipenv/project.py index 289d0e84..386b784d 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -1005,12 +1005,17 @@ class Project: """Adds a given index to the Pipfile.""" # Read and append Pipfile. p = self.parsed_pipfile + source = None try: source = self.get_source(url=index) except SourceNotFound: - source = {"url": index, "verify_ssl": verify_ssl} - else: + try: + source = self.get_source(name=index) + except SourceNotFound: + pass + if source is not None: return source["name"] + source = {"url": index, "verify_ssl": verify_ssl} source["name"] = self.src_name_from_url(index) # Add the package to the group. if "source" not in p: