Skip to content

Commit

Permalink
DRAFT - pip install --dry-run
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Apr 30, 2022
1 parent 97b8b1a commit 7d69557
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,18 @@ def add_options(self) -> None:
),
)

self.cmd_opts.add_option(
"--dry-run",
action="store_true",
dest="dry_run",
default=False,
help=(
"Don't actually install anything, just print what would be. "
"Can be used in combination with --report and --ignore-installed "
"to 'resolve' the requirements."
),
)

self.cmd_opts.add_option(cmdoptions.no_binary())
self.cmd_opts.add_option(cmdoptions.only_binary())
self.cmd_opts.add_option(cmdoptions.prefer_binary())
Expand Down Expand Up @@ -361,6 +373,10 @@ def run(self, options: Values, args: List[str]) -> int:
with open(options.json_report_file, "w") as f:
json.dump(report.to_json(), f)

if options.dry_run:
# TODO print something useful here
return SUCCESS

try:
pip_req = requirement_set.get_requirement("pip")
except KeyError:
Expand Down

0 comments on commit 7d69557

Please sign in to comment.