From ce18a87cebd2bc0ed518daae5132be854a3a307a Mon Sep 17 00:00:00 2001 From: skshetry <18718008+skshetry@users.noreply.github.com> Date: Sat, 13 Jul 2024 09:27:22 +0545 Subject: [PATCH] pip compile: exclude --upgrade-package from the header --- crates/uv/src/commands/pip/compile.rs | 6 ++++++ crates/uv/tests/pip_compile.rs | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/crates/uv/src/commands/pip/compile.rs b/crates/uv/src/commands/pip/compile.rs index f65d71173072..2a1255b05857 100644 --- a/crates/uv/src/commands/pip/compile.rs +++ b/crates/uv/src/commands/pip/compile.rs @@ -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; diff --git a/crates/uv/tests/pip_compile.rs b/crates/uv/tests/pip_compile.rs index 693d27fa4c0b..51f7f9a9d618 100644 --- a/crates/uv/tests/pip_compile.rs +++ b/crates/uv/tests/pip_compile.rs @@ -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