Skip to content

Commit

Permalink
Merge pull request #777 from firebirdberlin/trusted-host
Browse files Browse the repository at this point in the history
Support the flag --trusted-host in pip-sync.
  • Loading branch information
atugushev authored Apr 3, 2019
2 parents 2b732ff + ac677f7 commit 749174d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions piptools/scripts/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
help="Add additional index URL to search",
envvar="PIP_EXTRA_INDEX_URL",
) # noqa
@click.option(
"--trusted-host",
multiple=True,
help="Mark this host as trusted, even though it does not have valid or any HTTPS.",
)
@click.option(
"--no-index",
is_flag=True,
Expand All @@ -57,6 +62,7 @@ def cli(
find_links,
index_url,
extra_index_url,
trusted_host,
no_index,
quiet,
user_only,
Expand Down Expand Up @@ -106,6 +112,9 @@ def cli(
if extra_index_url:
for extra_index in extra_index_url:
install_flags.extend(["--extra-index-url", extra_index])
if trusted_host:
for host in trusted_host:
install_flags.extend(["--trusted-host", host])
if user_only:
install_flags.append("--user")

Expand Down
8 changes: 8 additions & 0 deletions tests/test_cli_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ def test_merge_error(runner):
["--extra-index-url", "https://foo", "--extra-index-url", "https://bar"],
["--extra-index-url", "https://foo", "--extra-index-url", "https://bar"],
),
(
["--trusted-host", "https://foo", "--trusted-host", "https://bar"],
["--trusted-host", "https://foo", "--trusted-host", "https://bar"],
),
(
["--extra-index-url", "https://foo", "--trusted-host", "https://bar"],
["--extra-index-url", "https://foo", "--trusted-host", "https://bar"],
),
(["--user"], ["--user"]),
],
)
Expand Down

0 comments on commit 749174d

Please sign in to comment.