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

Add options --cert and --client-cert to pip-sync #798

Merged
merged 1 commit into from
Apr 28, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
12 changes: 12 additions & 0 deletions piptools/scripts/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
@click.option(
"--user", "user_only", is_flag=True, help="Restrict attention to user directory"
)
@click.option("--cert", help="Path to alternate CA bundle.")
@click.option(
"--client-cert",
help="Path to SSL client certificate, a single file containing "
"the private key and the certificate in PEM format.",
)
@click.argument("src_files", required=False, type=click.Path(exists=True), nargs=-1)
def cli(
dry_run,
Expand All @@ -66,6 +72,8 @@ def cli(
no_index,
quiet,
user_only,
cert,
client_cert,
src_files,
):
"""Synchronize virtual environment with requirements.txt."""
Expand Down Expand Up @@ -117,6 +125,10 @@ def cli(
install_flags.extend(["--trusted-host", host])
if user_only:
install_flags.append("--user")
if cert:
install_flags.extend(["--cert", cert])
if client_cert:
install_flags.extend(["--client-cert", client_cert])

sys.exit(
sync.sync(
Expand Down
2 changes: 2 additions & 0 deletions tests/test_cli_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ def test_merge_error(runner):
["--extra-index-url", "https://foo", "--trusted-host", "https://bar"],
),
(["--user"], ["--user"]),
(["--cert", "foo.crt"], ["--cert", "foo.crt"]),
(["--client-cert", "foo.pem"], ["--client-cert", "foo.pem"]),
],
)
@mock.patch("piptools.sync.check_call")
Expand Down