pip compile: exclude --upgrade-package from the header (#5032)

## Summary

Fixes #5031.

## Test Plan

Existing snapshot tests should cover it.
This commit is contained in:
skshetry 2024-07-13 10:09:35 +05:45 committed by GitHub
parent 4eb19c76bd
commit f770b25be2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -547,6 +547,12 @@ fn cmd(
return Some(None);
}
// Always skip the `--upgrade-package` flag, and mark the next item as skipped
if arg == "--upgrade-package" || arg == "-P" {
*skip_next = Some(true);
return Some(None);
}
// Always skip the `--quiet` flag.
if arg == "--quiet" || arg == "-q" {
*skip_next = None;

View file

@ -4748,7 +4748,7 @@ fn upgrade_package() -> Result<()> {
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] requirements.in --output-file requirements.txt --upgrade-package click
# uv pip compile --cache-dir [CACHE_DIR] requirements.in --output-file requirements.txt
black==23.10.1
# via -r requirements.in
click==8.1.7
@ -4794,7 +4794,7 @@ fn upgrade_constraint() -> Result<()> {
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] requirements.in --output-file requirements.txt --upgrade-package iniconfig<2
# uv pip compile --cache-dir [CACHE_DIR] requirements.in --output-file requirements.txt
iniconfig==1.1.1
# via -r requirements.in
@ -4813,7 +4813,7 @@ fn upgrade_constraint() -> Result<()> {
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] requirements.in --output-file requirements.txt --upgrade-package iniconfig
# uv pip compile --cache-dir [CACHE_DIR] requirements.in --output-file requirements.txt
iniconfig==2.0.0
# via -r requirements.in