mirror of https://github.com/astral-sh/uv
Rename `--platform` to `--python-platform` (#3146)
## Summary `--platform` is a flag that exists in `pip` and it has a different meaning. (Not breaking as this hasn't been released yet anyway.)
This commit is contained in:
parent
4046b2bcfa
commit
5e4e2fa0bf
|
|
@ -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.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -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()),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,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
|
||||
|
|
|
|||
Loading…
Reference in New Issue