Skip to content

Commit

Permalink
Rename --platform to --python-platform
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Apr 19, 2024
1 parent 4046b2b commit 434b89a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion crates/uv/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TargetTriple>,
pub(crate) python_platform: Option<TargetTriple>,

/// Limit candidate packages to those that were uploaded prior to the given date.
///
Expand Down
20 changes: 10 additions & 10 deletions crates/uv/src/commands/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub(crate) async fn pip_compile(
no_build_isolation: bool,
no_build: NoBuild,
python_version: Option<PythonVersion>,
target: Option<TargetTriple>,
python_platform: Option<TargetTriple>,
exclude_newer: Option<ExcludeNewer>,
annotation_style: AnnotationStyle,
link_mode: LinkMode,
Expand Down Expand Up @@ -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(),
Expand All @@ -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()),
};
Expand Down
2 changes: 1 addition & 1 deletion crates/uv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ async fn run() -> Result<ExitStatus> {
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,
Expand Down
6 changes: 3 additions & 3 deletions crates/uv/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub(crate) struct PipCompileSettings {
pub(crate) src_file: Vec<PathBuf>,
pub(crate) constraint: Vec<PathBuf>,
pub(crate) r#override: Vec<PathBuf>,
pub(crate) platform: Option<TargetTriple>,
pub(crate) python_platform: Option<TargetTriple>,
pub(crate) refresh: bool,
pub(crate) refresh_package: Vec<PackageName>,
pub(crate) upgrade: bool,
Expand Down Expand Up @@ -136,7 +136,7 @@ impl PipCompileSettings {
only_binary,
config_setting,
python_version,
platform,
python_platform,
exclude_newer,
no_emit_package,
emit_index_url,
Expand All @@ -155,7 +155,7 @@ impl PipCompileSettings {
src_file,
constraint,
r#override,
platform,
python_platform,
refresh,
refresh_package: refresh_package.unwrap_or_default(),
upgrade,
Expand Down
10 changes: 5 additions & 5 deletions crates/uv/tests/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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
Expand All @@ -7930,13 +7930,13 @@ 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
----- 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 x86_64-pc-windows-msvc
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z requirements.in --python-platform x86_64-pc-windows-msvc
black==24.3.0
click==8.1.7
# via black
Expand Down

0 comments on commit 434b89a

Please sign in to comment.