Skip to content

Commit

Permalink
Merge pull request #798 from atugushev/pip-sync-cert-option
Browse files Browse the repository at this point in the history
Add options --cert and --client-cert to pip-sync
  • Loading branch information
atugushev authored Apr 28, 2019
2 parents 5da4a25 + 26493ed commit a3ac5ca
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
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

0 comments on commit a3ac5ca

Please sign in to comment.