Skip to content

Commit

Permalink
pip installer: fix typing issues for http repos
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Apr 29, 2022
1 parent b6d4b0a commit 9ed3ee5
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions src/poetry/installation/pip_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from poetry.core.pyproject.toml import PyProjectTOML

from poetry.installation.base_installer import BaseInstaller
from poetry.repositories.http import HTTPRepository
from poetry.utils._compat import encode
from poetry.utils.helpers import safe_rmtree
from poetry.utils.pip import pip_install
Expand Down Expand Up @@ -57,23 +58,28 @@ def install(self, package: Package, update: bool = False) -> None:
)
args += ["--trusted-host", parsed.hostname]

if repository.cert:
args += ["--cert", str(repository.cert)]
if isinstance(repository, HTTPRepository):
if repository.cert:
args += ["--cert", str(repository.cert)]

if repository.client_cert:
args += ["--client-cert", str(repository.client_cert)]
if repository.client_cert:
args += ["--client-cert", str(repository.client_cert)]

index_url = repository.authenticated_url
index_url = repository.authenticated_url

args += ["--index-url", index_url]

args += ["--index-url", index_url]
if (
self._pool.has_default()
and repository.name != self._pool.repositories[0].name
):
args += [
"--extra-index-url",
self._pool.repositories[0].authenticated_url,
]
first_repository = self._pool.repositories[0]

if isinstance(first_repository, HTTPRepository):
args += [
"--extra-index-url",
first_repository.authenticated_url,
]

if update:
args.append("-U")
Expand Down

0 comments on commit 9ed3ee5

Please sign in to comment.