mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Remove uv 0.7.13 (62ed17b23
2025-06-12) fallback
This commit is contained in:
parent
e9d5780369
commit
95eafe68f9
3 changed files with 17 additions and 54 deletions
|
@ -19,7 +19,6 @@ use uv_pep440::Version;
|
||||||
use uv_pep508::PackageName;
|
use uv_pep508::PackageName;
|
||||||
use uv_python::{PythonDownloads, PythonPreference, PythonRequest};
|
use uv_python::{PythonDownloads, PythonPreference, PythonRequest};
|
||||||
use uv_settings::PythonInstallMirrors;
|
use uv_settings::PythonInstallMirrors;
|
||||||
use uv_warnings::warn_user;
|
|
||||||
use uv_workspace::pyproject_mut::Error;
|
use uv_workspace::pyproject_mut::Error;
|
||||||
use uv_workspace::{
|
use uv_workspace::{
|
||||||
DiscoveryOptions, WorkspaceCache,
|
DiscoveryOptions, WorkspaceCache,
|
||||||
|
@ -58,7 +57,6 @@ pub(crate) async fn project_version(
|
||||||
bump: Option<VersionBump>,
|
bump: Option<VersionBump>,
|
||||||
short: bool,
|
short: bool,
|
||||||
output_format: VersionFormat,
|
output_format: VersionFormat,
|
||||||
strict: bool,
|
|
||||||
project_dir: &Path,
|
project_dir: &Path,
|
||||||
package: Option<PackageName>,
|
package: Option<PackageName>,
|
||||||
dry_run: bool,
|
dry_run: bool,
|
||||||
|
@ -80,21 +78,7 @@ pub(crate) async fn project_version(
|
||||||
preview: PreviewMode,
|
preview: PreviewMode,
|
||||||
) -> Result<ExitStatus> {
|
) -> Result<ExitStatus> {
|
||||||
// Read the metadata
|
// Read the metadata
|
||||||
let project = match find_target(project_dir, package.as_ref()).await {
|
let project = find_target(project_dir, package.as_ref()).await?;
|
||||||
Ok(target) => target,
|
|
||||||
Err(err) => {
|
|
||||||
// If strict, hard bail on failing to find the pyproject.toml
|
|
||||||
if strict {
|
|
||||||
return Err(err)?;
|
|
||||||
}
|
|
||||||
// Otherwise, warn and provide fallback to the old `uv version` from before 0.7.0
|
|
||||||
warn_user!(
|
|
||||||
"Failed to read project metadata ({err}). Running `{}` for compatibility. This fallback will be removed in the future; pass `--preview` to force an error.",
|
|
||||||
"uv self version".green()
|
|
||||||
);
|
|
||||||
return self_version(short, output_format, printer);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let pyproject_path = project.root().join("pyproject.toml");
|
let pyproject_path = project.root().join("pyproject.toml");
|
||||||
let Some(name) = project.project_name().cloned() else {
|
let Some(name) = project.project_name().cloned() else {
|
||||||
|
|
|
@ -1056,7 +1056,6 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
|
||||||
}
|
}
|
||||||
Commands::Project(project) => {
|
Commands::Project(project) => {
|
||||||
Box::pin(run_project(
|
Box::pin(run_project(
|
||||||
cli.top_level.global_args.project.is_some(),
|
|
||||||
project,
|
project,
|
||||||
&project_dir,
|
&project_dir,
|
||||||
run_command,
|
run_command,
|
||||||
|
@ -1647,7 +1646,6 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
|
||||||
|
|
||||||
/// Run a [`ProjectCommand`].
|
/// Run a [`ProjectCommand`].
|
||||||
async fn run_project(
|
async fn run_project(
|
||||||
project_was_explicit: bool,
|
|
||||||
project_command: Box<ProjectCommand>,
|
project_command: Box<ProjectCommand>,
|
||||||
project_dir: &Path,
|
project_dir: &Path,
|
||||||
command: Option<RunCommand>,
|
command: Option<RunCommand>,
|
||||||
|
@ -2036,19 +2034,11 @@ async fn run_project(
|
||||||
.combine(Refresh::from(args.settings.resolver.upgrade.clone())),
|
.combine(Refresh::from(args.settings.resolver.upgrade.clone())),
|
||||||
);
|
);
|
||||||
|
|
||||||
// If they specified any of these flags, they probably don't mean `uv self version`
|
|
||||||
let strict = project_was_explicit
|
|
||||||
|| globals.preview.is_enabled()
|
|
||||||
|| args.dry_run
|
|
||||||
|| args.bump.is_some()
|
|
||||||
|| args.value.is_some()
|
|
||||||
|| args.package.is_some();
|
|
||||||
Box::pin(commands::project_version(
|
Box::pin(commands::project_version(
|
||||||
args.value,
|
args.value,
|
||||||
args.bump,
|
args.bump,
|
||||||
args.short,
|
args.short,
|
||||||
args.output_format,
|
args.output_format,
|
||||||
strict,
|
|
||||||
project_dir,
|
project_dir,
|
||||||
args.package,
|
args.package,
|
||||||
args.dry_run,
|
args.dry_run,
|
||||||
|
|
|
@ -841,8 +841,10 @@ fn version_set_dynamic() -> Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should fallback to `uv --version` if this pyproject.toml isn't usable for whatever reason
|
// Previously would fallback to `uv --version` if this pyproject.toml isn't usable for whatever reason
|
||||||
// (In this case, because tool.uv.managed = false)
|
// (In this case, because tool.uv.managed = false)
|
||||||
|
//
|
||||||
|
// This fallback path is now deprecated and we just get an error.
|
||||||
#[test]
|
#[test]
|
||||||
fn version_get_fallback_unmanaged() -> Result<()> {
|
fn version_get_fallback_unmanaged() -> Result<()> {
|
||||||
let context = TestContext::new("3.12");
|
let context = TestContext::new("3.12");
|
||||||
|
@ -860,13 +862,12 @@ fn version_get_fallback_unmanaged() -> Result<()> {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
uv_snapshot!(context.filters(), context.version(), @r"
|
uv_snapshot!(context.filters(), context.version(), @r"
|
||||||
success: true
|
success: false
|
||||||
exit_code: 0
|
exit_code: 2
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
uv [VERSION] ([COMMIT] DATE)
|
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
warning: Failed to read project metadata (The project is marked as unmanaged: `[TEMP_DIR]/`). Running `uv self version` for compatibility. This fallback will be removed in the future; pass `--preview` to force an error.
|
error: The project is marked as unmanaged: `[TEMP_DIR]/`
|
||||||
");
|
");
|
||||||
|
|
||||||
let pyproject = fs_err::read_to_string(&pyproject_toml)?;
|
let pyproject = fs_err::read_to_string(&pyproject_toml)?;
|
||||||
|
@ -911,13 +912,12 @@ fn version_get_fallback_unmanaged_short() -> Result<()> {
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
uv_snapshot!(filters, context.version()
|
uv_snapshot!(filters, context.version()
|
||||||
.arg("--short"), @r"
|
.arg("--short"), @r"
|
||||||
success: true
|
success: false
|
||||||
exit_code: 0
|
exit_code: 2
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
[VERSION] ([COMMIT] DATE)
|
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
warning: Failed to read project metadata (The project is marked as unmanaged: `[TEMP_DIR]/`). Running `uv self version` for compatibility. This fallback will be removed in the future; pass `--preview` to force an error.
|
error: The project is marked as unmanaged: `[TEMP_DIR]/`
|
||||||
");
|
");
|
||||||
|
|
||||||
let pyproject = fs_err::read_to_string(&pyproject_toml)?;
|
let pyproject = fs_err::read_to_string(&pyproject_toml)?;
|
||||||
|
@ -988,25 +988,14 @@ fn version_get_fallback_unmanaged_json() -> Result<()> {
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
if git_version_info_expected() {
|
if git_version_info_expected() {
|
||||||
uv_snapshot!(filters, context.version()
|
uv_snapshot!(filters, context.version()
|
||||||
.arg("--output-format").arg("json"), @r#"
|
.arg("--output-format").arg("json"), @r"
|
||||||
success: true
|
success: false
|
||||||
exit_code: 0
|
exit_code: 2
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
{
|
|
||||||
"package_name": "uv",
|
|
||||||
"version": "[VERSION]",
|
|
||||||
"commit_info": {
|
|
||||||
"short_commit_hash": "[LONGHASH]",
|
|
||||||
"commit_hash": "[LONGHASH]",
|
|
||||||
"commit_date": "[DATE]",
|
|
||||||
"last_tag": "[TAG]",
|
|
||||||
"commits_since_last_tag": [COUNT]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
warning: Failed to read project metadata (The project is marked as unmanaged: `[TEMP_DIR]/`). Running `uv self version` for compatibility. This fallback will be removed in the future; pass `--preview` to force an error.
|
error: The project is marked as unmanaged: `[TEMP_DIR]/`
|
||||||
"#);
|
");
|
||||||
} else {
|
} else {
|
||||||
uv_snapshot!(filters, context.version()
|
uv_snapshot!(filters, context.version()
|
||||||
.arg("--output-format").arg("json"), @r#"
|
.arg("--output-format").arg("json"), @r#"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue