Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow the pip.conf to override the default index source. #5297

Merged
merged 7 commits into from
Feb 18, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion pipenv/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from pipenv.environment import Environment
from pipenv.environments import Setting, is_in_virtualenv, normalize_pipfile_path
from pipenv.patched.pip._internal.commands.install import InstallCommand
from pipenv.patched.pip._internal.configuration import Configuration
from pipenv.patched.pip._internal.exceptions import ConfigurationError
from pipenv.patched.pip._vendor import pkg_resources
from pipenv.utils.constants import is_type_checking
from pipenv.utils.dependencies import (
Expand Down Expand Up @@ -131,7 +133,20 @@ def __init__(self, python_version=None, chdir=True):
self._build_system = {"requires": ["setuptools", "wheel"]}
self.python_version = python_version
self.s = Setting()
if self.s.PIPENV_TEST_INDEX:
# Load Pip configuration
self.configuration = Configuration(isolated=False, load_only=None)
self.configuration.load()
try:
pip_configured_index = self.configuration.get_value("global.index-url")
except ConfigurationError:
pip_configured_index = None
if pip_configured_index:
self.default_source = {
"url": pip_configured_index,
"verify_ssl": True,
"name": "pip_conf_index",
}
elif self.s.PIPENV_TEST_INDEX:
self.default_source = {
"url": self.s.PIPENV_TEST_INDEX,
"verify_ssl": True,
Expand Down