diff --git a/crates/uv/src/cli.rs b/crates/uv/src/cli.rs index 393a6f4a68af7..59a0d8f2fb171 100644 --- a/crates/uv/src/cli.rs +++ b/crates/uv/src/cli.rs @@ -529,7 +529,7 @@ pub(crate) struct PipCompileArgs { /// its CPU, vendor, and operating system name, like `x86_64-unknown-linux-gnu` or /// `aaarch64-apple-darwin`. #[arg(long)] - pub(crate) platform: Option, + pub(crate) python_platform: Option, /// Limit candidate packages to those that were uploaded prior to the given date. /// diff --git a/crates/uv/src/commands/pip_compile.rs b/crates/uv/src/commands/pip_compile.rs index d497c0f43a718..2a704666ed45b 100644 --- a/crates/uv/src/commands/pip_compile.rs +++ b/crates/uv/src/commands/pip_compile.rs @@ -79,7 +79,7 @@ pub(crate) async fn pip_compile( no_build_isolation: bool, no_build: NoBuild, python_version: Option, - target: Option, + python_platform: Option, exclude_newer: Option, annotation_style: AnnotationStyle, link_mode: LinkMode, @@ -195,16 +195,16 @@ pub(crate) async fn pip_compile( }; // Determine the tags, markers, and interpreter to use for resolution. - let tags = match (target, python_version.as_ref()) { - (Some(target), Some(python_version)) => Cow::Owned(Tags::from_env( - &target.platform(), + let tags = match (python_platform, python_version.as_ref()) { + (Some(python_platform), Some(python_version)) => Cow::Owned(Tags::from_env( + &python_platform.platform(), (python_version.major(), python_version.minor()), interpreter.implementation_name(), interpreter.implementation_tuple(), interpreter.gil_disabled(), )?), - (Some(target), None) => Cow::Owned(Tags::from_env( - &target.platform(), + (Some(python_platform), None) => Cow::Owned(Tags::from_env( + &python_platform.platform(), interpreter.python_tuple(), interpreter.implementation_name(), interpreter.implementation_tuple(), @@ -221,11 +221,11 @@ pub(crate) async fn pip_compile( }; // Apply the platform tags to the markers. - let markers = match (target, python_version) { - (Some(target), Some(python_version)) => { - Cow::Owned(python_version.markers(&target.markers(interpreter.markers()))) + let markers = match (python_platform, python_version) { + (Some(python_platform), Some(python_version)) => { + Cow::Owned(python_version.markers(&python_platform.markers(interpreter.markers()))) } - (Some(target), None) => Cow::Owned(target.markers(interpreter.markers())), + (Some(python_platform), None) => Cow::Owned(python_platform.markers(interpreter.markers())), (None, Some(python_version)) => Cow::Owned(python_version.markers(interpreter.markers())), (None, None) => Cow::Borrowed(interpreter.markers()), }; diff --git a/crates/uv/src/main.rs b/crates/uv/src/main.rs index a6920ac3bb486..4758301178540 100644 --- a/crates/uv/src/main.rs +++ b/crates/uv/src/main.rs @@ -255,7 +255,7 @@ async fn run() -> Result { args.shared.no_build_isolation, no_build, args.shared.python_version, - args.platform, + args.python_platform, args.shared.exclude_newer, args.shared.annotation_style, args.shared.link_mode, diff --git a/crates/uv/src/settings.rs b/crates/uv/src/settings.rs index 2944050ec96db..198ac0816c713 100644 --- a/crates/uv/src/settings.rs +++ b/crates/uv/src/settings.rs @@ -75,7 +75,7 @@ pub(crate) struct PipCompileSettings { pub(crate) src_file: Vec, pub(crate) constraint: Vec, pub(crate) r#override: Vec, - pub(crate) platform: Option, + pub(crate) python_platform: Option, pub(crate) refresh: bool, pub(crate) refresh_package: Vec, pub(crate) upgrade: bool, @@ -136,7 +136,7 @@ impl PipCompileSettings { only_binary, config_setting, python_version, - platform, + python_platform, exclude_newer, no_emit_package, emit_index_url, @@ -155,7 +155,7 @@ impl PipCompileSettings { src_file, constraint, r#override, - platform, + python_platform, refresh, refresh_package: refresh_package.unwrap_or_default(), upgrade, diff --git a/crates/uv/tests/pip_compile.rs b/crates/uv/tests/pip_compile.rs index 5605649d06774..8055e1d484c2d 100644 --- a/crates/uv/tests/pip_compile.rs +++ b/crates/uv/tests/pip_compile.rs @@ -7892,7 +7892,7 @@ fn no_version_for_direct_dependency() -> Result<()> { /// Compile against a dedicated platform, which may differ from the current platform. #[test] -fn platform() -> Result<()> { +fn python_platform() -> Result<()> { let context = TestContext::new("3.12"); let requirements_in = context.temp_dir.child("requirements.in"); @@ -7902,13 +7902,13 @@ fn platform() -> Result<()> { windows_filters=false, context.compile() .arg("requirements.in") - .arg("--platform") + .arg("--python-platform") .arg("aarch64-unknown-linux-gnu"), @r###" success: true exit_code: 0 ----- stdout ----- # This file was autogenerated by uv via the following command: - # uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z requirements.in --platform aarch64-unknown-linux-gnu + # uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z requirements.in --python-platform aarch64-unknown-linux-gnu black==24.3.0 click==8.1.7 # via black @@ -7930,7 +7930,7 @@ fn platform() -> Result<()> { windows_filters=false, context.compile() .arg("requirements.in") - .arg("--platform") + .arg("--python-platform") .arg("x86_64-pc-windows-msvc"), @r###" success: true exit_code: 0