mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
chore: unify all env vars used (#8151)
## Summary This PR declares and documents all environment variables that are used in one way or another in `uv`, either internally, or externally, or transitively under a common struct. I think over time as uv has grown there's been many environment variables introduced. Its harder to know which ones exists, which ones are missing, what they're used for, or where are they used across the code. The docs only documents a handful of them, for others you'd have to dive into the code and inspect across crates to know which crates they're used on or where they're relevant. This PR is a starting attempt to unify them, make it easier to discover which ones we have, and maybe unlock future posibilities in automating generating documentation for them. I think we can split out into multiple structs later to better organize, but given the high influx of PR's and possibly new environment variables introduced/re-used, it would be hard to try to organize them all now into their proper namespaced struct while this is all happening given merge conflicts and/or keeping up to date. I don't think this has any impact on performance as they all should still be inlined, although it may affect local build times on changes to the environment vars as more crates would likely need a rebuild. Lastly, some of them are declared but not used in the code, for example those in `build.rs`. I left them declared because I still think it's useful to at least have a reference. Did I miss any? Are their initial docs cohesive? Note, `uv-static` is a terrible name for a new crate, thoughts? Others considered `uv-vars`, `uv-consts`. ## Test Plan Existing tests
This commit is contained in:
parent
0a23be4a6a
commit
01c44af3c3
86 changed files with 1572 additions and 1104 deletions
20
Cargo.lock
generated
20
Cargo.lock
generated
|
@ -4172,6 +4172,7 @@ dependencies = [
|
|||
"uv-scripts",
|
||||
"uv-settings",
|
||||
"uv-shell",
|
||||
"uv-static",
|
||||
"uv-tool",
|
||||
"uv-types",
|
||||
"uv-virtualenv",
|
||||
|
@ -4289,6 +4290,7 @@ dependencies = [
|
|||
"uv-pep508",
|
||||
"uv-pypi-types",
|
||||
"uv-python",
|
||||
"uv-static",
|
||||
"uv-types",
|
||||
"uv-virtualenv",
|
||||
]
|
||||
|
@ -4314,6 +4316,7 @@ dependencies = [
|
|||
"uv-fs",
|
||||
"uv-normalize",
|
||||
"uv-pypi-types",
|
||||
"uv-static",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
|
@ -4361,6 +4364,7 @@ dependencies = [
|
|||
"uv-python",
|
||||
"uv-resolver",
|
||||
"uv-settings",
|
||||
"uv-static",
|
||||
"uv-version",
|
||||
"uv-warnings",
|
||||
]
|
||||
|
@ -4412,6 +4416,7 @@ dependencies = [
|
|||
"uv-pep508",
|
||||
"uv-platform-tags",
|
||||
"uv-pypi-types",
|
||||
"uv-static",
|
||||
"uv-version",
|
||||
"uv-warnings",
|
||||
]
|
||||
|
@ -4440,6 +4445,7 @@ dependencies = [
|
|||
"uv-pep508",
|
||||
"uv-platform-tags",
|
||||
"uv-pypi-types",
|
||||
"uv-static",
|
||||
"which",
|
||||
]
|
||||
|
||||
|
@ -4487,6 +4493,7 @@ dependencies = [
|
|||
"uv-pypi-types",
|
||||
"uv-python",
|
||||
"uv-settings",
|
||||
"uv-static",
|
||||
"uv-workspace",
|
||||
"walkdir",
|
||||
]
|
||||
|
@ -4669,6 +4676,7 @@ dependencies = [
|
|||
"uv-auth",
|
||||
"uv-cache-key",
|
||||
"uv-fs",
|
||||
"uv-static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -4739,6 +4747,7 @@ dependencies = [
|
|||
"uv-platform-tags",
|
||||
"uv-pypi-types",
|
||||
"uv-python",
|
||||
"uv-static",
|
||||
"uv-types",
|
||||
"uv-warnings",
|
||||
"walkdir",
|
||||
|
@ -4899,6 +4908,7 @@ dependencies = [
|
|||
"uv-fs",
|
||||
"uv-metadata",
|
||||
"uv-pypi-types",
|
||||
"uv-static",
|
||||
"uv-warnings",
|
||||
]
|
||||
|
||||
|
@ -4972,6 +4982,7 @@ dependencies = [
|
|||
"uv-platform-tags",
|
||||
"uv-pypi-types",
|
||||
"uv-state",
|
||||
"uv-static",
|
||||
"uv-warnings",
|
||||
"which",
|
||||
"windows-registry",
|
||||
|
@ -5090,6 +5101,7 @@ dependencies = [
|
|||
"uv-pypi-types",
|
||||
"uv-python",
|
||||
"uv-requirements-txt",
|
||||
"uv-static",
|
||||
"uv-types",
|
||||
"uv-warnings",
|
||||
"uv-workspace",
|
||||
|
@ -5138,6 +5150,7 @@ dependencies = [
|
|||
"uv-pypi-types",
|
||||
"uv-python",
|
||||
"uv-resolver",
|
||||
"uv-static",
|
||||
"uv-warnings",
|
||||
]
|
||||
|
||||
|
@ -5150,6 +5163,7 @@ dependencies = [
|
|||
"same-file",
|
||||
"tracing",
|
||||
"uv-fs",
|
||||
"uv-static",
|
||||
"winreg",
|
||||
]
|
||||
|
||||
|
@ -5163,6 +5177,10 @@ dependencies = [
|
|||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uv-static"
|
||||
version = "0.0.1"
|
||||
|
||||
[[package]]
|
||||
name = "uv-tool"
|
||||
version = "0.0.1"
|
||||
|
@ -5185,6 +5203,7 @@ dependencies = [
|
|||
"uv-python",
|
||||
"uv-settings",
|
||||
"uv-state",
|
||||
"uv-static",
|
||||
"uv-virtualenv",
|
||||
]
|
||||
|
||||
|
@ -5270,6 +5289,7 @@ dependencies = [
|
|||
"uv-pep440",
|
||||
"uv-pep508",
|
||||
"uv-pypi-types",
|
||||
"uv-static",
|
||||
"uv-warnings",
|
||||
]
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ uv-scripts = { path = "crates/uv-scripts" }
|
|||
uv-settings = { path = "crates/uv-settings" }
|
||||
uv-shell = { path = "crates/uv-shell" }
|
||||
uv-state = { path = "crates/uv-state" }
|
||||
uv-static = { path = "crates/uv-static" }
|
||||
uv-tool = { path = "crates/uv-tool" }
|
||||
uv-types = { path = "crates/uv-types" }
|
||||
uv-version = { path = "crates/uv-version" }
|
||||
|
|
|
@ -24,6 +24,7 @@ uv-pep440 = { workspace = true }
|
|||
uv-pep508 = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-python = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
uv-types = { workspace = true }
|
||||
uv-virtualenv = { workspace = true }
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ use uv_pep440::Version;
|
|||
use uv_pep508::PackageName;
|
||||
use uv_pypi_types::{Requirement, VerbatimParsedUrl};
|
||||
use uv_python::{Interpreter, PythonEnvironment};
|
||||
use uv_static::EnvVars;
|
||||
use uv_types::{BuildContext, BuildIsolation, SourceBuildTrait};
|
||||
|
||||
/// The default backend to use when PEP 517 is used without a `build-system` section.
|
||||
|
@ -318,10 +319,10 @@ impl SourceBuild {
|
|||
|
||||
// Figure out what the modified path should be, and remove the PATH variable from the
|
||||
// environment variables if it's there.
|
||||
let user_path = environment_variables.remove(&OsString::from("PATH"));
|
||||
let user_path = environment_variables.remove(&OsString::from(EnvVars::PATH));
|
||||
|
||||
// See if there is an OS PATH variable.
|
||||
let os_path = env::var_os("PATH");
|
||||
let os_path = env::var_os(EnvVars::PATH);
|
||||
|
||||
// Prepend the user supplied PATH to the existing OS PATH
|
||||
let modified_path = if let Some(user_path) = user_path {
|
||||
|
@ -944,10 +945,10 @@ impl PythonRunner {
|
|||
.args(["-c", script])
|
||||
.current_dir(source_tree.simplified())
|
||||
.envs(environment_variables)
|
||||
.env("PATH", modified_path)
|
||||
.env("VIRTUAL_ENV", venv.root())
|
||||
.env("CLICOLOR_FORCE", "1")
|
||||
.env("PYTHONIOENCODING", "utf-8:backslashreplace")
|
||||
.env(EnvVars::PATH, modified_path)
|
||||
.env(EnvVars::VIRTUAL_ENV, venv.root())
|
||||
.env(EnvVars::CLICOLOR_FORCE, "1")
|
||||
.env(EnvVars::PYTHONIOENCODING, "utf-8:backslashreplace")
|
||||
.stdout(std::process::Stdio::piped())
|
||||
.stderr(std::process::Stdio::piped())
|
||||
.spawn()
|
||||
|
|
|
@ -23,6 +23,7 @@ uv-distribution-types = { workspace = true }
|
|||
uv-fs = { workspace = true, features = ["tokio"] }
|
||||
uv-normalize = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
|
||||
clap = { workspace = true, features = ["derive", "env"], optional = true }
|
||||
directories = { workspace = true }
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::Cache;
|
||||
use clap::Parser;
|
||||
|
@ -17,7 +18,7 @@ pub struct CacheArgs {
|
|||
long,
|
||||
short,
|
||||
alias = "no-cache-dir",
|
||||
env = "UV_NO_CACHE",
|
||||
env = EnvVars::UV_NO_CACHE,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
)]
|
||||
pub no_cache: bool,
|
||||
|
@ -26,7 +27,7 @@ pub struct CacheArgs {
|
|||
///
|
||||
/// Defaults to `$HOME/Library/Caches/uv` on macOS, `$XDG_CACHE_HOME/uv` or `$HOME/.cache/uv` on
|
||||
/// Linux, and `%LOCALAPPDATA%\uv\cache` on Windows.
|
||||
#[arg(global = true, long, env = "UV_CACHE_DIR")]
|
||||
#[arg(global = true, long, env = EnvVars::UV_CACHE_DIR)]
|
||||
pub cache_dir: Option<PathBuf>,
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ uv-pypi-types = { workspace = true }
|
|||
uv-python = { workspace = true, features = ["clap", "schemars"]}
|
||||
uv-resolver = { workspace = true, features = ["clap"] }
|
||||
uv-settings = { workspace = true, features = ["schemars"] }
|
||||
uv-static = { workspace = true }
|
||||
uv-version = { workspace = true }
|
||||
uv-warnings = { workspace = true }
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ use uv_pep508::Requirement;
|
|||
use uv_pypi_types::VerbatimParsedUrl;
|
||||
use uv_python::{PythonDownloads, PythonPreference, PythonVersion};
|
||||
use uv_resolver::{AnnotationStyle, ExcludeNewer, PrereleaseMode, ResolutionMode};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
pub mod compat;
|
||||
pub mod options;
|
||||
|
@ -97,7 +98,7 @@ pub struct TopLevelArgs {
|
|||
#[arg(
|
||||
global = true,
|
||||
long,
|
||||
env = "UV_CONFIG_FILE",
|
||||
env = EnvVars::UV_CONFIG_FILE,
|
||||
help_heading = "Global options"
|
||||
)]
|
||||
pub config_file: Option<PathBuf>,
|
||||
|
@ -106,7 +107,7 @@ pub struct TopLevelArgs {
|
|||
///
|
||||
/// Normally, configuration files are discovered in the current directory,
|
||||
/// parent directories, or user configuration directories.
|
||||
#[arg(global = true, long, env = "UV_NO_CONFIG", value_parser = clap::builder::BoolishValueParser::new(), help_heading = "Global options")]
|
||||
#[arg(global = true, long, env = EnvVars::UV_NO_CONFIG, value_parser = clap::builder::BoolishValueParser::new(), help_heading = "Global options")]
|
||||
pub no_config: bool,
|
||||
|
||||
/// Display the concise help for this command.
|
||||
|
@ -133,7 +134,7 @@ pub struct GlobalArgs {
|
|||
long,
|
||||
help_heading = "Python options",
|
||||
display_order = 700,
|
||||
env = "UV_PYTHON_PREFERENCE"
|
||||
env = EnvVars::UV_PYTHON_PREFERENCE
|
||||
)]
|
||||
pub python_preference: Option<PythonPreference>,
|
||||
|
||||
|
@ -188,7 +189,7 @@ pub struct GlobalArgs {
|
|||
/// However, in some cases, you may want to use the platform's native certificate store,
|
||||
/// especially if you're relying on a corporate trust root (e.g., for a mandatory proxy) that's
|
||||
/// included in your system's certificate store.
|
||||
#[arg(global = true, long, env = "UV_NATIVE_TLS", value_parser = clap::builder::BoolishValueParser::new(), overrides_with("no_native_tls"))]
|
||||
#[arg(global = true, long, env = EnvVars::UV_NATIVE_TLS, value_parser = clap::builder::BoolishValueParser::new(), overrides_with("no_native_tls"))]
|
||||
pub native_tls: bool,
|
||||
|
||||
#[arg(global = true, long, overrides_with("native_tls"), hide = true)]
|
||||
|
@ -206,7 +207,7 @@ pub struct GlobalArgs {
|
|||
/// Whether to enable experimental, preview features.
|
||||
///
|
||||
/// Preview features may change without warning.
|
||||
#[arg(global = true, long, hide = true, env = "UV_PREVIEW", value_parser = clap::builder::BoolishValueParser::new(), overrides_with("no_preview"))]
|
||||
#[arg(global = true, long, hide = true, env = EnvVars::UV_PREVIEW, value_parser = clap::builder::BoolishValueParser::new(), overrides_with("no_preview"))]
|
||||
pub preview: bool,
|
||||
|
||||
#[arg(global = true, long, overrides_with("preview"), hide = true)]
|
||||
|
@ -468,7 +469,7 @@ pub struct SelfUpdateArgs {
|
|||
|
||||
/// A GitHub token for authentication.
|
||||
/// A token is not required but can be used to reduce the chance of encountering rate limits.
|
||||
#[arg(long, env = "UV_GITHUB_TOKEN")]
|
||||
#[arg(long, env = EnvVars::UV_GITHUB_TOKEN)]
|
||||
pub token: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -860,7 +861,7 @@ pub struct PipCompileArgs {
|
|||
/// trigger the installation of that package.
|
||||
///
|
||||
/// This is equivalent to pip's `--constraint` option.
|
||||
#[arg(long, short, env = "UV_CONSTRAINT", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, short, env = EnvVars::UV_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
pub constraint: Vec<Maybe<PathBuf>>,
|
||||
|
||||
/// Override versions using the given requirements files.
|
||||
|
@ -872,7 +873,7 @@ pub struct PipCompileArgs {
|
|||
/// While constraints are _additive_, in that they're combined with the requirements of the
|
||||
/// constituent packages, overrides are _absolute_, in that they completely replace the
|
||||
/// requirements of the constituent packages.
|
||||
#[arg(long, env = "UV_OVERRIDE", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, env = EnvVars::UV_OVERRIDE, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
pub r#override: Vec<Maybe<PathBuf>>,
|
||||
|
||||
/// Constrain build dependencies using the given requirements files when building source
|
||||
|
@ -881,7 +882,7 @@ pub struct PipCompileArgs {
|
|||
/// Constraints files are `requirements.txt`-like files that only control the _version_ of a
|
||||
/// requirement that's installed. However, including a package in a constraints file will _not_
|
||||
/// trigger the installation of that package.
|
||||
#[arg(long, short, env = "UV_BUILD_CONSTRAINT", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, short, env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
pub build_constraint: Vec<Maybe<PathBuf>>,
|
||||
|
||||
/// Include optional dependencies from the extra group name; may be provided more than once.
|
||||
|
@ -965,7 +966,7 @@ pub struct PipCompileArgs {
|
|||
/// The header comment to include at the top of the output file generated by `uv pip compile`.
|
||||
///
|
||||
/// Used to reflect custom build scripts and commands that wrap `uv pip compile`.
|
||||
#[arg(long, env = "UV_CUSTOM_COMPILE_COMMAND")]
|
||||
#[arg(long, env = EnvVars::UV_CUSTOM_COMPILE_COMMAND)]
|
||||
pub custom_compile_command: Option<String>,
|
||||
|
||||
/// The Python interpreter to use during resolution.
|
||||
|
@ -989,7 +990,7 @@ pub struct PipCompileArgs {
|
|||
/// the system path.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system")
|
||||
)]
|
||||
|
@ -1161,7 +1162,7 @@ pub struct PipSyncArgs {
|
|||
/// trigger the installation of that package.
|
||||
///
|
||||
/// This is equivalent to pip's `--constraint` option.
|
||||
#[arg(long, short, env = "UV_CONSTRAINT", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, short, env = EnvVars::UV_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
pub constraint: Vec<Maybe<PathBuf>>,
|
||||
|
||||
/// Constrain build dependencies using the given requirements files when building source
|
||||
|
@ -1170,7 +1171,7 @@ pub struct PipSyncArgs {
|
|||
/// Constraints files are `requirements.txt`-like files that only control the _version_ of a
|
||||
/// requirement that's installed. However, including a package in a constraints file will _not_
|
||||
/// trigger the installation of that package.
|
||||
#[arg(long, short, env = "UV_BUILD_CONSTRAINT", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, short, env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
pub build_constraint: Vec<Maybe<PathBuf>>,
|
||||
|
||||
#[command(flatten)]
|
||||
|
@ -1193,7 +1194,7 @@ pub struct PipSyncArgs {
|
|||
/// source archive (`.zip`, `.tar.gz`), as opposed to a directory.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_REQUIRE_HASHES",
|
||||
env = EnvVars::UV_REQUIRE_HASHES,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_require_hashes"),
|
||||
)]
|
||||
|
@ -1209,7 +1210,7 @@ pub struct PipSyncArgs {
|
|||
/// include them.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_VERIFY_HASHES",
|
||||
env = EnvVars::UV_VERIFY_HASHES,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_verify_hashes"),
|
||||
)]
|
||||
|
@ -1230,7 +1231,7 @@ pub struct PipSyncArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -1247,7 +1248,7 @@ pub struct PipSyncArgs {
|
|||
/// should be used with caution, as it can modify the system Python installation.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system")
|
||||
)]
|
||||
|
@ -1264,7 +1265,7 @@ pub struct PipSyncArgs {
|
|||
/// explicitly recommend against modifications by other package managers (like uv or `pip`).
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_BREAK_SYSTEM_PACKAGES",
|
||||
env = EnvVars::UV_BREAK_SYSTEM_PACKAGES,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_break_system_packages")
|
||||
)]
|
||||
|
@ -1409,7 +1410,7 @@ pub struct PipInstallArgs {
|
|||
/// trigger the installation of that package.
|
||||
///
|
||||
/// This is equivalent to pip's `--constraint` option.
|
||||
#[arg(long, short, env = "UV_CONSTRAINT", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, short, env = EnvVars::UV_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
pub constraint: Vec<Maybe<PathBuf>>,
|
||||
|
||||
/// Override versions using the given requirements files.
|
||||
|
@ -1421,7 +1422,7 @@ pub struct PipInstallArgs {
|
|||
/// While constraints are _additive_, in that they're combined with the requirements of the
|
||||
/// constituent packages, overrides are _absolute_, in that they completely replace the
|
||||
/// requirements of the constituent packages.
|
||||
#[arg(long, env = "UV_OVERRIDE", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, env = EnvVars::UV_OVERRIDE, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
pub r#override: Vec<Maybe<PathBuf>>,
|
||||
|
||||
/// Constrain build dependencies using the given requirements files when building source
|
||||
|
@ -1430,7 +1431,7 @@ pub struct PipInstallArgs {
|
|||
/// Constraints files are `requirements.txt`-like files that only control the _version_ of a
|
||||
/// requirement that's installed. However, including a package in a constraints file will _not_
|
||||
/// trigger the installation of that package.
|
||||
#[arg(long, short, env = "UV_BUILD_CONSTRAINT", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, short, env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
pub build_constraint: Vec<Maybe<PathBuf>>,
|
||||
|
||||
/// Include optional dependencies from the extra group name; may be provided more than once.
|
||||
|
@ -1476,7 +1477,7 @@ pub struct PipInstallArgs {
|
|||
/// source archive (`.zip`, `.tar.gz`), as opposed to a directory.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_REQUIRE_HASHES",
|
||||
env = EnvVars::UV_REQUIRE_HASHES,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_require_hashes"),
|
||||
)]
|
||||
|
@ -1492,7 +1493,7 @@ pub struct PipInstallArgs {
|
|||
/// include them.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_VERIFY_HASHES",
|
||||
env = EnvVars::UV_VERIFY_HASHES,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_verify_hashes"),
|
||||
)]
|
||||
|
@ -1513,7 +1514,7 @@ pub struct PipInstallArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -1530,7 +1531,7 @@ pub struct PipInstallArgs {
|
|||
/// should be used with caution, as it can modify the system Python installation.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system")
|
||||
)]
|
||||
|
@ -1547,7 +1548,7 @@ pub struct PipInstallArgs {
|
|||
/// explicitly recommend against modifications by other package managers (like uv or `pip`).
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_BREAK_SYSTEM_PACKAGES",
|
||||
env = EnvVars::UV_BREAK_SYSTEM_PACKAGES,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_break_system_packages")
|
||||
)]
|
||||
|
@ -1691,7 +1692,7 @@ pub struct PipUninstallArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -1704,7 +1705,7 @@ pub struct PipUninstallArgs {
|
|||
/// use the `keyring` CLI to handle authentication.
|
||||
///
|
||||
/// Defaults to `disabled`.
|
||||
#[arg(long, value_enum, env = "UV_KEYRING_PROVIDER")]
|
||||
#[arg(long, value_enum, env = EnvVars::UV_KEYRING_PROVIDER)]
|
||||
pub keyring_provider: Option<KeyringProviderType>,
|
||||
|
||||
/// Allow insecure connections to a host.
|
||||
|
@ -1720,7 +1721,7 @@ pub struct PipUninstallArgs {
|
|||
#[arg(
|
||||
long,
|
||||
alias = "trusted-host",
|
||||
env = "UV_INSECURE_HOST",
|
||||
env = EnvVars::UV_INSECURE_HOST,
|
||||
value_delimiter = ' ',
|
||||
value_parser = parse_insecure_host,
|
||||
)]
|
||||
|
@ -1736,7 +1737,7 @@ pub struct PipUninstallArgs {
|
|||
/// should be used with caution, as it can modify the system Python installation.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system")
|
||||
)]
|
||||
|
@ -1753,7 +1754,7 @@ pub struct PipUninstallArgs {
|
|||
/// explicitly recommend against modifications by other package managers (like uv or `pip`).
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_BREAK_SYSTEM_PACKAGES",
|
||||
env = EnvVars::UV_BREAK_SYSTEM_PACKAGES,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_break_system_packages")
|
||||
)]
|
||||
|
@ -1800,7 +1801,7 @@ pub struct PipFreezeArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -1814,7 +1815,7 @@ pub struct PipFreezeArgs {
|
|||
/// See `uv help python` for details on Python discovery.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system")
|
||||
)]
|
||||
|
@ -1865,7 +1866,7 @@ pub struct PipListArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -1879,7 +1880,7 @@ pub struct PipListArgs {
|
|||
/// See `uv help python` for details on Python discovery.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system")
|
||||
)]
|
||||
|
@ -1906,7 +1907,7 @@ pub struct PipCheckArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -1920,7 +1921,7 @@ pub struct PipCheckArgs {
|
|||
/// See `uv help python` for details on Python discovery.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system")
|
||||
)]
|
||||
|
@ -1955,7 +1956,7 @@ pub struct PipShowArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -1969,7 +1970,7 @@ pub struct PipShowArgs {
|
|||
/// See `uv help python` for details on Python discovery.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system")
|
||||
)]
|
||||
|
@ -2011,7 +2012,7 @@ pub struct PipTreeArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -2025,7 +2026,7 @@ pub struct PipTreeArgs {
|
|||
/// See `uv help python` for details on Python discovery.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system")
|
||||
)]
|
||||
|
@ -2094,7 +2095,7 @@ pub struct BuildArgs {
|
|||
/// Constraints files are `requirements.txt`-like files that only control the _version_ of a
|
||||
/// build dependency that's installed. However, including a package in a constraints file will
|
||||
/// _not_ trigger the inclusion of that package on its own.
|
||||
#[arg(long, short, env = "UV_BUILD_CONSTRAINT", value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
#[arg(long, short, env = EnvVars::UV_BUILD_CONSTRAINT, value_delimiter = ' ', value_parser = parse_maybe_file_path)]
|
||||
pub build_constraint: Vec<Maybe<PathBuf>>,
|
||||
|
||||
/// Require a matching hash for each build requirement.
|
||||
|
@ -2112,7 +2113,7 @@ pub struct BuildArgs {
|
|||
/// source archive (`.zip`, `.tar.gz`), as opposed to a directory.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_REQUIRE_HASHES",
|
||||
env = EnvVars::UV_REQUIRE_HASHES,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_require_hashes"),
|
||||
)]
|
||||
|
@ -2128,7 +2129,7 @@ pub struct BuildArgs {
|
|||
/// include them.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_VERIFY_HASHES",
|
||||
env = EnvVars::UV_VERIFY_HASHES,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_verify_hashes"),
|
||||
)]
|
||||
|
@ -2147,7 +2148,7 @@ pub struct BuildArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -2177,7 +2178,7 @@ pub struct VenvArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -2189,7 +2190,7 @@ pub struct VenvArgs {
|
|||
/// This is the default behavior and has no effect.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system"),
|
||||
hide = true,
|
||||
|
@ -2283,7 +2284,7 @@ pub struct VenvArgs {
|
|||
/// limit resolutions to those present on that first index (`first-match`). This prevents
|
||||
/// "dependency confusion" attacks, whereby an attack can upload a malicious package under the
|
||||
/// same name to a secondary.
|
||||
#[arg(long, value_enum, env = "UV_INDEX_STRATEGY")]
|
||||
#[arg(long, value_enum, env = EnvVars::UV_INDEX_STRATEGY)]
|
||||
pub index_strategy: Option<IndexStrategy>,
|
||||
|
||||
/// Attempt to use `keyring` for authentication for index URLs.
|
||||
|
@ -2292,7 +2293,7 @@ pub struct VenvArgs {
|
|||
/// use the `keyring` CLI to handle authentication.
|
||||
///
|
||||
/// Defaults to `disabled`.
|
||||
#[arg(long, value_enum, env = "UV_KEYRING_PROVIDER")]
|
||||
#[arg(long, value_enum, env = EnvVars::UV_KEYRING_PROVIDER)]
|
||||
pub keyring_provider: Option<KeyringProviderType>,
|
||||
|
||||
/// Allow insecure connections to a host.
|
||||
|
@ -2308,7 +2309,7 @@ pub struct VenvArgs {
|
|||
#[arg(
|
||||
long,
|
||||
alias = "trusted-host",
|
||||
env = "UV_INSECURE_HOST",
|
||||
env = EnvVars::UV_INSECURE_HOST,
|
||||
value_delimiter = ' ',
|
||||
value_parser = parse_insecure_host,
|
||||
)]
|
||||
|
@ -2318,7 +2319,7 @@ pub struct VenvArgs {
|
|||
///
|
||||
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and local dates in the same
|
||||
/// format (e.g., `2006-12-02`) in your system's configured time zone.
|
||||
#[arg(long, env = "UV_EXCLUDE_NEWER")]
|
||||
#[arg(long, env = EnvVars::UV_EXCLUDE_NEWER)]
|
||||
pub exclude_newer: Option<ExcludeNewer>,
|
||||
|
||||
/// The method to use when installing packages from the global cache.
|
||||
|
@ -2327,7 +2328,7 @@ pub struct VenvArgs {
|
|||
///
|
||||
/// Defaults to `clone` (also known as Copy-on-Write) on macOS, and `hardlink` on Linux and
|
||||
/// Windows.
|
||||
#[arg(long, value_enum, env = "UV_LINK_MODE")]
|
||||
#[arg(long, value_enum, env = EnvVars::UV_LINK_MODE)]
|
||||
pub link_mode: Option<uv_install_wheel::linker::LinkMode>,
|
||||
|
||||
#[command(flatten)]
|
||||
|
@ -2493,7 +2494,7 @@ pub struct InitArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -2607,7 +2608,7 @@ pub struct RunArgs {
|
|||
///
|
||||
/// Implies `--frozen`, as the project dependencies will be ignored (i.e., the lockfile will not
|
||||
/// be updated, since the environment will not be synced regardless).
|
||||
#[arg(long, env = "UV_NO_SYNC", value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
#[arg(long, env = EnvVars::UV_NO_SYNC, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
pub no_sync: bool,
|
||||
|
||||
/// Assert that the `uv.lock` will remain unchanged.
|
||||
|
@ -2669,7 +2670,7 @@ pub struct RunArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -2679,7 +2680,7 @@ pub struct RunArgs {
|
|||
/// Whether to show resolver and installer output from any environment modifications.
|
||||
///
|
||||
/// By default, environment modifications are omitted, but enabled under `--verbose`.
|
||||
#[arg(long, env = "UV_SHOW_RESOLUTION", value_parser = clap::builder::BoolishValueParser::new(), hide = true)]
|
||||
#[arg(long, env = EnvVars::UV_SHOW_RESOLUTION, value_parser = clap::builder::BoolishValueParser::new(), hide = true)]
|
||||
pub show_resolution: bool,
|
||||
}
|
||||
|
||||
|
@ -2812,7 +2813,7 @@ pub struct SyncArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -2856,7 +2857,7 @@ pub struct LockArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -2933,7 +2934,7 @@ pub struct AddArgs {
|
|||
pub extra: Option<Vec<ExtraName>>,
|
||||
|
||||
/// Avoid syncing the virtual environment.
|
||||
#[arg(long, env = "UV_NO_SYNC", value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
#[arg(long, env = EnvVars::UV_NO_SYNC, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
pub no_sync: bool,
|
||||
|
||||
/// Assert that the `uv.lock` will remain unchanged.
|
||||
|
@ -2979,7 +2980,7 @@ pub struct AddArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -3003,7 +3004,7 @@ pub struct RemoveArgs {
|
|||
pub optional: Option<ExtraName>,
|
||||
|
||||
/// Avoid syncing the virtual environment after re-locking the project.
|
||||
#[arg(long, env = "UV_NO_SYNC", value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
#[arg(long, env = EnvVars::UV_NO_SYNC, value_parser = clap::builder::BoolishValueParser::new(), conflicts_with = "frozen")]
|
||||
pub no_sync: bool,
|
||||
|
||||
/// Assert that the `uv.lock` will remain unchanged.
|
||||
|
@ -3046,7 +3047,7 @@ pub struct RemoveArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -3132,7 +3133,7 @@ pub struct TreeArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -3264,7 +3265,7 @@ pub struct ExportArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -3419,7 +3420,7 @@ pub struct ToolRunArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -3429,7 +3430,7 @@ pub struct ToolRunArgs {
|
|||
/// Whether to show resolver and installer output from any environment modifications.
|
||||
///
|
||||
/// By default, environment modifications are omitted, but enabled under `--verbose`.
|
||||
#[arg(long, env = "UV_SHOW_RESOLUTION", value_parser = clap::builder::BoolishValueParser::new(), hide = true)]
|
||||
#[arg(long, env = EnvVars::UV_SHOW_RESOLUTION, value_parser = clap::builder::BoolishValueParser::new(), hide = true)]
|
||||
pub show_resolution: bool,
|
||||
|
||||
#[arg(long, hide = true)]
|
||||
|
@ -3481,7 +3482,7 @@ pub struct ToolInstallArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -3558,7 +3559,7 @@ pub struct ToolUpgradeArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_PYTHON",
|
||||
env = EnvVars::UV_PYTHON,
|
||||
verbatim_doc_comment,
|
||||
help_heading = "Python options",
|
||||
value_parser = parse_maybe_string,
|
||||
|
@ -3722,7 +3723,7 @@ pub struct PythonFindArgs {
|
|||
/// restrict its search to the system path.
|
||||
#[arg(
|
||||
long,
|
||||
env = "UV_SYSTEM_PYTHON",
|
||||
env = EnvVars::UV_SYSTEM_PYTHON,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
overrides_with("no_system")
|
||||
)]
|
||||
|
@ -3814,7 +3815,7 @@ pub struct IndexArgs {
|
|||
///
|
||||
/// The index given by this flag is given lower priority than all other
|
||||
/// indexes specified via the `--extra-index-url` flag.
|
||||
#[arg(long, short, env = "UV_INDEX_URL", value_parser = parse_index_url, help_heading = "Index options")]
|
||||
#[arg(long, short, env = EnvVars::UV_INDEX_URL, value_parser = parse_index_url, help_heading = "Index options")]
|
||||
pub index_url: Option<Maybe<IndexUrl>>,
|
||||
|
||||
/// Extra URLs of package indexes to use, in addition to `--index-url`.
|
||||
|
@ -3825,7 +3826,7 @@ pub struct IndexArgs {
|
|||
/// All indexes provided via this flag take priority over the index specified by
|
||||
/// `--index-url` (which defaults to PyPI). When multiple `--extra-index-url` flags are
|
||||
/// provided, earlier values take priority.
|
||||
#[arg(long, env = "UV_EXTRA_INDEX_URL", value_delimiter = ' ', value_parser = parse_index_url, help_heading = "Index options")]
|
||||
#[arg(long, env = EnvVars::UV_EXTRA_INDEX_URL, value_delimiter = ' ', value_parser = parse_index_url, help_heading = "Index options")]
|
||||
pub extra_index_url: Option<Vec<Maybe<IndexUrl>>>,
|
||||
|
||||
/// Locations to search for candidate distributions, in addition to those found in the registry
|
||||
|
@ -3839,7 +3840,7 @@ pub struct IndexArgs {
|
|||
#[arg(
|
||||
long,
|
||||
short,
|
||||
env = "UV_FIND_LINKS",
|
||||
env = EnvVars::UV_FIND_LINKS,
|
||||
value_parser = parse_flat_index,
|
||||
help_heading = "Index options"
|
||||
)]
|
||||
|
@ -3959,7 +3960,7 @@ pub struct InstallerArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_INDEX_STRATEGY",
|
||||
env = EnvVars::UV_INDEX_STRATEGY,
|
||||
help_heading = "Index options"
|
||||
)]
|
||||
pub index_strategy: Option<IndexStrategy>,
|
||||
|
@ -3973,7 +3974,7 @@ pub struct InstallerArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_KEYRING_PROVIDER",
|
||||
env = EnvVars::UV_KEYRING_PROVIDER,
|
||||
help_heading = "Index options"
|
||||
)]
|
||||
pub keyring_provider: Option<KeyringProviderType>,
|
||||
|
@ -3991,7 +3992,7 @@ pub struct InstallerArgs {
|
|||
#[arg(
|
||||
long,
|
||||
alias = "trusted-host",
|
||||
env = "UV_INSECURE_HOST",
|
||||
env = EnvVars::UV_INSECURE_HOST,
|
||||
value_delimiter = ' ',
|
||||
value_parser = parse_insecure_host,
|
||||
help_heading = "Index options"
|
||||
|
@ -4014,7 +4015,7 @@ pub struct InstallerArgs {
|
|||
long,
|
||||
overrides_with("build_isolation"),
|
||||
help_heading = "Build options",
|
||||
env = "UV_NO_BUILD_ISOLATION",
|
||||
env = EnvVars::UV_NO_BUILD_ISOLATION,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
)]
|
||||
pub no_build_isolation: bool,
|
||||
|
@ -4031,7 +4032,7 @@ pub struct InstallerArgs {
|
|||
///
|
||||
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and local dates in the same
|
||||
/// format (e.g., `2006-12-02`) in your system's configured time zone.
|
||||
#[arg(long, env = "UV_EXCLUDE_NEWER", help_heading = "Resolver options")]
|
||||
#[arg(long, env = EnvVars::UV_EXCLUDE_NEWER, help_heading = "Resolver options")]
|
||||
pub exclude_newer: Option<ExcludeNewer>,
|
||||
|
||||
/// The method to use when installing packages from the global cache.
|
||||
|
@ -4041,7 +4042,7 @@ pub struct InstallerArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_LINK_MODE",
|
||||
env = EnvVars::UV_LINK_MODE,
|
||||
help_heading = "Installer options"
|
||||
)]
|
||||
pub link_mode: Option<uv_install_wheel::linker::LinkMode>,
|
||||
|
@ -4061,7 +4062,7 @@ pub struct InstallerArgs {
|
|||
alias = "compile",
|
||||
overrides_with("no_compile_bytecode"),
|
||||
help_heading = "Installer options",
|
||||
env = "UV_COMPILE_BYTECODE",
|
||||
env = EnvVars::UV_COMPILE_BYTECODE,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
)]
|
||||
pub compile_bytecode: bool,
|
||||
|
@ -4121,7 +4122,7 @@ pub struct ResolverArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_INDEX_STRATEGY",
|
||||
env = EnvVars::UV_INDEX_STRATEGY,
|
||||
help_heading = "Index options"
|
||||
)]
|
||||
pub index_strategy: Option<IndexStrategy>,
|
||||
|
@ -4135,7 +4136,7 @@ pub struct ResolverArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_KEYRING_PROVIDER",
|
||||
env = EnvVars::UV_KEYRING_PROVIDER,
|
||||
help_heading = "Index options"
|
||||
)]
|
||||
pub keyring_provider: Option<KeyringProviderType>,
|
||||
|
@ -4153,7 +4154,7 @@ pub struct ResolverArgs {
|
|||
#[arg(
|
||||
long,
|
||||
alias = "trusted-host",
|
||||
env = "UV_INSECURE_HOST",
|
||||
env = EnvVars::UV_INSECURE_HOST,
|
||||
value_delimiter = ' ',
|
||||
value_parser = parse_insecure_host,
|
||||
help_heading = "Index options"
|
||||
|
@ -4167,7 +4168,7 @@ pub struct ResolverArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_RESOLUTION",
|
||||
env = EnvVars::UV_RESOLUTION,
|
||||
help_heading = "Resolver options"
|
||||
)]
|
||||
pub resolution: Option<ResolutionMode>,
|
||||
|
@ -4180,7 +4181,7 @@ pub struct ResolverArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_PRERELEASE",
|
||||
env = EnvVars::UV_PRERELEASE,
|
||||
help_heading = "Resolver options"
|
||||
)]
|
||||
pub prerelease: Option<PrereleaseMode>,
|
||||
|
@ -4204,7 +4205,7 @@ pub struct ResolverArgs {
|
|||
long,
|
||||
overrides_with("build_isolation"),
|
||||
help_heading = "Build options",
|
||||
env = "UV_NO_BUILD_ISOLATION",
|
||||
env = EnvVars::UV_NO_BUILD_ISOLATION,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
)]
|
||||
pub no_build_isolation: bool,
|
||||
|
@ -4227,7 +4228,7 @@ pub struct ResolverArgs {
|
|||
///
|
||||
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and local dates in the same
|
||||
/// format (e.g., `2006-12-02`) in your system's configured time zone.
|
||||
#[arg(long, env = "UV_EXCLUDE_NEWER", help_heading = "Resolver options")]
|
||||
#[arg(long, env = EnvVars::UV_EXCLUDE_NEWER, help_heading = "Resolver options")]
|
||||
pub exclude_newer: Option<ExcludeNewer>,
|
||||
|
||||
/// The method to use when installing packages from the global cache.
|
||||
|
@ -4239,7 +4240,7 @@ pub struct ResolverArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_LINK_MODE",
|
||||
env = EnvVars::UV_LINK_MODE,
|
||||
help_heading = "Installer options"
|
||||
)]
|
||||
pub link_mode: Option<uv_install_wheel::linker::LinkMode>,
|
||||
|
@ -4313,7 +4314,7 @@ pub struct ResolverInstallerArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_INDEX_STRATEGY",
|
||||
env = EnvVars::UV_INDEX_STRATEGY,
|
||||
help_heading = "Index options"
|
||||
)]
|
||||
pub index_strategy: Option<IndexStrategy>,
|
||||
|
@ -4327,7 +4328,7 @@ pub struct ResolverInstallerArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_KEYRING_PROVIDER",
|
||||
env = EnvVars::UV_KEYRING_PROVIDER,
|
||||
help_heading = "Index options"
|
||||
)]
|
||||
pub keyring_provider: Option<KeyringProviderType>,
|
||||
|
@ -4345,7 +4346,7 @@ pub struct ResolverInstallerArgs {
|
|||
#[arg(
|
||||
long,
|
||||
alias = "trusted-host",
|
||||
env = "UV_INSECURE_HOST",
|
||||
env = EnvVars::UV_INSECURE_HOST,
|
||||
value_delimiter = ' ',
|
||||
value_parser = parse_insecure_host,
|
||||
help_heading = "Index options"
|
||||
|
@ -4359,7 +4360,7 @@ pub struct ResolverInstallerArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_RESOLUTION",
|
||||
env = EnvVars::UV_RESOLUTION,
|
||||
help_heading = "Resolver options"
|
||||
)]
|
||||
pub resolution: Option<ResolutionMode>,
|
||||
|
@ -4372,7 +4373,7 @@ pub struct ResolverInstallerArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_PRERELEASE",
|
||||
env = EnvVars::UV_PRERELEASE,
|
||||
help_heading = "Resolver options"
|
||||
)]
|
||||
pub prerelease: Option<PrereleaseMode>,
|
||||
|
@ -4396,7 +4397,7 @@ pub struct ResolverInstallerArgs {
|
|||
long,
|
||||
overrides_with("build_isolation"),
|
||||
help_heading = "Build options",
|
||||
env = "UV_NO_BUILD_ISOLATION",
|
||||
env = EnvVars::UV_NO_BUILD_ISOLATION,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
)]
|
||||
pub no_build_isolation: bool,
|
||||
|
@ -4419,7 +4420,7 @@ pub struct ResolverInstallerArgs {
|
|||
///
|
||||
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and local dates in the same
|
||||
/// format (e.g., `2006-12-02`) in your system's configured time zone.
|
||||
#[arg(long, env = "UV_EXCLUDE_NEWER", help_heading = "Resolver options")]
|
||||
#[arg(long, env = EnvVars::UV_EXCLUDE_NEWER, help_heading = "Resolver options")]
|
||||
pub exclude_newer: Option<ExcludeNewer>,
|
||||
|
||||
/// The method to use when installing packages from the global cache.
|
||||
|
@ -4429,7 +4430,7 @@ pub struct ResolverInstallerArgs {
|
|||
#[arg(
|
||||
long,
|
||||
value_enum,
|
||||
env = "UV_LINK_MODE",
|
||||
env = EnvVars::UV_LINK_MODE,
|
||||
help_heading = "Installer options"
|
||||
)]
|
||||
pub link_mode: Option<uv_install_wheel::linker::LinkMode>,
|
||||
|
@ -4449,7 +4450,7 @@ pub struct ResolverInstallerArgs {
|
|||
alias = "compile",
|
||||
overrides_with("no_compile_bytecode"),
|
||||
help_heading = "Installer options",
|
||||
env = "UV_COMPILE_BYTECODE",
|
||||
env = EnvVars::UV_COMPILE_BYTECODE,
|
||||
value_parser = clap::builder::BoolishValueParser::new(),
|
||||
)]
|
||||
pub compile_bytecode: bool,
|
||||
|
@ -4515,15 +4516,15 @@ pub struct PublishArgs {
|
|||
/// Defaults to PyPI's publish URL (<https://upload.pypi.org/legacy/>).
|
||||
///
|
||||
/// The default value is publish URL for PyPI (<https://upload.pypi.org/legacy/>).
|
||||
#[arg(long, env = "UV_PUBLISH_URL")]
|
||||
#[arg(long, env = EnvVars::UV_PUBLISH_URL)]
|
||||
pub publish_url: Option<Url>,
|
||||
|
||||
/// The username for the upload.
|
||||
#[arg(short, long, env = "UV_PUBLISH_USERNAME")]
|
||||
#[arg(short, long, env = EnvVars::UV_PUBLISH_USERNAME)]
|
||||
pub username: Option<String>,
|
||||
|
||||
/// The password for the upload.
|
||||
#[arg(short, long, env = "UV_PUBLISH_PASSWORD")]
|
||||
#[arg(short, long, env = EnvVars::UV_PUBLISH_PASSWORD)]
|
||||
pub password: Option<String>,
|
||||
|
||||
/// The token for the upload.
|
||||
|
@ -4533,7 +4534,7 @@ pub struct PublishArgs {
|
|||
#[arg(
|
||||
short,
|
||||
long,
|
||||
env = "UV_PUBLISH_TOKEN",
|
||||
env = EnvVars::UV_PUBLISH_TOKEN,
|
||||
conflicts_with = "username",
|
||||
conflicts_with = "password"
|
||||
)]
|
||||
|
@ -4553,7 +4554,7 @@ pub struct PublishArgs {
|
|||
/// use the `keyring` CLI to handle authentication.
|
||||
///
|
||||
/// Defaults to `disabled`.
|
||||
#[arg(long, value_enum, env = "UV_KEYRING_PROVIDER")]
|
||||
#[arg(long, value_enum, env = EnvVars::UV_KEYRING_PROVIDER)]
|
||||
pub keyring_provider: Option<KeyringProviderType>,
|
||||
|
||||
/// Allow insecure connections to a host.
|
||||
|
@ -4569,7 +4570,7 @@ pub struct PublishArgs {
|
|||
#[arg(
|
||||
long,
|
||||
alias = "trusted-host",
|
||||
env = "UV_INSECURE_HOST",
|
||||
env = EnvVars::UV_INSECURE_HOST,
|
||||
value_delimiter = ' ',
|
||||
value_parser = parse_insecure_host,
|
||||
)]
|
||||
|
|
|
@ -23,6 +23,7 @@ uv-pep440 = { workspace = true }
|
|||
uv-pep508 = { workspace = true }
|
||||
uv-platform-tags = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
uv-version = { workspace = true }
|
||||
uv-warnings = { workspace = true }
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ use uv_configuration::{KeyringProviderType, TrustedHost};
|
|||
use uv_fs::Simplified;
|
||||
use uv_pep508::MarkerEnvironment;
|
||||
use uv_platform_tags::Platform;
|
||||
use uv_static::EnvVars;
|
||||
use uv_version::version;
|
||||
use uv_warnings::warn_user_once;
|
||||
|
||||
|
@ -156,7 +157,7 @@ impl<'a> BaseClientBuilder<'a> {
|
|||
}
|
||||
|
||||
// Check for the presence of an `SSL_CERT_FILE`.
|
||||
let ssl_cert_file_exists = env::var_os("SSL_CERT_FILE").is_some_and(|path| {
|
||||
let ssl_cert_file_exists = env::var_os(EnvVars::SSL_CERT_FILE).is_some_and(|path| {
|
||||
let path_exists = Path::new(&path).exists();
|
||||
if !path_exists {
|
||||
warn_user_once!(
|
||||
|
@ -169,9 +170,9 @@ impl<'a> BaseClientBuilder<'a> {
|
|||
|
||||
// Timeout options, matching https://doc.rust-lang.org/nightly/cargo/reference/config.html#httptimeout
|
||||
// `UV_REQUEST_TIMEOUT` is provided for backwards compatibility with v0.1.6
|
||||
let timeout = env::var("UV_HTTP_TIMEOUT")
|
||||
.or_else(|_| env::var("UV_REQUEST_TIMEOUT"))
|
||||
.or_else(|_| env::var("HTTP_TIMEOUT"))
|
||||
let timeout = env::var(EnvVars::UV_HTTP_TIMEOUT)
|
||||
.or_else(|_| env::var(EnvVars::UV_REQUEST_TIMEOUT))
|
||||
.or_else(|_| env::var(EnvVars::HTTP_TIMEOUT))
|
||||
.and_then(|value| {
|
||||
value.parse::<u64>()
|
||||
.map(Duration::from_secs)
|
||||
|
@ -260,7 +261,7 @@ impl<'a> BaseClientBuilder<'a> {
|
|||
};
|
||||
|
||||
// Configure mTLS.
|
||||
let client_builder = if let Some(ssl_client_cert) = env::var_os("SSL_CLIENT_CERT") {
|
||||
let client_builder = if let Some(ssl_client_cert) = env::var_os(EnvVars::SSL_CLIENT_CERT) {
|
||||
match read_identity(&ssl_client_cert) {
|
||||
Ok(identity) => client_builder.identity(identity),
|
||||
Err(err) => {
|
||||
|
|
|
@ -24,6 +24,7 @@ uv-normalize = { workspace = true }
|
|||
uv-pep508 = { workspace = true, features = ["schemars"] }
|
||||
uv-platform-tags = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
|
||||
clap = { workspace = true, features = ["derive"], optional = true }
|
||||
either = { workspace = true }
|
||||
|
|
|
@ -2,6 +2,7 @@ use tracing::debug;
|
|||
|
||||
use uv_pep508::MarkerEnvironment;
|
||||
use uv_platform_tags::{Arch, Os, Platform};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
/// The supported target triples. Each triple consists of an architecture, vendor, and operating
|
||||
/// system.
|
||||
|
@ -321,7 +322,7 @@ impl TargetTriple {
|
|||
|
||||
/// Return the macOS deployment target as parsed from the environment.
|
||||
fn macos_deployment_target() -> Option<(u16, u16)> {
|
||||
let version = std::env::var("MACOSX_DEPLOYMENT_TARGET").ok()?;
|
||||
let version = std::env::var(EnvVars::MACOSX_DEPLOYMENT_TARGET).ok()?;
|
||||
let mut parts = version.split('.');
|
||||
|
||||
// Parse the major version (e.g., `12` in `12.0`).
|
||||
|
|
|
@ -28,6 +28,7 @@ uv-pep508 = { workspace = true }
|
|||
uv-pypi-types = { workspace = true }
|
||||
uv-python = { workspace = true }
|
||||
uv-settings = { workspace = true, features = ["schemars"] }
|
||||
uv-static = { workspace = true }
|
||||
uv-workspace = { workspace = true, features = ["schemars"] }
|
||||
|
||||
# Any dependencies that are exclusively used in `uv-dev` should be listed as non-workspace
|
||||
|
|
|
@ -2,13 +2,15 @@ use std::env;
|
|||
|
||||
use anyhow::Result;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::generate_all::Mode;
|
||||
|
||||
use super::{main, Args};
|
||||
|
||||
#[test]
|
||||
fn test_generate_cli_reference() -> Result<()> {
|
||||
let mode = if env::var("UV_UPDATE_SCHEMA").as_deref() == Ok("1") {
|
||||
let mode = if env::var(EnvVars::UV_UPDATE_SCHEMA).as_deref() == Ok("1") {
|
||||
Mode::Write
|
||||
} else {
|
||||
Mode::Check
|
||||
|
|
|
@ -2,13 +2,15 @@ use std::env;
|
|||
|
||||
use anyhow::Result;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::generate_all::Mode;
|
||||
|
||||
use super::{main, Args};
|
||||
|
||||
#[test]
|
||||
fn test_generate_json_schema() -> Result<()> {
|
||||
let mode = if env::var("UV_UPDATE_SCHEMA").as_deref() == Ok("1") {
|
||||
let mode = if env::var(EnvVars::UV_UPDATE_SCHEMA).as_deref() == Ok("1") {
|
||||
Mode::Write
|
||||
} else {
|
||||
Mode::Check
|
||||
|
|
|
@ -2,13 +2,15 @@ use std::env;
|
|||
|
||||
use anyhow::Result;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::generate_all::Mode;
|
||||
|
||||
use super::{main, Args};
|
||||
|
||||
#[test]
|
||||
fn test_generate_options_reference() -> Result<()> {
|
||||
let mode = if env::var("UV_UPDATE_SCHEMA").as_deref() == Ok("1") {
|
||||
let mode = if env::var(EnvVars::UV_UPDATE_SCHEMA).as_deref() == Ok("1") {
|
||||
Mode::Write
|
||||
} else {
|
||||
Mode::Check
|
||||
|
|
|
@ -25,6 +25,7 @@ use crate::generate_options_reference::Args as GenerateOptionsReferenceArgs;
|
|||
#[cfg(feature = "render")]
|
||||
use crate::render_benchmarks::RenderBenchmarksArgs;
|
||||
use crate::wheel_metadata::WheelMetadataArgs;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
mod clear_compile;
|
||||
mod compile;
|
||||
|
@ -77,7 +78,7 @@ async fn run() -> Result<()> {
|
|||
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
async fn main() -> ExitCode {
|
||||
let (duration_layer, _guard) = if let Ok(location) = env::var("TRACING_DURATIONS_FILE") {
|
||||
let (duration_layer, _guard) = if let Ok(location) = env::var(EnvVars::TRACING_DURATIONS_FILE) {
|
||||
let location = PathBuf::from(location);
|
||||
if let Some(parent) = location.parent() {
|
||||
fs_err::tokio::create_dir_all(&parent)
|
||||
|
|
|
@ -19,6 +19,7 @@ workspace = true
|
|||
uv-cache-key = { workspace = true }
|
||||
uv-fs = { workspace = true, features = ["tokio"] }
|
||||
uv-auth = { workspace = true }
|
||||
uv-static = { workspace = true}
|
||||
|
||||
anyhow = { workspace = true }
|
||||
cargo-util = { workspace = true }
|
||||
|
|
|
@ -14,6 +14,7 @@ use reqwest_middleware::ClientWithMiddleware;
|
|||
use tracing::debug;
|
||||
use url::Url;
|
||||
use uv_fs::Simplified;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
/// A file indicates that if present, `git reset` has been done and a repo
|
||||
/// checkout is ready to go. See [`GitCheckout::reset`] for why we need this.
|
||||
|
@ -604,13 +605,13 @@ fn fetch_with_cli(
|
|||
// rebase`), the GIT_DIR is set by git and will point to the wrong
|
||||
// location (this takes precedence over the cwd). Make sure this is
|
||||
// unset so git will look at cwd for the repo.
|
||||
.env_remove("GIT_DIR")
|
||||
.env_remove(EnvVars::GIT_DIR)
|
||||
// The reset of these may not be necessary, but I'm including them
|
||||
// just to be extra paranoid and avoid any issues.
|
||||
.env_remove("GIT_WORK_TREE")
|
||||
.env_remove("GIT_INDEX_FILE")
|
||||
.env_remove("GIT_OBJECT_DIRECTORY")
|
||||
.env_remove("GIT_ALTERNATE_OBJECT_DIRECTORIES")
|
||||
.env_remove(EnvVars::GIT_WORK_TREE)
|
||||
.env_remove(EnvVars::GIT_INDEX_FILE)
|
||||
.env_remove(EnvVars::GIT_OBJECT_DIRECTORY)
|
||||
.env_remove(EnvVars::GIT_ALTERNATE_OBJECT_DIRECTORIES)
|
||||
.cwd(&repo.path);
|
||||
|
||||
// We capture the output to avoid streaming it to the user's console during clones.
|
||||
|
|
|
@ -31,6 +31,7 @@ uv-pep508 = { workspace = true }
|
|||
uv-platform-tags = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-python = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
uv-types = { workspace = true }
|
||||
uv-warnings = { workspace = true }
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use tracing::{debug, instrument};
|
|||
use walkdir::WalkDir;
|
||||
|
||||
use uv_fs::Simplified;
|
||||
use uv_static::EnvVars;
|
||||
use uv_warnings::warn_user;
|
||||
|
||||
const COMPILEALL_SCRIPT: &str = include_str!("pip_compileall.py");
|
||||
|
@ -266,7 +267,7 @@ async fn launch_bytecode_compiler(
|
|||
.stderr(Stdio::piped())
|
||||
.current_dir(dir)
|
||||
// Otherwise stdout is buffered and we'll wait forever for a response
|
||||
.env("PYTHONUNBUFFERED", "1")
|
||||
.env(EnvVars::PYTHONUNBUFFERED, "1")
|
||||
.spawn()
|
||||
.map_err(CompileError::PythonSubcommand)?;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ uv-distribution-filename = { workspace = true }
|
|||
uv-fs = { workspace = true }
|
||||
uv-metadata = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
uv-warnings = { workspace = true }
|
||||
|
||||
async-compression = { workspace = true }
|
||||
|
|
|
@ -30,6 +30,7 @@ use uv_distribution_filename::{DistFilename, SourceDistExtension, SourceDistFile
|
|||
use uv_fs::{ProgressReader, Simplified};
|
||||
use uv_metadata::read_metadata_async_seek;
|
||||
use uv_pypi_types::{Metadata23, MetadataError};
|
||||
use uv_static::EnvVars;
|
||||
use uv_warnings::{warn_user, warn_user_once};
|
||||
|
||||
pub use trusted_publishing::TrustedPublishingToken;
|
||||
|
@ -247,7 +248,7 @@ pub async fn check_trusted_publishing(
|
|||
return Ok(None);
|
||||
}
|
||||
// If we aren't in GitHub Actions, we can't use trusted publishing.
|
||||
if env::var("GITHUB_ACTIONS") != Ok("true".to_string()) {
|
||||
if env::var(EnvVars::GITHUB_ACTIONS) != Ok("true".to_string()) {
|
||||
return Ok(None);
|
||||
}
|
||||
// We could check for credentials from the keyring or netrc the auth middleware first, but
|
||||
|
@ -266,7 +267,7 @@ pub async fn check_trusted_publishing(
|
|||
}
|
||||
TrustedPublishing::Always => {
|
||||
debug!("Using trusted publishing for GitHub Actions");
|
||||
if env::var("GITHUB_ACTIONS") != Ok("true".to_string()) {
|
||||
if env::var(EnvVars::GITHUB_ACTIONS) != Ok("true".to_string()) {
|
||||
warn_user_once!(
|
||||
"Trusted publishing was requested, but you're not in GitHub Actions."
|
||||
);
|
||||
|
|
|
@ -9,6 +9,7 @@ use std::fmt::Display;
|
|||
use thiserror::Error;
|
||||
use tracing::{debug, trace};
|
||||
use url::Url;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum TrustedPublishingError {
|
||||
|
@ -74,7 +75,7 @@ pub(crate) async fn get_token(
|
|||
client: &ClientWithMiddleware,
|
||||
) -> Result<TrustedPublishingToken, TrustedPublishingError> {
|
||||
// If this fails, we can skip the audience request.
|
||||
let oidc_token_request_token = env::var("ACTIONS_ID_TOKEN_REQUEST_TOKEN")?;
|
||||
let oidc_token_request_token = env::var(EnvVars::ACTIONS_ID_TOKEN_REQUEST_TOKEN)?;
|
||||
|
||||
// Request 1: Get the audience
|
||||
let audience = get_audience(registry, client).await?;
|
||||
|
@ -89,7 +90,7 @@ pub(crate) async fn get_token(
|
|||
|
||||
// Tell GitHub Actions to mask the token in any console logs.
|
||||
#[allow(clippy::print_stdout)]
|
||||
if env::var("GITHUB_ACTIONS") == Ok("true".to_string()) {
|
||||
if env::var(EnvVars::GITHUB_ACTIONS) == Ok("true".to_string()) {
|
||||
println!("::add-mask::{}", &publish_token);
|
||||
}
|
||||
|
||||
|
@ -115,7 +116,7 @@ async fn get_oidc_token(
|
|||
oidc_token_request_token: &str,
|
||||
client: &ClientWithMiddleware,
|
||||
) -> Result<String, TrustedPublishingError> {
|
||||
let mut oidc_token_url = Url::parse(&env::var("ACTIONS_ID_TOKEN_REQUEST_URL")?)?;
|
||||
let mut oidc_token_url = Url::parse(&env::var(EnvVars::ACTIONS_ID_TOKEN_REQUEST_URL)?)?;
|
||||
oidc_token_url
|
||||
.query_pairs_mut()
|
||||
.append_pair("audience", audience);
|
||||
|
|
|
@ -29,6 +29,7 @@ uv-pep508 = { workspace = true }
|
|||
uv-platform-tags = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-state = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
uv-warnings = { workspace = true }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
|
|
|
@ -13,6 +13,7 @@ use uv_cache::Cache;
|
|||
use uv_fs::which::is_executable;
|
||||
use uv_fs::Simplified;
|
||||
use uv_pep440::{Prerelease, Version, VersionSpecifier, VersionSpecifiers};
|
||||
use uv_static::EnvVars;
|
||||
use uv_warnings::warn_user_once;
|
||||
|
||||
use crate::downloads::PythonDownloadRequest;
|
||||
|
@ -344,7 +345,7 @@ fn python_executables_from_installed<'a>(
|
|||
}
|
||||
};
|
||||
|
||||
env::var_os("UV_TEST_PYTHON_PATH")
|
||||
env::var_os(EnvVars::UV_TEST_PYTHON_PATH)
|
||||
.is_none()
|
||||
.then(|| {
|
||||
registry_pythons()
|
||||
|
@ -401,7 +402,7 @@ fn python_executables<'a>(
|
|||
) -> Box<dyn Iterator<Item = Result<(PythonSource, PathBuf), Error>> + 'a> {
|
||||
// Always read from `UV_INTERNAL__PARENT_INTERPRETER` — it could be a system interpreter
|
||||
let from_parent_interpreter = std::iter::once_with(|| {
|
||||
std::env::var_os("UV_INTERNAL__PARENT_INTERPRETER")
|
||||
std::env::var_os(EnvVars::UV_INTERNAL__PARENT_INTERPRETER)
|
||||
.into_iter()
|
||||
.map(|path| Ok((PythonSource::ParentInterpreter, PathBuf::from(path))))
|
||||
})
|
||||
|
@ -443,8 +444,8 @@ fn python_executables_from_search_path<'a>(
|
|||
implementation: Option<&'a ImplementationName>,
|
||||
) -> impl Iterator<Item = PathBuf> + 'a {
|
||||
// `UV_TEST_PYTHON_PATH` can be used to override `PATH` to limit Python executable availability in the test suite
|
||||
let search_path =
|
||||
env::var_os("UV_TEST_PYTHON_PATH").unwrap_or(env::var_os("PATH").unwrap_or_default());
|
||||
let search_path = env::var_os(EnvVars::UV_TEST_PYTHON_PATH)
|
||||
.unwrap_or(env::var_os(EnvVars::PATH).unwrap_or_default());
|
||||
|
||||
let version_request = version.unwrap_or(&VersionRequest::Default);
|
||||
let possible_names: Vec<_> = version_request
|
||||
|
|
|
@ -17,6 +17,7 @@ use uv_distribution_filename::{ExtensionError, SourceDistExtension};
|
|||
use uv_extract::hash::Hasher;
|
||||
use uv_fs::{rename_with_retry, Simplified};
|
||||
use uv_pypi_types::{HashAlgorithm, HashDigest};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::implementation::{
|
||||
Error as ImplementationError, ImplementationName, LenientImplementationName,
|
||||
|
@ -580,11 +581,11 @@ impl ManagedPythonDownload {
|
|||
fn download_url(&self) -> Result<Url, Error> {
|
||||
match self.key.implementation {
|
||||
LenientImplementationName::Known(ImplementationName::CPython) => {
|
||||
if let Ok(mirror) = std::env::var("UV_PYTHON_INSTALL_MIRROR") {
|
||||
if let Ok(mirror) = std::env::var(EnvVars::UV_PYTHON_INSTALL_MIRROR) {
|
||||
let Some(suffix) = self.url.strip_prefix(
|
||||
"https://github.com/indygreg/python-build-standalone/releases/download/",
|
||||
) else {
|
||||
return Err(Error::Mirror("UV_PYTHON_INSTALL_MIRROR", self.url));
|
||||
return Err(Error::Mirror(EnvVars::UV_PYTHON_INSTALL_MIRROR, self.url));
|
||||
};
|
||||
return Ok(Url::parse(
|
||||
format!("{}/{}", mirror.trim_end_matches('/'), suffix).as_str(),
|
||||
|
@ -593,10 +594,10 @@ impl ManagedPythonDownload {
|
|||
}
|
||||
|
||||
LenientImplementationName::Known(ImplementationName::PyPy) => {
|
||||
if let Ok(mirror) = std::env::var("UV_PYPY_INSTALL_MIRROR") {
|
||||
if let Ok(mirror) = std::env::var(EnvVars::UV_PYPY_INSTALL_MIRROR) {
|
||||
let Some(suffix) = self.url.strip_prefix("https://downloads.python.org/pypy/")
|
||||
else {
|
||||
return Err(Error::Mirror("UV_PYPY_INSTALL_MIRROR", self.url));
|
||||
return Err(Error::Mirror(EnvVars::UV_PYPY_INSTALL_MIRROR, self.url));
|
||||
};
|
||||
return Ok(Url::parse(
|
||||
format!("{}/{}", mirror.trim_end_matches('/'), suffix).as_str(),
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
//! Find requested Python interpreters and query interpreters for information.
|
||||
use thiserror::Error;
|
||||
|
||||
#[cfg(test)]
|
||||
use uv_static::EnvVars;
|
||||
|
||||
pub use crate::discovery::{
|
||||
find_python_installations, EnvironmentPreference, Error as DiscoveryError, PythonDownloads,
|
||||
PythonNotFound, PythonPreference, PythonRequest, PythonSource, PythonVariant, VersionRequest,
|
||||
|
@ -45,7 +48,7 @@ pub(crate) fn current_dir() -> Result<std::path::PathBuf, std::io::Error> {
|
|||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn current_dir() -> Result<std::path::PathBuf, std::io::Error> {
|
||||
std::env::var_os("PWD")
|
||||
std::env::var_os(EnvVars::PWD)
|
||||
.map(std::path::PathBuf::from)
|
||||
.map(Ok)
|
||||
.unwrap_or(std::env::current_dir())
|
||||
|
|
|
@ -22,6 +22,7 @@ use crate::platform::{Arch, Libc, Os};
|
|||
use crate::python_version::PythonVersion;
|
||||
use crate::{PythonRequest, PythonVariant};
|
||||
use uv_fs::{LockedFile, Simplified};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum Error {
|
||||
|
@ -80,7 +81,7 @@ impl ManagedPythonInstallations {
|
|||
/// 2. A directory in the system-appropriate user-level data directory, e.g., `~/.local/uv/python`
|
||||
/// 3. A directory in the local data directory, e.g., `./.uv/python`
|
||||
pub fn from_settings() -> Result<Self, Error> {
|
||||
if let Some(install_dir) = std::env::var_os("UV_PYTHON_INSTALL_DIR") {
|
||||
if let Some(install_dir) = std::env::var_os(EnvVars::UV_PYTHON_INSTALL_DIR) {
|
||||
Ok(Self::from_path(install_dir))
|
||||
} else {
|
||||
Ok(Self::from_path(
|
||||
|
|
|
@ -10,6 +10,7 @@ use std::env;
|
|||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use tracing::debug;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct MicrosoftStorePython {
|
||||
|
@ -91,7 +92,7 @@ const MICROSOFT_STORE_PYTHONS: &[MicrosoftStorePython] = &[
|
|||
///
|
||||
/// Effectively a port of <https://github.com/python/cpython/blob/58ce131037ecb34d506a613f21993cde2056f628/PC/launcher2.c#L1744>
|
||||
pub(crate) fn find_microsoft_store_pythons() -> impl Iterator<Item = WindowsPython> {
|
||||
let Ok(local_app_data) = env::var("LOCALAPPDATA") else {
|
||||
let Ok(local_app_data) = env::var(EnvVars::LOCALAPPDATA) else {
|
||||
debug!("`LOCALAPPDATA` not set, ignoring Microsoft store Pythons");
|
||||
return Either::Left(std::iter::empty());
|
||||
};
|
||||
|
|
|
@ -10,6 +10,7 @@ use assert_fs::{fixture::ChildPath, prelude::*, TempDir};
|
|||
use indoc::{formatdoc, indoc};
|
||||
use temp_env::with_vars;
|
||||
use test_log::test;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use uv_cache::Cache;
|
||||
|
||||
|
@ -85,13 +86,13 @@ impl TestContext {
|
|||
|
||||
let mut run_vars = vec![
|
||||
// Ensure `PATH` is used
|
||||
("UV_TEST_PYTHON_PATH", None),
|
||||
(EnvVars::UV_TEST_PYTHON_PATH, None),
|
||||
// Ignore active virtual environments (i.e. that the dev is using)
|
||||
("VIRTUAL_ENV", None),
|
||||
("PATH", path.as_deref()),
|
||||
(EnvVars::VIRTUAL_ENV, None),
|
||||
(EnvVars::PATH, path.as_deref()),
|
||||
// Use the temporary python directory
|
||||
(
|
||||
"UV_PYTHON_INSTALL_DIR",
|
||||
EnvVars::UV_PYTHON_INSTALL_DIR,
|
||||
Some(self.installations.root().as_os_str()),
|
||||
),
|
||||
// Set a working directory
|
||||
|
@ -817,7 +818,8 @@ fn find_best_python_skips_source_without_match() -> Result<()> {
|
|||
TestContext::mock_venv(&venv, "3.12.0")?;
|
||||
context.add_python_versions(&["3.10.1"])?;
|
||||
|
||||
let python = context.run_with_vars(&[("VIRTUAL_ENV", Some(venv.as_os_str()))], || {
|
||||
let python =
|
||||
context.run_with_vars(&[(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str()))], || {
|
||||
find_best_python_installation(
|
||||
&PythonRequest::parse("3.10"),
|
||||
EnvironmentPreference::Any,
|
||||
|
@ -846,7 +848,8 @@ fn find_best_python_returns_to_earlier_source_on_fallback() -> Result<()> {
|
|||
TestContext::mock_venv(&venv, "3.10.1")?;
|
||||
context.add_python_versions(&["3.10.3"])?;
|
||||
|
||||
let python = context.run_with_vars(&[("VIRTUAL_ENV", Some(venv.as_os_str()))], || {
|
||||
let python =
|
||||
context.run_with_vars(&[(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str()))], || {
|
||||
find_best_python_installation(
|
||||
&PythonRequest::parse("3.10.2"),
|
||||
EnvironmentPreference::Any,
|
||||
|
@ -879,7 +882,8 @@ fn find_python_from_active_python() -> Result<()> {
|
|||
let venv = context.tempdir.child("some-venv");
|
||||
TestContext::mock_venv(&venv, "3.12.0")?;
|
||||
|
||||
let python = context.run_with_vars(&[("VIRTUAL_ENV", Some(venv.as_os_str()))], || {
|
||||
let python =
|
||||
context.run_with_vars(&[(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str()))], || {
|
||||
find_python_installation(
|
||||
&PythonRequest::Default,
|
||||
EnvironmentPreference::Any,
|
||||
|
@ -903,7 +907,8 @@ fn find_python_from_active_python_prerelease() -> Result<()> {
|
|||
let venv = context.tempdir.child("some-venv");
|
||||
TestContext::mock_venv(&venv, "3.13.0rc1")?;
|
||||
|
||||
let python = context.run_with_vars(&[("VIRTUAL_ENV", Some(venv.as_os_str()))], || {
|
||||
let python =
|
||||
context.run_with_vars(&[(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str()))], || {
|
||||
find_python_installation(
|
||||
&PythonRequest::Default,
|
||||
EnvironmentPreference::Any,
|
||||
|
@ -926,8 +931,9 @@ fn find_python_from_conda_prefix() -> Result<()> {
|
|||
let condaenv = context.tempdir.child("condaenv");
|
||||
TestContext::mock_conda_prefix(&condaenv, "3.12.0")?;
|
||||
|
||||
let python =
|
||||
context.run_with_vars(&[("CONDA_PREFIX", Some(condaenv.as_os_str()))], || {
|
||||
let python = context.run_with_vars(
|
||||
&[(EnvVars::CONDA_PREFIX, Some(condaenv.as_os_str()))],
|
||||
|| {
|
||||
// Note this python is not treated as a system interpreter
|
||||
find_python_installation(
|
||||
&PythonRequest::Default,
|
||||
|
@ -935,7 +941,8 @@ fn find_python_from_conda_prefix() -> Result<()> {
|
|||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
)
|
||||
})??;
|
||||
},
|
||||
)??;
|
||||
assert_eq!(
|
||||
python.interpreter().python_full_version().to_string(),
|
||||
"3.12.0",
|
||||
|
@ -955,8 +962,8 @@ fn find_python_from_conda_prefix_and_virtualenv() -> Result<()> {
|
|||
|
||||
let python = context.run_with_vars(
|
||||
&[
|
||||
("VIRTUAL_ENV", Some(venv.as_os_str())),
|
||||
("CONDA_PREFIX", Some(condaenv.as_os_str())),
|
||||
(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str())),
|
||||
(EnvVars::CONDA_PREFIX, Some(condaenv.as_os_str())),
|
||||
],
|
||||
|| {
|
||||
find_python_installation(
|
||||
|
@ -976,15 +983,17 @@ fn find_python_from_conda_prefix_and_virtualenv() -> Result<()> {
|
|||
// Put a virtual environment in the working directory
|
||||
let venv = context.workdir.child(".venv");
|
||||
TestContext::mock_venv(venv, "3.12.2")?;
|
||||
let python =
|
||||
context.run_with_vars(&[("CONDA_PREFIX", Some(condaenv.as_os_str()))], || {
|
||||
let python = context.run_with_vars(
|
||||
&[(EnvVars::CONDA_PREFIX, Some(condaenv.as_os_str()))],
|
||||
|| {
|
||||
find_python_installation(
|
||||
&PythonRequest::Default,
|
||||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
)
|
||||
})??;
|
||||
},
|
||||
)??;
|
||||
assert_eq!(
|
||||
python.interpreter().python_full_version().to_string(),
|
||||
"3.12.1",
|
||||
|
@ -1046,7 +1055,8 @@ fn find_python_skips_broken_active_python() -> Result<()> {
|
|||
// Delete the pyvenv cfg to break the virtualenv
|
||||
fs_err::remove_file(venv.join("pyvenv.cfg"))?;
|
||||
|
||||
let python = context.run_with_vars(&[("VIRTUAL_ENV", Some(venv.as_os_str()))], || {
|
||||
let python =
|
||||
context.run_with_vars(&[(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str()))], || {
|
||||
find_python_installation(
|
||||
&PythonRequest::Default,
|
||||
EnvironmentPreference::Any,
|
||||
|
@ -1079,7 +1089,10 @@ fn find_python_from_parent_interpreter() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let python = context.run_with_vars(
|
||||
&[("UV_INTERNAL__PARENT_INTERPRETER", Some(parent.as_os_str()))],
|
||||
&[(
|
||||
EnvVars::UV_INTERNAL__PARENT_INTERPRETER,
|
||||
Some(parent.as_os_str()),
|
||||
)],
|
||||
|| {
|
||||
find_python_installation(
|
||||
&PythonRequest::Default,
|
||||
|
@ -1101,8 +1114,11 @@ fn find_python_from_parent_interpreter() -> Result<()> {
|
|||
context.add_python_versions(&["3.12.3"])?;
|
||||
let python = context.run_with_vars(
|
||||
&[
|
||||
("UV_INTERNAL__PARENT_INTERPRETER", Some(parent.as_os_str())),
|
||||
("VIRTUAL_ENV", Some(venv.as_os_str())),
|
||||
(
|
||||
EnvVars::UV_INTERNAL__PARENT_INTERPRETER,
|
||||
Some(parent.as_os_str()),
|
||||
),
|
||||
(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str())),
|
||||
],
|
||||
|| {
|
||||
find_python_installation(
|
||||
|
@ -1122,8 +1138,11 @@ fn find_python_from_parent_interpreter() -> Result<()> {
|
|||
// Test with `EnvironmentPreference::ExplicitSystem`
|
||||
let python = context.run_with_vars(
|
||||
&[
|
||||
("UV_INTERNAL__PARENT_INTERPRETER", Some(parent.as_os_str())),
|
||||
("VIRTUAL_ENV", Some(venv.as_os_str())),
|
||||
(
|
||||
EnvVars::UV_INTERNAL__PARENT_INTERPRETER,
|
||||
Some(parent.as_os_str()),
|
||||
),
|
||||
(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str())),
|
||||
],
|
||||
|| {
|
||||
find_python_installation(
|
||||
|
@ -1143,8 +1162,11 @@ fn find_python_from_parent_interpreter() -> Result<()> {
|
|||
// Test with `EnvironmentPreference::OnlySystem`
|
||||
let python = context.run_with_vars(
|
||||
&[
|
||||
("UV_INTERNAL__PARENT_INTERPRETER", Some(parent.as_os_str())),
|
||||
("VIRTUAL_ENV", Some(venv.as_os_str())),
|
||||
(
|
||||
EnvVars::UV_INTERNAL__PARENT_INTERPRETER,
|
||||
Some(parent.as_os_str()),
|
||||
),
|
||||
(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str())),
|
||||
],
|
||||
|| {
|
||||
find_python_installation(
|
||||
|
@ -1164,8 +1186,11 @@ fn find_python_from_parent_interpreter() -> Result<()> {
|
|||
// Test with `EnvironmentPreference::OnlyVirtual`
|
||||
let python = context.run_with_vars(
|
||||
&[
|
||||
("UV_INTERNAL__PARENT_INTERPRETER", Some(parent.as_os_str())),
|
||||
("VIRTUAL_ENV", Some(venv.as_os_str())),
|
||||
(
|
||||
EnvVars::UV_INTERNAL__PARENT_INTERPRETER,
|
||||
Some(parent.as_os_str()),
|
||||
),
|
||||
(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str())),
|
||||
],
|
||||
|| {
|
||||
find_python_installation(
|
||||
|
@ -1200,7 +1225,10 @@ fn find_python_from_parent_interpreter_prerelease() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let python = context.run_with_vars(
|
||||
&[("UV_INTERNAL__PARENT_INTERPRETER", Some(parent.as_os_str()))],
|
||||
&[(
|
||||
EnvVars::UV_INTERNAL__PARENT_INTERPRETER,
|
||||
Some(parent.as_os_str()),
|
||||
)],
|
||||
|| {
|
||||
find_python_installation(
|
||||
&PythonRequest::Default,
|
||||
|
@ -1227,7 +1255,8 @@ fn find_python_active_python_skipped_if_system_required() -> Result<()> {
|
|||
context.add_python_versions(&["3.10.0", "3.11.1", "3.12.2"])?;
|
||||
|
||||
// Without a specific request
|
||||
let python = context.run_with_vars(&[("VIRTUAL_ENV", Some(venv.as_os_str()))], || {
|
||||
let python =
|
||||
context.run_with_vars(&[(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str()))], || {
|
||||
find_python_installation(
|
||||
&PythonRequest::Default,
|
||||
EnvironmentPreference::OnlySystem,
|
||||
|
@ -1242,7 +1271,8 @@ fn find_python_active_python_skipped_if_system_required() -> Result<()> {
|
|||
);
|
||||
|
||||
// With a requested minor version
|
||||
let python = context.run_with_vars(&[("VIRTUAL_ENV", Some(venv.as_os_str()))], || {
|
||||
let python =
|
||||
context.run_with_vars(&[(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str()))], || {
|
||||
find_python_installation(
|
||||
&PythonRequest::parse("3.12"),
|
||||
EnvironmentPreference::OnlySystem,
|
||||
|
@ -1257,7 +1287,8 @@ fn find_python_active_python_skipped_if_system_required() -> Result<()> {
|
|||
);
|
||||
|
||||
// With a patch version that cannot be python
|
||||
let result = context.run_with_vars(&[("VIRTUAL_ENV", Some(venv.as_os_str()))], || {
|
||||
let result =
|
||||
context.run_with_vars(&[(EnvVars::VIRTUAL_ENV, Some(venv.as_os_str()))], || {
|
||||
find_python_installation(
|
||||
&PythonRequest::parse("3.12.3"),
|
||||
EnvironmentPreference::OnlySystem,
|
||||
|
@ -1293,7 +1324,7 @@ fn find_python_fails_if_no_virtualenv_and_system_not_allowed() -> Result<()> {
|
|||
|
||||
// With an invalid virtual environment variable
|
||||
let result = context.run_with_vars(
|
||||
&[("VIRTUAL_ENV", Some(context.tempdir.as_os_str()))],
|
||||
&[(EnvVars::VIRTUAL_ENV, Some(context.tempdir.as_os_str()))],
|
||||
|| {
|
||||
find_python_installation(
|
||||
&PythonRequest::parse("3.12.3"),
|
||||
|
@ -1536,15 +1567,17 @@ fn find_python_allows_venv_directory_path() -> Result<()> {
|
|||
let other_venv = context.tempdir.child("foobar").child(".venv");
|
||||
TestContext::mock_venv(&other_venv, "3.11.1")?;
|
||||
context.add_python_versions(&["3.12.2"])?;
|
||||
let python =
|
||||
context.run_with_vars(&[("VIRTUAL_ENV", Some(other_venv.as_os_str()))], || {
|
||||
let python = context.run_with_vars(
|
||||
&[(EnvVars::VIRTUAL_ENV, Some(other_venv.as_os_str()))],
|
||||
|| {
|
||||
find_python_installation(
|
||||
&PythonRequest::parse(venv.to_str().unwrap()),
|
||||
EnvironmentPreference::Any,
|
||||
PythonPreference::OnlySystem,
|
||||
&context.cache,
|
||||
)
|
||||
})??;
|
||||
},
|
||||
)??;
|
||||
assert_eq!(
|
||||
python.interpreter().python_full_version().to_string(),
|
||||
"3.10.0",
|
||||
|
|
|
@ -6,6 +6,7 @@ use std::{
|
|||
use fs_err as fs;
|
||||
use thiserror::Error;
|
||||
use uv_pypi_types::Scheme;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
/// The layout of a virtual environment.
|
||||
#[derive(Debug)]
|
||||
|
@ -49,7 +50,7 @@ pub enum Error {
|
|||
///
|
||||
/// Supports `VIRTUAL_ENV`.
|
||||
pub(crate) fn virtualenv_from_env() -> Option<PathBuf> {
|
||||
if let Some(dir) = env::var_os("VIRTUAL_ENV").filter(|value| !value.is_empty()) {
|
||||
if let Some(dir) = env::var_os(EnvVars::VIRTUAL_ENV).filter(|value| !value.is_empty()) {
|
||||
return Some(PathBuf::from(dir));
|
||||
}
|
||||
|
||||
|
@ -60,7 +61,7 @@ pub(crate) fn virtualenv_from_env() -> Option<PathBuf> {
|
|||
///
|
||||
/// Supports `CONDA_PREFIX`.
|
||||
pub(crate) fn conda_prefix_from_env() -> Option<PathBuf> {
|
||||
if let Some(dir) = env::var_os("CONDA_PREFIX").filter(|value| !value.is_empty()) {
|
||||
if let Some(dir) = env::var_os(EnvVars::CONDA_PREFIX).filter(|value| !value.is_empty()) {
|
||||
return Some(PathBuf::from(dir));
|
||||
}
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@ uv-pubgrub = { workspace = true }
|
|||
uv-pypi-types = { workspace = true }
|
||||
uv-python = { workspace = true }
|
||||
uv-requirements-txt = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
uv-types = { workspace = true }
|
||||
uv-warnings = { workspace = true }
|
||||
uv-workspace = { workspace = true }
|
||||
|
|
|
@ -6,12 +6,6 @@ use indexmap::IndexSet;
|
|||
use pubgrub::{DefaultStringReporter, DerivationTree, Derived, External, Range, Reporter};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use tracing::trace;
|
||||
use uv_distribution_types::{BuiltDist, IndexLocations, IndexUrl, InstalledDist, SourceDist};
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pep440::Version;
|
||||
use uv_pep508::MarkerTree;
|
||||
|
||||
use crate::candidate_selector::CandidateSelector;
|
||||
use crate::dependency_provider::UvDependencyProvider;
|
||||
use crate::fork_urls::ForkUrls;
|
||||
|
@ -21,6 +15,12 @@ use crate::pubgrub::{
|
|||
use crate::python_requirement::PythonRequirement;
|
||||
use crate::resolution::ConflictingDistributionError;
|
||||
use crate::resolver::{IncompletePackage, ResolverMarkers, UnavailablePackage, UnavailableReason};
|
||||
use tracing::trace;
|
||||
use uv_distribution_types::{BuiltDist, IndexLocations, IndexUrl, InstalledDist, SourceDist};
|
||||
use uv_normalize::PackageName;
|
||||
use uv_pep440::Version;
|
||||
use uv_pep508::MarkerTree;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum ResolveError {
|
||||
|
@ -213,7 +213,8 @@ impl std::fmt::Display for NoSolutionError {
|
|||
// Transform the error tree for reporting
|
||||
let mut tree = self.error.clone();
|
||||
simplify_derivation_tree_markers(&self.python_requirement, &mut tree);
|
||||
let should_display_tree = std::env::var_os("UV_INTERNAL__SHOW_DERIVATION_TREE").is_some()
|
||||
let should_display_tree = std::env::var_os(EnvVars::UV_INTERNAL__SHOW_DERIVATION_TREE)
|
||||
.is_some()
|
||||
|| tracing::enabled!(tracing::Level::TRACE);
|
||||
|
||||
if should_display_tree {
|
||||
|
@ -268,7 +269,7 @@ fn display_tree(
|
|||
display_tree_inner(error, &mut lines, 0);
|
||||
lines.reverse();
|
||||
|
||||
if std::env::var_os("UV_INTERNAL__SHOW_DERIVATION_TREE").is_some() {
|
||||
if std::env::var_os(EnvVars::UV_INTERNAL__SHOW_DERIVATION_TREE).is_some() {
|
||||
eprintln!("{name}\n{}", lines.join("\n"));
|
||||
} else {
|
||||
trace!("{name}\n{}", lines.join("\n"));
|
||||
|
|
|
@ -28,6 +28,7 @@ uv-pep508 = { workspace = true }
|
|||
uv-pypi-types = { workspace = true }
|
||||
uv-python = { workspace = true, features = ["schemars", "clap"] }
|
||||
uv-resolver = { workspace = true, features = ["schemars", "clap"] }
|
||||
uv-static = { workspace = true }
|
||||
uv-warnings = { workspace = true }
|
||||
|
||||
clap = { workspace = true }
|
||||
|
|
|
@ -4,6 +4,8 @@ use std::path::{Path, PathBuf};
|
|||
use tracing::debug;
|
||||
|
||||
use uv_fs::Simplified;
|
||||
#[cfg(not(windows))]
|
||||
use uv_static::EnvVars;
|
||||
use uv_warnings::warn_user;
|
||||
|
||||
pub use crate::combine::*;
|
||||
|
@ -179,7 +181,7 @@ fn config_dir() -> Option<PathBuf> {
|
|||
// On Linux and macOS, use, e.g., /home/alice/.config.
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
std::env::var_os("XDG_CONFIG_HOME")
|
||||
std::env::var_os(EnvVars::XDG_CONFIG_HOME)
|
||||
.and_then(dirs_sys::is_absolute_path)
|
||||
.or_else(|| dirs_sys::home_dir().map(|path| path.join(".config")))
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ workspace = true
|
|||
|
||||
[dependencies]
|
||||
uv-fs = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
home = { workspace = true }
|
||||
|
|
|
@ -2,6 +2,7 @@ pub mod windows;
|
|||
|
||||
use std::path::{Path, PathBuf};
|
||||
use uv_fs::Simplified;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
/// Shells for which virtualenv activation scripts are available.
|
||||
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
|
||||
|
@ -37,22 +38,22 @@ impl Shell {
|
|||
/// If `SHELL` is set, but contains a value that doesn't correspond to one of the supported
|
||||
/// shell types, then return `None`.
|
||||
pub fn from_env() -> Option<Shell> {
|
||||
if std::env::var_os("NU_VERSION").is_some() {
|
||||
if std::env::var_os(EnvVars::NU_VERSION).is_some() {
|
||||
Some(Shell::Nushell)
|
||||
} else if std::env::var_os("FISH_VERSION").is_some() {
|
||||
} else if std::env::var_os(EnvVars::FISH_VERSION).is_some() {
|
||||
Some(Shell::Fish)
|
||||
} else if std::env::var_os("BASH_VERSION").is_some() {
|
||||
} else if std::env::var_os(EnvVars::BASH_VERSION).is_some() {
|
||||
Some(Shell::Bash)
|
||||
} else if std::env::var_os("ZSH_VERSION").is_some() {
|
||||
} else if std::env::var_os(EnvVars::ZSH_VERSION).is_some() {
|
||||
Some(Shell::Zsh)
|
||||
} else if std::env::var_os("KSH_VERSION").is_some() {
|
||||
} else if std::env::var_os(EnvVars::KSH_VERSION).is_some() {
|
||||
Some(Shell::Ksh)
|
||||
} else if let Some(env_shell) = std::env::var_os("SHELL") {
|
||||
} else if let Some(env_shell) = std::env::var_os(EnvVars::SHELL) {
|
||||
Shell::from_shell_path(env_shell)
|
||||
} else if cfg!(windows) {
|
||||
// Command Prompt relies on PROMPT for its appearance whereas PowerShell does not.
|
||||
// See: https://stackoverflow.com/a/66415037.
|
||||
if std::env::var_os("PROMPT").is_some() {
|
||||
if std::env::var_os(EnvVars::PROMPT).is_some() {
|
||||
Some(Shell::Cmd)
|
||||
} else {
|
||||
// Fallback to PowerShell if the PROMPT environment variable is not set.
|
||||
|
@ -113,7 +114,7 @@ impl Shell {
|
|||
// `.zshenv` to use.
|
||||
//
|
||||
// See: https://github.com/rust-lang/rustup/blob/fede22fea7b160868cece632bd213e6d72f8912f/src/cli/self_update/shell.rs#L197
|
||||
let zsh_dot_dir = std::env::var("ZDOTDIR")
|
||||
let zsh_dot_dir = std::env::var(EnvVars::ZDOTDIR)
|
||||
.ok()
|
||||
.filter(|dir| !dir.is_empty())
|
||||
.map(PathBuf::from);
|
||||
|
@ -146,7 +147,7 @@ impl Shell {
|
|||
// login and non-login shells. However, we must respect Fish's logic, which reads
|
||||
// from `$XDG_CONFIG_HOME/fish/config.fish` if set, and `~/.config/fish/config.fish`
|
||||
// otherwise.
|
||||
if let Some(xdg_home_dir) = std::env::var("XDG_CONFIG_HOME")
|
||||
if let Some(xdg_home_dir) = std::env::var(EnvVars::XDG_CONFIG_HOME)
|
||||
.ok()
|
||||
.filter(|dir| !dir.is_empty())
|
||||
.map(PathBuf::from)
|
||||
|
@ -172,7 +173,7 @@ impl Shell {
|
|||
/// Returns `true` if the given path is on the `PATH` in this shell.
|
||||
pub fn contains_path(path: &Path) -> bool {
|
||||
let home_dir = home::home_dir();
|
||||
std::env::var_os("PATH")
|
||||
std::env::var_os(EnvVars::PATH)
|
||||
.as_ref()
|
||||
.iter()
|
||||
.flat_map(std::env::split_paths)
|
||||
|
|
|
@ -11,6 +11,7 @@ use std::path::Path;
|
|||
use std::slice;
|
||||
|
||||
use anyhow::Context;
|
||||
use uv_static::EnvVars;
|
||||
use winreg::enums::{RegType, HKEY_CURRENT_USER, KEY_READ, KEY_WRITE};
|
||||
use winreg::{RegKey, RegValue};
|
||||
|
||||
|
@ -44,13 +45,13 @@ fn apply_windows_path_var(path: Vec<u16>) -> anyhow::Result<()> {
|
|||
let environment = root.open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE)?;
|
||||
|
||||
if path.is_empty() {
|
||||
environment.delete_value("PATH")?;
|
||||
environment.delete_value(EnvVars::PATH)?;
|
||||
} else {
|
||||
let reg_value = RegValue {
|
||||
bytes: to_winreg_bytes(path),
|
||||
vtype: RegType::REG_EXPAND_SZ,
|
||||
};
|
||||
environment.set_raw_value("PATH", ®_value)?;
|
||||
environment.set_raw_value(EnvVars::PATH, ®_value)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -65,7 +66,7 @@ fn get_windows_path_var() -> anyhow::Result<Option<Vec<u16>>> {
|
|||
.open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE)
|
||||
.context("Failed to open `Environment` key")?;
|
||||
|
||||
let reg_value = environment.get_raw_value("PATH");
|
||||
let reg_value = environment.get_raw_value(EnvVars::PATH);
|
||||
match reg_value {
|
||||
Ok(reg_value) => {
|
||||
if let Some(reg_value) = from_winreg_value(®_value) {
|
||||
|
|
18
crates/uv-static/Cargo.toml
Normal file
18
crates/uv-static/Cargo.toml
Normal file
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
name = "uv-static"
|
||||
version = "0.0.1"
|
||||
edition = { workspace = true }
|
||||
rust-version = { workspace = true }
|
||||
homepage = { workspace = true }
|
||||
documentation = { workspace = true }
|
||||
repository = { workspace = true }
|
||||
authors = { workspace = true }
|
||||
license = { workspace = true }
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
354
crates/uv-static/src/env_vars.rs
Normal file
354
crates/uv-static/src/env_vars.rs
Normal file
|
@ -0,0 +1,354 @@
|
|||
/// Declares all environment variable used throughout `uv` and its crates.
|
||||
pub struct EnvVars;
|
||||
|
||||
impl EnvVars {
|
||||
/// Equivalent to the `--index-url` argument. Base index URL for searching packages.
|
||||
pub const UV_INDEX_URL: &'static str = "UV_INDEX_URL";
|
||||
|
||||
/// Equivalent to the `--extra-index-url` argument. Additional indexes for searching packages.
|
||||
pub const UV_EXTRA_INDEX_URL: &'static str = "UV_EXTRA_INDEX_URL";
|
||||
|
||||
/// Equivalent to the `--find-links` argument. Additional package search locations.
|
||||
pub const UV_FIND_LINKS: &'static str = "UV_FIND_LINKS";
|
||||
|
||||
/// Equivalent to the `--cache-dir` argument. Custom directory for caching.
|
||||
pub const UV_CACHE_DIR: &'static str = "UV_CACHE_DIR";
|
||||
|
||||
/// Equivalent to the `--no-cache` argument. Disables cache usage.
|
||||
pub const UV_NO_CACHE: &'static str = "UV_NO_CACHE";
|
||||
|
||||
/// Equivalent to the `--resolution` argument. Controls dependency resolution strategy.
|
||||
pub const UV_RESOLUTION: &'static str = "UV_RESOLUTION";
|
||||
|
||||
/// Equivalent to the `--prerelease` argument. Allows or disallows pre-release versions.
|
||||
pub const UV_PRERELEASE: &'static str = "UV_PRERELEASE";
|
||||
|
||||
/// Equivalent to the `--system` argument. Use system Python interpreter.
|
||||
pub const UV_SYSTEM_PYTHON: &'static str = "UV_SYSTEM_PYTHON";
|
||||
|
||||
/// Equivalent to the `--python` argument. Path to a specific Python interpreter.
|
||||
pub const UV_PYTHON: &'static str = "UV_PYTHON";
|
||||
|
||||
/// Equivalent to the `--break-system-packages` argument. Allows breaking system packages.
|
||||
pub const UV_BREAK_SYSTEM_PACKAGES: &'static str = "UV_BREAK_SYSTEM_PACKAGES";
|
||||
|
||||
/// Equivalent to the `--native-tls` argument. Uses system's trust store for TLS.
|
||||
pub const UV_NATIVE_TLS: &'static str = "UV_NATIVE_TLS";
|
||||
|
||||
/// Equivalent to the `--index-strategy` argument. Defines strategy for searching index URLs.
|
||||
pub const UV_INDEX_STRATEGY: &'static str = "UV_INDEX_STRATEGY";
|
||||
|
||||
/// Equivalent to the `--require-hashes` argument. Requires hashes for all dependencies.
|
||||
pub const UV_REQUIRE_HASHES: &'static str = "UV_REQUIRE_HASHES";
|
||||
|
||||
/// Equivalent to the `--constraint` argument. Path to constraints file.
|
||||
pub const UV_CONSTRAINT: &'static str = "UV_CONSTRAINT";
|
||||
|
||||
/// Equivalent to the `--build-constraint` argument. Path to build constraints file.
|
||||
pub const UV_BUILD_CONSTRAINT: &'static str = "UV_BUILD_CONSTRAINT";
|
||||
|
||||
/// Equivalent to the `--override` argument. Path to overrides file.
|
||||
pub const UV_OVERRIDE: &'static str = "UV_OVERRIDE";
|
||||
|
||||
/// Equivalent to the `--link-mode` argument. Specifies link mode for the installation.
|
||||
pub const UV_LINK_MODE: &'static str = "UV_LINK_MODE";
|
||||
|
||||
/// Equivalent to the `--no-build-isolation` argument. Skips build isolation.
|
||||
pub const UV_NO_BUILD_ISOLATION: &'static str = "UV_NO_BUILD_ISOLATION";
|
||||
|
||||
/// Equivalent to the `--custom-compile-command` argument. Overrides the command in `requirements.txt`.
|
||||
pub const UV_CUSTOM_COMPILE_COMMAND: &'static str = "UV_CUSTOM_COMPILE_COMMAND";
|
||||
|
||||
/// Equivalent to the `--keyring-provider` argument. Specifies keyring provider.
|
||||
pub const UV_KEYRING_PROVIDER: &'static str = "UV_KEYRING_PROVIDER";
|
||||
|
||||
/// Equivalent to the `--config-file` argument. Path to configuration file.
|
||||
pub const UV_CONFIG_FILE: &'static str = "UV_CONFIG_FILE";
|
||||
|
||||
/// Equivalent to the `--no-config` argument. Prevents reading configuration files.
|
||||
pub const UV_NO_CONFIG: &'static str = "UV_NO_CONFIG";
|
||||
|
||||
/// Equivalent to the `--exclude-newer` argument. Excludes newer distributions after a date.
|
||||
pub const UV_EXCLUDE_NEWER: &'static str = "UV_EXCLUDE_NEWER";
|
||||
|
||||
/// Equivalent to the `--python-preference` argument. Controls preference for Python versions.
|
||||
pub const UV_PYTHON_PREFERENCE: &'static str = "UV_PYTHON_PREFERENCE";
|
||||
|
||||
/// Equivalent to the `--no-python-downloads` argument. Disables Python downloads.
|
||||
pub const UV_PYTHON_DOWNLOADS: &'static str = "UV_PYTHON_DOWNLOADS";
|
||||
|
||||
/// Equivalent to the `--compile-bytecode` argument. Compiles Python source to bytecode.
|
||||
pub const UV_COMPILE_BYTECODE: &'static str = "UV_COMPILE_BYTECODE";
|
||||
|
||||
/// Equivalent to the `--publish-url` argument. URL for publishing packages.
|
||||
pub const UV_PUBLISH_URL: &'static str = "UV_PUBLISH_URL";
|
||||
|
||||
/// Equivalent to the `--token` argument in `uv publish`. Token for publishing.
|
||||
pub const UV_PUBLISH_TOKEN: &'static str = "UV_PUBLISH_TOKEN";
|
||||
|
||||
/// Equivalent to the `--username` argument in `uv publish`. Username for publishing.
|
||||
pub const UV_PUBLISH_USERNAME: &'static str = "UV_PUBLISH_USERNAME";
|
||||
|
||||
/// Equivalent to the `--password` argument in `uv publish`. Password for publishing.
|
||||
pub const UV_PUBLISH_PASSWORD: &'static str = "UV_PUBLISH_PASSWORD";
|
||||
|
||||
/// Equivalent to the `--no-sync` argument. Skips syncing the environment.
|
||||
pub const UV_NO_SYNC: &'static str = "UV_NO_SYNC";
|
||||
|
||||
/// Equivalent to the `--preview` argument. Enables preview mode.
|
||||
pub const UV_PREVIEW: &'static str = "UV_PREVIEW";
|
||||
|
||||
/// Equivalent to the `--token` argument for self update. A GitHub token for authentication.
|
||||
pub const UV_GITHUB_TOKEN: &'static str = "UV_GITHUB_TOKEN";
|
||||
|
||||
/// Equivalent to the `--verify-hashes` argument. Verifies included hashes.
|
||||
pub const UV_VERIFY_HASHES: &'static str = "UV_VERIFY_HASHES";
|
||||
|
||||
/// Equivalent to the `--allow-insecure-host` argument.
|
||||
pub const UV_INSECURE_HOST: &'static str = "UV_INSECURE_HOST";
|
||||
|
||||
/// Sets the maximum number of in-flight concurrent downloads.
|
||||
pub const UV_CONCURRENT_DOWNLOADS: &'static str = "UV_CONCURRENT_DOWNLOADS";
|
||||
|
||||
/// Sets the maximum number of concurrent builds for source distributions.
|
||||
pub const UV_CONCURRENT_BUILDS: &'static str = "UV_CONCURRENT_BUILDS";
|
||||
|
||||
/// Controls the number of threads used for concurrent installations.
|
||||
pub const UV_CONCURRENT_INSTALLS: &'static str = "UV_CONCURRENT_INSTALLS";
|
||||
|
||||
/// Specifies the directory where `uv` stores managed tools.
|
||||
pub const UV_TOOL_DIR: &'static str = "UV_TOOL_DIR";
|
||||
|
||||
/// Specifies the "bin" directory for installing tool executables.
|
||||
pub const UV_TOOL_BIN_DIR: &'static str = "UV_TOOL_BIN_DIR";
|
||||
|
||||
/// Specifies the path to the project virtual environment.
|
||||
pub const UV_PROJECT_ENVIRONMENT: &'static str = "UV_PROJECT_ENVIRONMENT";
|
||||
|
||||
/// Specifies the directory for storing managed Python installations.
|
||||
pub const UV_PYTHON_INSTALL_DIR: &'static str = "UV_PYTHON_INSTALL_DIR";
|
||||
|
||||
/// Mirror URL for downloading managed Python installations.
|
||||
pub const UV_PYTHON_INSTALL_MIRROR: &'static str = "UV_PYTHON_INSTALL_MIRROR";
|
||||
|
||||
/// Mirror URL for downloading managed PyPy installations.
|
||||
pub const UV_PYPY_INSTALL_MIRROR: &'static str = "UV_PYPY_INSTALL_MIRROR";
|
||||
|
||||
/// Used to override `PATH` to limit Python executable availability in the test suite.
|
||||
pub const UV_TEST_PYTHON_PATH: &'static str = "UV_TEST_PYTHON_PATH";
|
||||
|
||||
/// Include resolver and installer output related to environment modifications.
|
||||
pub const UV_SHOW_RESOLUTION: &'static str = "UV_SHOW_RESOLUTION";
|
||||
|
||||
/// Use to update the json schema files.
|
||||
pub const UV_UPDATE_SCHEMA: &'static str = "UV_UPDATE_SCHEMA";
|
||||
|
||||
/// Use to disable line wrapping for diagnostics.
|
||||
pub const UV_NO_WRAP: &'static str = "UV_NO_WRAP";
|
||||
|
||||
/// Use to control the stack size used by uv. Typically more relevant for Windows in debug mode.
|
||||
pub const UV_STACK_SIZE: &'static str = "UV_STACK_SIZE";
|
||||
|
||||
/// Used to set the uv commit hash at build time via `build.rs`.
|
||||
pub const UV_COMMIT_HASH: &'static str = "UV_COMMIT_HASH";
|
||||
|
||||
/// Used to set the uv commit short hash at build time via `build.rs`.
|
||||
pub const UV_COMMIT_SHORT_HASH: &'static str = "UV_COMMIT_SHORT_HASH";
|
||||
|
||||
/// Used to set the uv commit date at build time via `build.rs`.
|
||||
pub const UV_COMMIT_DATE: &'static str = "UV_COMMIT_DATE";
|
||||
|
||||
/// Used to set the uv tag at build time via `build.rs`.
|
||||
pub const UV_LAST_TAG: &'static str = "UV_LAST_TAG";
|
||||
|
||||
/// Used to set the uv tag distance from head at build time via `build.rs`.
|
||||
pub const UV_LAST_TAG_DISTANCE: &'static str = "UV_LAST_TAG_DISTANCE";
|
||||
|
||||
/// Used to set the spawning/parent interpreter when using --system in the test suite.
|
||||
pub const UV_INTERNAL__PARENT_INTERPRETER: &'static str = "UV_INTERNAL__PARENT_INTERPRETER";
|
||||
|
||||
/// Used to force showing the derivation tree during resolver error reporting.
|
||||
pub const UV_INTERNAL__SHOW_DERIVATION_TREE: &'static str = "UV_INTERNAL__SHOW_DERIVATION_TREE";
|
||||
|
||||
/// Used to set a temporary directory for some tests.
|
||||
pub const UV_INTERNAL__TEST_DIR: &'static str = "UV_INTERNAL__TEST_DIR";
|
||||
|
||||
/// Path to user-level configuration directory on Unix systems.
|
||||
pub const XDG_CONFIG_HOME: &'static str = "XDG_CONFIG_HOME";
|
||||
|
||||
/// Path to cache directory on Unix systems.
|
||||
pub const XDG_CACHE_HOME: &'static str = "XDG_CACHE_HOME";
|
||||
|
||||
/// Path to directory for storing managed Python installations and tools.
|
||||
pub const XDG_DATA_HOME: &'static str = "XDG_DATA_HOME";
|
||||
|
||||
/// Path to directory where executables are installed.
|
||||
pub const XDG_BIN_HOME: &'static str = "XDG_BIN_HOME";
|
||||
|
||||
/// Timeout (in seconds) for HTTP requests.
|
||||
pub const UV_HTTP_TIMEOUT: &'static str = "UV_HTTP_TIMEOUT";
|
||||
|
||||
/// Timeout (in seconds) for HTTP requests.
|
||||
pub const UV_REQUEST_TIMEOUT: &'static str = "UV_REQUEST_TIMEOUT";
|
||||
|
||||
/// Timeout (in seconds) for HTTP requests.
|
||||
pub const HTTP_TIMEOUT: &'static str = "HTTP_TIMEOUT";
|
||||
|
||||
/// Custom certificate bundle file path for SSL connections.
|
||||
pub const SSL_CERT_FILE: &'static str = "SSL_CERT_FILE";
|
||||
|
||||
/// File for mTLS authentication (contains certificate and private key).
|
||||
pub const SSL_CLIENT_CERT: &'static str = "SSL_CLIENT_CERT";
|
||||
|
||||
/// Proxy for HTTP requests.
|
||||
pub const HTTP_PROXY: &'static str = "HTTP_PROXY";
|
||||
|
||||
/// Proxy for HTTPS requests.
|
||||
pub const HTTPS_PROXY: &'static str = "HTTPS_PROXY";
|
||||
|
||||
/// General proxy for all network requests.
|
||||
pub const ALL_PROXY: &'static str = "ALL_PROXY";
|
||||
|
||||
/// Used to detect an activated virtual environment.
|
||||
pub const VIRTUAL_ENV: &'static str = "VIRTUAL_ENV";
|
||||
|
||||
/// Used to detect an activated Conda environment.
|
||||
pub const CONDA_PREFIX: &'static str = "CONDA_PREFIX";
|
||||
|
||||
/// Disables prepending virtual environment name to the terminal prompt.
|
||||
pub const VIRTUAL_ENV_DISABLE_PROMPT: &'static str = "VIRTUAL_ENV_DISABLE_PROMPT";
|
||||
|
||||
/// Used to detect Windows Command Prompt usage.
|
||||
pub const PROMPT: &'static str = "PROMPT";
|
||||
|
||||
/// Used to detect `NuShell` usage.
|
||||
pub const NU_VERSION: &'static str = "NU_VERSION";
|
||||
|
||||
/// Used to detect Fish shell usage.
|
||||
pub const FISH_VERSION: &'static str = "FISH_VERSION";
|
||||
|
||||
/// Used to detect Bash shell usage.
|
||||
pub const BASH_VERSION: &'static str = "BASH_VERSION";
|
||||
|
||||
/// Used to detect Zsh shell usage.
|
||||
pub const ZSH_VERSION: &'static str = "ZSH_VERSION";
|
||||
|
||||
/// Used to determine which `.zshenv` to use when Zsh is being used.
|
||||
pub const ZDOTDIR: &'static str = "ZDOTDIR";
|
||||
|
||||
/// Used to detect Ksh shell usage.
|
||||
pub const KSH_VERSION: &'static str = "KSH_VERSION";
|
||||
|
||||
/// Sets macOS deployment target when using `--python-platform macos`.
|
||||
pub const MACOSX_DEPLOYMENT_TARGET: &'static str = "MACOSX_DEPLOYMENT_TARGET";
|
||||
|
||||
/// Disables colored output (takes precedence over `FORCE_COLOR`).
|
||||
pub const NO_COLOR: &'static str = "NO_COLOR";
|
||||
|
||||
/// Forces colored output regardless of terminal support.
|
||||
pub const FORCE_COLOR: &'static str = "FORCE_COLOR";
|
||||
|
||||
/// Use to control color via `anstyle`.
|
||||
pub const CLICOLOR_FORCE: &'static str = "CLICOLOR_FORCE";
|
||||
|
||||
/// The standard `PATH` env var.
|
||||
pub const PATH: &'static str = "PATH";
|
||||
|
||||
/// The standard `HOME` env var.
|
||||
pub const HOME: &'static str = "HOME";
|
||||
|
||||
/// The standard `SHELL` posix env var.
|
||||
pub const SHELL: &'static str = "SHELL";
|
||||
|
||||
/// The standard `PWD` posix env var.
|
||||
pub const PWD: &'static str = "PWD";
|
||||
|
||||
/// Used to look for Microsoft Store Pythons installations.
|
||||
pub const LOCALAPPDATA: &'static str = "LOCALAPPDATA";
|
||||
|
||||
/// Path to the `.git` directory. Ignored by `uv` when performing fetch.
|
||||
pub const GIT_DIR: &'static str = "GIT_DIR";
|
||||
|
||||
/// Path to the git working tree. Ignored by `uv` when performing fetch.
|
||||
pub const GIT_WORK_TREE: &'static str = "GIT_WORK_TREE";
|
||||
|
||||
/// Path to the index file for staged changes. Ignored by `uv` when performing fetch.
|
||||
pub const GIT_INDEX_FILE: &'static str = "GIT_INDEX_FILE";
|
||||
|
||||
/// Path to where git object files are located. Ignored by `uv` when performing fetch.
|
||||
pub const GIT_OBJECT_DIRECTORY: &'static str = "GIT_OBJECT_DIRECTORY";
|
||||
|
||||
/// Alternate locations for git objects. Ignored by `uv` when performing fetch.
|
||||
pub const GIT_ALTERNATE_OBJECT_DIRECTORIES: &'static str = "GIT_ALTERNATE_OBJECT_DIRECTORIES";
|
||||
|
||||
/// Used for trusted publishing via `uv publish`.
|
||||
pub const GITHUB_ACTIONS: &'static str = "GITHUB_ACTIONS";
|
||||
|
||||
/// Used for trusted publishing via `uv publish`. Contains the oidc token url.
|
||||
pub const ACTIONS_ID_TOKEN_REQUEST_URL: &'static str = "ACTIONS_ID_TOKEN_REQUEST_URL";
|
||||
|
||||
/// Used for trusted publishing via `uv publish`. Contains the oidc request token.
|
||||
pub const ACTIONS_ID_TOKEN_REQUEST_TOKEN: &'static str = "ACTIONS_ID_TOKEN_REQUEST_TOKEN";
|
||||
|
||||
/// Sets the encoding for standard I/O streams (e.g., PYTHONIOENCODING=utf-8).
|
||||
pub const PYTHONIOENCODING: &'static str = "PYTHONIOENCODING";
|
||||
|
||||
/// Forces unbuffered I/O streams, equivalent to `-u` in Python.
|
||||
pub const PYTHONUNBUFFERED: &'static str = "PYTHONUNBUFFERED";
|
||||
|
||||
/// Enables UTF-8 mode for Python, equivalent to `-X utf8`.
|
||||
pub const PYTHONUTF8: &'static str = "PYTHONUTF8";
|
||||
|
||||
/// Adds directories to Python module search path (e.g., PYTHONPATH=/path/to/modules).
|
||||
pub const PYTHONPATH: &'static str = "PYTHONPATH";
|
||||
|
||||
/// Typically set by CI runners, used to detect a CI runner.
|
||||
pub const CI: &'static str = "CI";
|
||||
|
||||
/// Use to set the .netrc file location.
|
||||
pub const NETRC: &'static str = "NETRC";
|
||||
|
||||
/// The standard `PAGER` posix env var. Used by `uv` to configure the appropriate pager.
|
||||
pub const PAGER: &'static str = "PAGER";
|
||||
|
||||
/// Used to detect when running inside a Jupyter notebook.
|
||||
pub const JPY_SESSION_NAME: &'static str = "JPY_SESSION_NAME";
|
||||
|
||||
/// Use to create the tracing root directory via the `tracing-durations-export` feature.
|
||||
pub const TRACING_DURATIONS_TEST_ROOT: &'static str = "TRACING_DURATIONS_TEST_ROOT";
|
||||
|
||||
/// Use to create the tracing durations file via the `tracing-durations-export` feature.
|
||||
pub const TRACING_DURATIONS_FILE: &'static str = "TRACING_DURATIONS_FILE";
|
||||
|
||||
/// Used to set `RUST_HOST_TARGET` at build time via `build.rs`.
|
||||
pub const TARGET: &'static str = "TARGET";
|
||||
|
||||
/// Custom log level for verbose output, compatible with `tracing_subscriber`.
|
||||
pub const RUST_LOG: &'static str = "RUST_LOG";
|
||||
|
||||
/// The directory containing the `Cargo.toml` manifest for a package.
|
||||
pub const CARGO_MANIFEST_DIR: &'static str = "CARGO_MANIFEST_DIR";
|
||||
|
||||
/// Specifies the directory where Cargo stores build artifacts (target directory).
|
||||
pub const CARGO_TARGET_DIR: &'static str = "CARGO_TARGET_DIR";
|
||||
|
||||
/// Used in tests for environment substitution testing in `requirements.in`.
|
||||
pub const URL: &'static str = "URL";
|
||||
|
||||
/// Used in tests for environment substitution testing in `requirements.in`.
|
||||
pub const FILE_PATH: &'static str = "FILE_PATH";
|
||||
|
||||
/// Used in tests for environment substitution testing in `requirements.in`.
|
||||
pub const HATCH_PATH: &'static str = "HATCH_PATH";
|
||||
|
||||
/// Used in tests for environment substitution testing in `requirements.in`.
|
||||
pub const BLACK_PATH: &'static str = "BLACK_PATH";
|
||||
|
||||
/// Used in testing Hatch's root.uri feature
|
||||
///
|
||||
/// See: <https://hatch.pypa.io/dev/config/dependency/#local>.
|
||||
pub const ROOT_PATH: &'static str = "ROOT_PATH";
|
||||
|
||||
/// Used to set test credentials for keyring tests.
|
||||
pub const KEYRING_TEST_CREDENTIALS: &'static str = "KEYRING_TEST_CREDENTIALS";
|
||||
}
|
3
crates/uv-static/src/lib.rs
Normal file
3
crates/uv-static/src/lib.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
pub use env_vars::*;
|
||||
|
||||
mod env_vars;
|
|
@ -26,6 +26,7 @@ uv-pypi-types = { workspace = true }
|
|||
uv-python = { workspace = true }
|
||||
uv-settings = { workspace = true }
|
||||
uv-state = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
uv-virtualenv = { workspace = true }
|
||||
|
||||
dirs-sys = { workspace = true }
|
||||
|
|
|
@ -22,6 +22,7 @@ use uv_fs::{LockedFile, Simplified};
|
|||
use uv_installer::SitePackages;
|
||||
use uv_python::{Interpreter, PythonEnvironment};
|
||||
use uv_state::{StateBucket, StateStore};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
mod receipt;
|
||||
mod tool;
|
||||
|
@ -77,7 +78,7 @@ impl InstalledTools {
|
|||
/// 2. A directory in the system-appropriate user-level data directory, e.g., `~/.local/uv/tools`
|
||||
/// 3. A directory in the local data directory, e.g., `./.uv/tools`
|
||||
pub fn from_settings() -> Result<Self, Error> {
|
||||
if let Some(tool_dir) = std::env::var_os("UV_TOOL_DIR") {
|
||||
if let Some(tool_dir) = std::env::var_os(EnvVars::UV_TOOL_DIR) {
|
||||
Ok(Self::from_path(tool_dir))
|
||||
} else {
|
||||
Ok(Self::from_path(
|
||||
|
@ -366,11 +367,11 @@ impl fmt::Display for InstalledTool {
|
|||
///
|
||||
/// Errors if a directory cannot be found.
|
||||
pub fn find_executable_directory() -> Result<PathBuf, Error> {
|
||||
std::env::var_os("UV_TOOL_BIN_DIR")
|
||||
std::env::var_os(EnvVars::UV_TOOL_BIN_DIR)
|
||||
.and_then(dirs_sys::is_absolute_path)
|
||||
.or_else(|| std::env::var_os("XDG_BIN_HOME").and_then(dirs_sys::is_absolute_path))
|
||||
.or_else(|| std::env::var_os(EnvVars::XDG_BIN_HOME).and_then(dirs_sys::is_absolute_path))
|
||||
.or_else(|| {
|
||||
std::env::var_os("XDG_DATA_HOME")
|
||||
std::env::var_os(EnvVars::XDG_DATA_HOME)
|
||||
.and_then(dirs_sys::is_absolute_path)
|
||||
.map(|path| path.join("../bin"))
|
||||
})
|
||||
|
|
|
@ -24,6 +24,7 @@ uv-options-metadata = { workspace = true }
|
|||
uv-pep440 = { workspace = true }
|
||||
uv-pep508 = { workspace = true }
|
||||
uv-pypi-types = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
uv-warnings = { workspace = true }
|
||||
|
||||
either = { workspace = true }
|
||||
|
|
|
@ -11,6 +11,7 @@ use uv_fs::{Simplified, CWD};
|
|||
use uv_normalize::{GroupName, PackageName, DEV_DEPENDENCIES};
|
||||
use uv_pep508::{MarkerTree, RequirementOrigin, VerbatimUrl};
|
||||
use uv_pypi_types::{Requirement, RequirementSource, SupportedEnvironments, VerbatimParsedUrl};
|
||||
use uv_static::EnvVars;
|
||||
use uv_warnings::{warn_user, warn_user_once};
|
||||
|
||||
use crate::pyproject::{
|
||||
|
@ -402,7 +403,7 @@ impl Workspace {
|
|||
pub fn venv(&self) -> PathBuf {
|
||||
/// Resolve the `UV_PROJECT_ENVIRONMENT` value, if any.
|
||||
fn from_project_environment_variable(workspace: &Workspace) -> Option<PathBuf> {
|
||||
let value = std::env::var_os("UV_PROJECT_ENVIRONMENT")?;
|
||||
let value = std::env::var_os(EnvVars::UV_PROJECT_ENVIRONMENT)?;
|
||||
|
||||
if value.is_empty() {
|
||||
return None;
|
||||
|
@ -419,7 +420,7 @@ impl Workspace {
|
|||
|
||||
// Resolve the `VIRTUAL_ENV` variable, if any.
|
||||
fn from_virtual_env_variable() -> Option<PathBuf> {
|
||||
let value = std::env::var_os("VIRTUAL_ENV")?;
|
||||
let value = std::env::var_os(EnvVars::VIRTUAL_ENV)?;
|
||||
|
||||
if value.is_empty() {
|
||||
return None;
|
||||
|
|
|
@ -45,6 +45,7 @@ uv-resolver = { workspace = true }
|
|||
uv-scripts = { workspace = true }
|
||||
uv-settings = { workspace = true, features = ["schemars"] }
|
||||
uv-shell = { workspace = true }
|
||||
uv-static = { workspace = true }
|
||||
uv-tool = { workspace = true }
|
||||
uv-types = { workspace = true }
|
||||
uv-virtualenv = { workspace = true }
|
||||
|
|
|
@ -13,6 +13,7 @@ use which::which;
|
|||
use super::ExitStatus;
|
||||
use crate::printer::Printer;
|
||||
use uv_cli::Cli;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
// hidden subcommands to show in the help command
|
||||
const SHOW_HIDDEN_COMMANDS: &[&str] = &["generate-shell-completion"];
|
||||
|
@ -221,7 +222,7 @@ impl Pager {
|
|||
/// Supports the `PAGER` environment variable, otherwise checks for `less` and `more` in the
|
||||
/// search path.
|
||||
fn try_from_env() -> Option<Pager> {
|
||||
if let Some(pager) = std::env::var_os("PAGER") {
|
||||
if let Some(pager) = std::env::var_os(EnvVars::PAGER) {
|
||||
if !pager.is_empty() {
|
||||
return Pager::from_str(&pager.to_string_lossy()).ok();
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ use uv_python::{
|
|||
use uv_requirements::{RequirementsSource, RequirementsSpecification};
|
||||
use uv_resolver::Lock;
|
||||
use uv_scripts::Pep723Item;
|
||||
use uv_static::EnvVars;
|
||||
use uv_warnings::warn_user;
|
||||
use uv_workspace::{DiscoveryOptions, InstallTarget, VirtualProject, Workspace, WorkspaceError};
|
||||
|
||||
|
@ -859,17 +860,17 @@ pub(crate) async fn run(
|
|||
.chain(std::iter::once(base_interpreter.scripts()))
|
||||
.map(PathBuf::from)
|
||||
.chain(
|
||||
std::env::var_os("PATH")
|
||||
std::env::var_os(EnvVars::PATH)
|
||||
.as_ref()
|
||||
.iter()
|
||||
.flat_map(std::env::split_paths),
|
||||
),
|
||||
)?;
|
||||
process.env("PATH", new_path);
|
||||
process.env(EnvVars::PATH, new_path);
|
||||
|
||||
// Ensure `VIRTUAL_ENV` is set.
|
||||
if interpreter.is_virtualenv() {
|
||||
process.env("VIRTUAL_ENV", interpreter.sys_prefix().as_os_str());
|
||||
process.env(EnvVars::VIRTUAL_ENV, interpreter.sys_prefix().as_os_str());
|
||||
};
|
||||
|
||||
// Spawn and wait for completion
|
||||
|
|
|
@ -12,6 +12,7 @@ use uv_distribution_types::{
|
|||
};
|
||||
use uv_normalize::PackageName;
|
||||
use uv_python::PythonInstallationKey;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::printer::Printer;
|
||||
|
||||
|
@ -55,7 +56,7 @@ impl BarState {
|
|||
|
||||
impl ProgressReporter {
|
||||
fn new(root: ProgressBar, multi_progress: MultiProgress, printer: Printer) -> ProgressReporter {
|
||||
let mode = if env::var("JPY_SESSION_NAME").is_ok() {
|
||||
let mode = if env::var(EnvVars::JPY_SESSION_NAME).is_ok() {
|
||||
// Disable concurrent progress bars when running inside a Jupyter notebook
|
||||
// because the Jupyter terminal does not support clearing previous lines.
|
||||
// See: https://github.com/astral-sh/uv/issues/3887.
|
||||
|
|
|
@ -26,6 +26,7 @@ use uv_python::{
|
|||
PythonPreference, PythonRequest,
|
||||
};
|
||||
use uv_requirements::{RequirementsSource, RequirementsSpecification};
|
||||
use uv_static::EnvVars;
|
||||
use uv_tool::{entrypoint_paths, InstalledTools};
|
||||
use uv_warnings::warn_user;
|
||||
|
||||
|
@ -148,13 +149,13 @@ pub(crate) async fn run(
|
|||
// Construct the `PATH` environment variable.
|
||||
let new_path = std::env::join_paths(
|
||||
std::iter::once(environment.scripts().to_path_buf()).chain(
|
||||
std::env::var_os("PATH")
|
||||
std::env::var_os(EnvVars::PATH)
|
||||
.as_ref()
|
||||
.iter()
|
||||
.flat_map(std::env::split_paths),
|
||||
),
|
||||
)?;
|
||||
process.env("PATH", new_path);
|
||||
process.env(EnvVars::PATH, new_path);
|
||||
|
||||
// Spawn and wait for completion
|
||||
// Standard input, output, and error streams are all inherited
|
||||
|
|
|
@ -26,6 +26,7 @@ use uv_fs::CWD;
|
|||
use uv_requirements::RequirementsSource;
|
||||
use uv_scripts::{Pep723Item, Pep723Metadata, Pep723Script};
|
||||
use uv_settings::{Combine, FilesystemOptions, Options};
|
||||
use uv_static::EnvVars;
|
||||
use uv_warnings::{warn_user, warn_user_once};
|
||||
use uv_workspace::{DiscoveryOptions, Workspace};
|
||||
|
||||
|
@ -41,7 +42,6 @@ pub(crate) mod commands;
|
|||
pub(crate) mod logging;
|
||||
pub(crate) mod printer;
|
||||
pub(crate) mod settings;
|
||||
pub(crate) mod version;
|
||||
|
||||
#[instrument(skip_all)]
|
||||
async fn run(mut cli: Cli) -> Result<ExitStatus> {
|
||||
|
@ -241,7 +241,11 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
|
|||
.break_words(false)
|
||||
.word_separator(textwrap::WordSeparator::AsciiSpace)
|
||||
.word_splitter(textwrap::WordSplitter::NoHyphenation)
|
||||
.wrap_lines(std::env::var("UV_NO_WRAP").map(|_| false).unwrap_or(true))
|
||||
.wrap_lines(
|
||||
std::env::var(EnvVars::UV_NO_WRAP)
|
||||
.map(|_| false)
|
||||
.unwrap_or(true),
|
||||
)
|
||||
.build(),
|
||||
)
|
||||
}))?;
|
||||
|
@ -251,7 +255,7 @@ async fn run(mut cli: Cli) -> Result<ExitStatus> {
|
|||
.build_global()
|
||||
.expect("failed to initialize global rayon pool");
|
||||
|
||||
debug!("uv {}", version::version());
|
||||
debug!("uv {}", uv_cli::version::version());
|
||||
|
||||
// Write out any resolved settings.
|
||||
macro_rules! show_settings {
|
||||
|
@ -1584,7 +1588,7 @@ where
|
|||
// We support increasing the stack size to avoid stack overflows in debug mode on Windows. In
|
||||
// addition, we box types and futures in various places. This includes the `Box::pin(run())`
|
||||
// here, which prevents the large (non-send) main future alone from overflowing the stack.
|
||||
let result = if let Ok(stack_size) = std::env::var("UV_STACK_SIZE") {
|
||||
let result = if let Ok(stack_size) = std::env::var(EnvVars::UV_STACK_SIZE) {
|
||||
let stack_size = stack_size.parse().expect("Invalid stack size");
|
||||
let tokio_main = move || {
|
||||
let runtime = tokio::runtime::Builder::new_current_thread()
|
||||
|
|
|
@ -19,6 +19,8 @@ use tracing_subscriber::util::SubscriberInitExt;
|
|||
use tracing_subscriber::{EnvFilter, Layer, Registry};
|
||||
use tracing_tree::time::Uptime;
|
||||
use tracing_tree::HierarchicalLayer;
|
||||
#[cfg(feature = "tracing-durations-export")]
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum Level {
|
||||
|
@ -187,7 +189,7 @@ pub(crate) fn setup_duration() -> anyhow::Result<(
|
|||
Option<DurationsLayer<Registry>>,
|
||||
Option<DurationsLayerDropGuard>,
|
||||
)> {
|
||||
if let Ok(location) = std::env::var("TRACING_DURATIONS_FILE") {
|
||||
if let Ok(location) = std::env::var(EnvVars::TRACING_DURATIONS_FILE) {
|
||||
let location = std::path::PathBuf::from(location);
|
||||
if let Some(parent) = location.parent() {
|
||||
fs_err::create_dir_all(parent)
|
||||
|
|
|
@ -35,6 +35,7 @@ use uv_settings::{
|
|||
Combine, FilesystemOptions, Options, PipOptions, PublishOptions, ResolverInstallerOptions,
|
||||
ResolverOptions,
|
||||
};
|
||||
use uv_static::EnvVars;
|
||||
use uv_warnings::warn_user_once;
|
||||
use uv_workspace::pyproject::DependencyType;
|
||||
|
||||
|
@ -74,15 +75,15 @@ impl GlobalSettings {
|
|||
quiet: args.quiet,
|
||||
verbose: args.verbose,
|
||||
color: if args.no_color
|
||||
|| std::env::var_os("NO_COLOR")
|
||||
|| std::env::var_os(EnvVars::NO_COLOR)
|
||||
.filter(|v| !v.is_empty())
|
||||
.is_some()
|
||||
{
|
||||
ColorChoice::Never
|
||||
} else if std::env::var_os("FORCE_COLOR")
|
||||
} else if std::env::var_os(EnvVars::FORCE_COLOR)
|
||||
.filter(|v| !v.is_empty())
|
||||
.is_some()
|
||||
|| std::env::var_os("CLICOLOR_FORCE")
|
||||
|| std::env::var_os(EnvVars::CLICOLOR_FORCE)
|
||||
.filter(|v| !v.is_empty())
|
||||
.is_some()
|
||||
{
|
||||
|
@ -2535,17 +2536,19 @@ impl PublishSettings {
|
|||
|
||||
// Environment variables that are not exposed as CLI arguments.
|
||||
mod env {
|
||||
use uv_static::EnvVars;
|
||||
|
||||
pub(super) const CONCURRENT_DOWNLOADS: (&str, &str) =
|
||||
("UV_CONCURRENT_DOWNLOADS", "a non-zero integer");
|
||||
(EnvVars::UV_CONCURRENT_DOWNLOADS, "a non-zero integer");
|
||||
|
||||
pub(super) const CONCURRENT_BUILDS: (&str, &str) =
|
||||
("UV_CONCURRENT_BUILDS", "a non-zero integer");
|
||||
(EnvVars::UV_CONCURRENT_BUILDS, "a non-zero integer");
|
||||
|
||||
pub(super) const CONCURRENT_INSTALLS: (&str, &str) =
|
||||
("UV_CONCURRENT_INSTALLS", "a non-zero integer");
|
||||
(EnvVars::UV_CONCURRENT_INSTALLS, "a non-zero integer");
|
||||
|
||||
pub(super) const UV_PYTHON_DOWNLOADS: (&str, &str) = (
|
||||
"UV_PYTHON_DOWNLOADS",
|
||||
EnvVars::UV_PYTHON_DOWNLOADS,
|
||||
"one of 'auto', 'true', 'manual', 'never', or 'false'",
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
//! Code for representing uv's release version number.
|
||||
use std::fmt;
|
||||
|
||||
// See also <https://github.com/astral-sh/ruff/blob/8118d29419055b779719cc96cdf3dacb29ac47c9/crates/ruff/src/version.rs>
|
||||
use serde::Serialize;
|
||||
|
||||
/// Information about the git repository where uv was built from.
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct CommitInfo {
|
||||
short_commit_hash: String,
|
||||
commit_hash: String,
|
||||
commit_date: String,
|
||||
last_tag: Option<String>,
|
||||
commits_since_last_tag: u32,
|
||||
}
|
||||
|
||||
/// uv's version.
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct VersionInfo {
|
||||
/// uv's version, such as "0.5.1"
|
||||
version: String,
|
||||
/// Information about the git commit we may have been built from.
|
||||
///
|
||||
/// `None` if not built from a git repo or if retrieval failed.
|
||||
commit_info: Option<CommitInfo>,
|
||||
}
|
||||
impl fmt::Display for VersionInfo {
|
||||
/// Formatted version information: "<version>[+<commits>] (<commit> <date>)"
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.version)?;
|
||||
|
||||
if let Some(ref ci) = self.commit_info {
|
||||
if ci.commits_since_last_tag > 0 {
|
||||
write!(f, "+{}", ci.commits_since_last_tag)?;
|
||||
}
|
||||
write!(f, " ({} {})", ci.short_commit_hash, ci.commit_date)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl From<VersionInfo> for clap::builder::Str {
|
||||
fn from(val: VersionInfo) -> Self {
|
||||
val.to_string().into()
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns information about uv's version.
|
||||
pub(crate) fn version() -> VersionInfo {
|
||||
// Environment variables are only read at compile-time
|
||||
macro_rules! option_env_str {
|
||||
($name:expr) => {
|
||||
option_env!($name).map(|s| s.to_string())
|
||||
};
|
||||
}
|
||||
|
||||
// This version is pulled from Cargo.toml and set by Cargo
|
||||
let version = option_env_str!("CARGO_PKG_VERSION").unwrap();
|
||||
|
||||
// Commit info is pulled from git and set by `build.rs`
|
||||
let commit_info = option_env_str!("UV_COMMIT_HASH").map(|commit_hash| CommitInfo {
|
||||
short_commit_hash: option_env_str!("UV_COMMIT_SHORT_HASH").unwrap(),
|
||||
commit_hash,
|
||||
commit_date: option_env_str!("UV_COMMIT_DATE").unwrap(),
|
||||
last_tag: option_env_str!("UV_LAST_TAG"),
|
||||
commits_since_last_tag: option_env_str!("UV_LAST_TAG_DISTANCE")
|
||||
.as_deref()
|
||||
.map_or(0, |value| value.parse::<u32>().unwrap_or(0)),
|
||||
});
|
||||
|
||||
VersionInfo {
|
||||
version,
|
||||
commit_info,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
|
@ -4,6 +4,7 @@ use assert_cmd::assert::OutputAssertExt;
|
|||
use std::env;
|
||||
use std::path::Path;
|
||||
use tempfile::TempDir;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
/// Test that build backend works if we invoke it directly.
|
||||
///
|
||||
|
@ -40,7 +41,7 @@ fn uv_backend_direct() -> Result<()> {
|
|||
.arg("-c")
|
||||
.arg("import uv_backend\nuv_backend.greet()")
|
||||
// Python on windows
|
||||
.env("PYTHONUTF8", "1"), @r###"
|
||||
.env(EnvVars::PYTHONUTF8, "1"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use crate::common::uv_snapshot;
|
||||
use anyhow::Result;
|
||||
use assert_cmd::prelude::*;
|
||||
use assert_fs::prelude::*;
|
||||
use indoc::indoc;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::uv_snapshot;
|
||||
use crate::common::TestContext;
|
||||
|
||||
/// `cache prune` should be a no-op if there's nothing out-of-date in the cache.
|
||||
|
@ -79,8 +81,8 @@ fn prune_cached_env() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("pytest@8.0.0")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -180,7 +182,7 @@ fn prune_unzipped() -> Result<()> {
|
|||
" })?;
|
||||
|
||||
// Install a requirement, to populate the cache.
|
||||
uv_snapshot!(context.filters(), context.pip_install().arg("-r").env_remove("UV_EXCLUDE_NEWER").arg("requirements.txt").arg("--reinstall"), @r###"
|
||||
uv_snapshot!(context.filters(), context.pip_install().arg("-r").env_remove(EnvVars::UV_EXCLUDE_NEWER).arg("requirements.txt").arg("--reinstall"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -210,7 +212,7 @@ fn prune_unzipped() -> Result<()> {
|
|||
requirements_txt.write_str(indoc! { r"
|
||||
source-distribution==0.0.1
|
||||
" })?;
|
||||
uv_snapshot!(context.filters(), context.pip_install().arg("-r").env_remove("UV_EXCLUDE_NEWER").arg("requirements.txt").arg("--offline"), @r###"
|
||||
uv_snapshot!(context.filters(), context.pip_install().arg("-r").env_remove(EnvVars::UV_EXCLUDE_NEWER).arg("requirements.txt").arg("--offline"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -226,7 +228,7 @@ fn prune_unzipped() -> Result<()> {
|
|||
requirements_txt.write_str(indoc! { r"
|
||||
iniconfig
|
||||
" })?;
|
||||
uv_snapshot!(context.filters(), context.pip_install().arg("-r").env_remove("UV_EXCLUDE_NEWER").arg("requirements.txt").arg("--offline"), @r###"
|
||||
uv_snapshot!(context.filters(), context.pip_install().arg("-r").env_remove(EnvVars::UV_EXCLUDE_NEWER).arg("requirements.txt").arg("--offline"), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
|
|
@ -27,6 +27,7 @@ use uv_python::managed::ManagedPythonInstallations;
|
|||
use uv_python::{
|
||||
EnvironmentPreference, PythonInstallation, PythonPreference, PythonRequest, PythonVersion,
|
||||
};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
// Exclude any packages uploaded after this date.
|
||||
static EXCLUDE_NEWER: &str = "2024-03-25T00:00:00Z";
|
||||
|
@ -221,7 +222,7 @@ impl TestContext {
|
|||
/// returns resolved symlink). This is problematic, as we _don't_ want to resolve symlinks
|
||||
/// for user-provided paths.
|
||||
pub fn test_bucket_dir() -> PathBuf {
|
||||
env::var("UV_INTERNAL__TEST_DIR")
|
||||
env::var(EnvVars::UV_INTERNAL__TEST_DIR)
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|_| {
|
||||
etcetera::base_strategy::choose_base_strategy()
|
||||
|
@ -270,7 +271,7 @@ impl TestContext {
|
|||
|
||||
// The workspace root directory is not available without walking up the tree
|
||||
// https://github.com/rust-lang/cargo/issues/3946
|
||||
let workspace_root = Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap())
|
||||
let workspace_root = Path::new(&std::env::var(EnvVars::CARGO_MANIFEST_DIR).unwrap())
|
||||
.parent()
|
||||
.expect("CARGO_MANIFEST_DIR should be nested in workspace")
|
||||
.parent()
|
||||
|
@ -444,23 +445,23 @@ impl TestContext {
|
|||
.arg("--cache-dir")
|
||||
.arg(self.cache_dir.path())
|
||||
// When running the tests in a venv, ignore that venv, otherwise we'll capture warnings.
|
||||
.env_remove("VIRTUAL_ENV")
|
||||
.env("UV_NO_WRAP", "1")
|
||||
.env("HOME", self.home_dir.as_os_str())
|
||||
.env("UV_PYTHON_INSTALL_DIR", "")
|
||||
.env("UV_TEST_PYTHON_PATH", self.python_path())
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env_remove("UV_CACHE_DIR")
|
||||
.env_remove(EnvVars::VIRTUAL_ENV)
|
||||
.env(EnvVars::UV_NO_WRAP, "1")
|
||||
.env(EnvVars::HOME, self.home_dir.as_os_str())
|
||||
.env(EnvVars::UV_PYTHON_INSTALL_DIR, "")
|
||||
.env(EnvVars::UV_TEST_PYTHON_PATH, self.python_path())
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.env_remove(EnvVars::UV_CACHE_DIR)
|
||||
.current_dir(self.temp_dir.path());
|
||||
|
||||
if activate_venv {
|
||||
command.env("VIRTUAL_ENV", self.venv.as_os_str());
|
||||
command.env(EnvVars::VIRTUAL_ENV, self.venv.as_os_str());
|
||||
}
|
||||
|
||||
if cfg!(all(windows, debug_assertions)) {
|
||||
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
|
||||
// default windows stack of 1MB
|
||||
command.env("UV_STACK_SIZE", (4 * 1024 * 1024).to_string());
|
||||
command.env(EnvVars::UV_STACK_SIZE, (4 * 1024 * 1024).to_string());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,12 +548,12 @@ impl TestContext {
|
|||
pub fn help(&self) -> Command {
|
||||
let mut command = Command::new(get_bin());
|
||||
command.arg("help");
|
||||
command.env_remove("UV_CACHE_DIR");
|
||||
command.env_remove(EnvVars::UV_CACHE_DIR);
|
||||
|
||||
if cfg!(all(windows, debug_assertions)) {
|
||||
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
|
||||
// default windows stack of 1MB
|
||||
command.env("UV_STACK_SIZE", (4 * 1024 * 1024).to_string());
|
||||
command.env(EnvVars::UV_STACK_SIZE, (4 * 1024 * 1024).to_string());
|
||||
}
|
||||
|
||||
command
|
||||
|
@ -607,7 +608,7 @@ impl TestContext {
|
|||
if cfg!(all(windows, debug_assertions)) {
|
||||
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
|
||||
// default windows stack of 1MB
|
||||
command.env("UV_STACK_SIZE", (4 * 1024 * 1024).to_string());
|
||||
command.env(EnvVars::UV_STACK_SIZE, (4 * 1024 * 1024).to_string());
|
||||
}
|
||||
|
||||
command
|
||||
|
@ -619,8 +620,8 @@ impl TestContext {
|
|||
command
|
||||
.arg("python")
|
||||
.arg("find")
|
||||
.env("UV_PREVIEW", "1")
|
||||
.env("UV_PYTHON_INSTALL_DIR", "")
|
||||
.env(EnvVars::UV_PREVIEW, "1")
|
||||
.env(EnvVars::UV_PYTHON_INSTALL_DIR, "")
|
||||
.current_dir(&self.temp_dir);
|
||||
self.add_shared_args(&mut command, true);
|
||||
command
|
||||
|
@ -632,8 +633,8 @@ impl TestContext {
|
|||
command
|
||||
.arg("python")
|
||||
.arg("pin")
|
||||
.env("UV_PREVIEW", "1")
|
||||
.env("UV_PYTHON_INSTALL_DIR", "")
|
||||
.env(EnvVars::UV_PREVIEW, "1")
|
||||
.env(EnvVars::UV_PYTHON_INSTALL_DIR, "")
|
||||
.current_dir(&self.temp_dir);
|
||||
self.add_shared_args(&mut command, true);
|
||||
command
|
||||
|
@ -650,7 +651,7 @@ impl TestContext {
|
|||
/// Create a `uv run` command with options shared across scenarios.
|
||||
pub fn run(&self) -> Command {
|
||||
let mut command = Command::new(get_bin());
|
||||
command.arg("run").env("UV_SHOW_RESOLUTION", "1");
|
||||
command.arg("run").env(EnvVars::UV_SHOW_RESOLUTION, "1");
|
||||
self.add_shared_args(&mut command, true);
|
||||
command
|
||||
}
|
||||
|
@ -661,7 +662,7 @@ impl TestContext {
|
|||
command
|
||||
.arg("tool")
|
||||
.arg("run")
|
||||
.env("UV_SHOW_RESOLUTION", "1");
|
||||
.env(EnvVars::UV_SHOW_RESOLUTION, "1");
|
||||
self.add_shared_args(&mut command, false);
|
||||
command
|
||||
}
|
||||
|
@ -679,7 +680,7 @@ impl TestContext {
|
|||
let mut command = Command::new(get_bin());
|
||||
command.arg("tool").arg("install");
|
||||
self.add_shared_args(&mut command, false);
|
||||
command.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER);
|
||||
command.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER);
|
||||
command
|
||||
}
|
||||
|
||||
|
@ -1124,13 +1125,13 @@ pub fn run_and_format_with_status<T: AsRef<str>>(
|
|||
.to_string();
|
||||
|
||||
// Support profiling test run commands with traces.
|
||||
if let Ok(root) = env::var("TRACING_DURATIONS_TEST_ROOT") {
|
||||
if let Ok(root) = env::var(EnvVars::TRACING_DURATIONS_TEST_ROOT) {
|
||||
assert!(
|
||||
cfg!(feature = "tracing-durations-export"),
|
||||
"You need to enable the tracing-durations-export feature to use `TRACING_DURATIONS_TEST_ROOT`"
|
||||
);
|
||||
command.borrow_mut().env(
|
||||
"TRACING_DURATIONS_FILE",
|
||||
EnvVars::TRACING_DURATIONS_FILE,
|
||||
Path::new(&root).join(function_name).with_extension("jsonl"),
|
||||
);
|
||||
}
|
||||
|
@ -1285,7 +1286,7 @@ pub fn decode_token(content: &[&str]) -> String {
|
|||
/// certificate verification, passing through the `BaseClient`
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
pub async fn download_to_disk(url: &str, path: &Path) {
|
||||
let trusted_hosts: Vec<_> = std::env::var("UV_INSECURE_HOST")
|
||||
let trusted_hosts: Vec<_> = std::env::var(EnvVars::UV_INSECURE_HOST)
|
||||
.unwrap_or_default()
|
||||
.split(' ')
|
||||
.map(|h| uv_configuration::TrustedHost::from_str(h).unwrap())
|
||||
|
|
|
@ -3,6 +3,7 @@ use anyhow::Result;
|
|||
use insta::assert_snapshot;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
// These tests just run `uv lock` on an assorted of ecosystem
|
||||
// projects.
|
||||
|
@ -46,7 +47,7 @@ fn home_assistant_core() -> Result<()> {
|
|||
#[test]
|
||||
fn transformers() -> Result<()> {
|
||||
// Takes too long on non-Linux in CI.
|
||||
if !cfg!(target_os = "linux") && std::env::var_os("CI").is_some() {
|
||||
if !cfg!(target_os = "linux") && std::env::var_os(EnvVars::CI).is_some() {
|
||||
return Ok(());
|
||||
}
|
||||
lock_ecosystem_package("3.12", "transformers")
|
||||
|
@ -62,7 +63,7 @@ fn warehouse() -> Result<()> {
|
|||
return Ok(());
|
||||
}
|
||||
// Also, takes too long on non-Linux in CI.
|
||||
if !cfg!(target_os = "linux") && std::env::var_os("CI").is_some() {
|
||||
if !cfg!(target_os = "linux") && std::env::var_os(EnvVars::CI).is_some() {
|
||||
return Ok(());
|
||||
}
|
||||
lock_ecosystem_package("3.11", "warehouse")
|
||||
|
@ -101,18 +102,18 @@ fn lock_ecosystem_package(python_version: &str, name: &str) -> Result<()> {
|
|||
.arg("--cache-dir")
|
||||
.arg(&cache_dir)
|
||||
// When running the tests in a venv, ignore that venv, otherwise we'll capture warnings.
|
||||
.env_remove("VIRTUAL_ENV")
|
||||
.env("UV_NO_WRAP", "1")
|
||||
.env("HOME", context.home_dir.as_os_str())
|
||||
.env("UV_PYTHON_INSTALL_DIR", "")
|
||||
.env("UV_TEST_PYTHON_PATH", context.python_path())
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env_remove(EnvVars::VIRTUAL_ENV)
|
||||
.env(EnvVars::UV_NO_WRAP, "1")
|
||||
.env(EnvVars::HOME, context.home_dir.as_os_str())
|
||||
.env(EnvVars::UV_PYTHON_INSTALL_DIR, "")
|
||||
.env(EnvVars::UV_TEST_PYTHON_PATH, context.python_path())
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.current_dir(context.temp_dir.path());
|
||||
|
||||
if cfg!(all(windows, debug_assertions)) {
|
||||
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
|
||||
// default windows stack of 1MB
|
||||
command.env("UV_STACK_SIZE", (2 * 1024 * 1024).to_string());
|
||||
command.env(EnvVars::UV_STACK_SIZE, (2 * 1024 * 1024).to_string());
|
||||
}
|
||||
let (snapshot, _) = common::run_and_format(
|
||||
&mut command,
|
||||
|
|
|
@ -5,6 +5,8 @@ use indoc::indoc;
|
|||
use insta::assert_snapshot;
|
||||
use std::path::Path;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{self, decode_token, packse_index_url, uv_snapshot, TestContext};
|
||||
|
||||
/// Add a PyPI requirement.
|
||||
|
@ -3702,7 +3704,7 @@ fn add_lower_bound_local() -> Result<()> {
|
|||
"#})?;
|
||||
|
||||
// Adding `torch` should include a lower-bound, but no local segment.
|
||||
uv_snapshot!(context.filters(), context.add().arg("local-simple-a").arg("--extra-index-url").arg(packse_index_url()).env_remove("UV_EXCLUDE_NEWER"), @r###"
|
||||
uv_snapshot!(context.filters(), context.add().arg("local-simple-a").arg("--extra-index-url").arg(packse_index_url()).env_remove(EnvVars::UV_EXCLUDE_NEWER), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -7,6 +7,8 @@ use indoc::indoc;
|
|||
use insta::assert_snapshot;
|
||||
use predicates::prelude::predicate;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
#[test]
|
||||
|
@ -2226,7 +2228,7 @@ fn init_git_not_installed() {
|
|||
let child = context.temp_dir.child("foo");
|
||||
|
||||
// Without explicit `--vcs git`, `uv init` succeeds without initializing a Git repository.
|
||||
uv_snapshot!(context.filters(), context.init().env("PATH", &*child).arg(child.as_ref()), @r###"
|
||||
uv_snapshot!(context.filters(), context.init().env(EnvVars::PATH, &*child).arg(child.as_ref()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2238,7 +2240,7 @@ fn init_git_not_installed() {
|
|||
// With explicit `--vcs git`, `uv init` will fail.
|
||||
let child = context.temp_dir.child("bar");
|
||||
// Set `PATH` to child to make `git` command cannot be found.
|
||||
uv_snapshot!(context.filters(), context.init().env("PATH", &*child).arg(child.as_ref()).arg("--vcs").arg("git"), @r###"
|
||||
uv_snapshot!(context.filters(), context.init().env(EnvVars::PATH, &*child).arg(child.as_ref()).arg("--vcs").arg("git"), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
|
|
@ -11,6 +11,7 @@ use crate::common::{
|
|||
TestContext,
|
||||
};
|
||||
use uv_fs::Simplified;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[test]
|
||||
fn lock_wheel_registry() -> Result<()> {
|
||||
|
@ -157,7 +158,7 @@ fn lock_sdist_registry() -> Result<()> {
|
|||
"#,
|
||||
)?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.lock().env_remove("UV_EXCLUDE_NEWER"), @r###"
|
||||
uv_snapshot!(context.filters(), context.lock().env_remove(EnvVars::UV_EXCLUDE_NEWER), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -197,7 +198,7 @@ fn lock_sdist_registry() -> Result<()> {
|
|||
});
|
||||
|
||||
// Re-run with `--locked`.
|
||||
uv_snapshot!(context.filters(), context.lock().arg("--locked").env_remove("UV_EXCLUDE_NEWER"), @r###"
|
||||
uv_snapshot!(context.filters(), context.lock().arg("--locked").env_remove(EnvVars::UV_EXCLUDE_NEWER), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -207,7 +208,7 @@ fn lock_sdist_registry() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// Install from the lockfile.
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--frozen").env_remove("UV_EXCLUDE_NEWER"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--frozen").env_remove(EnvVars::UV_EXCLUDE_NEWER), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -3396,7 +3397,7 @@ fn lock_requires_python_upper() -> Result<()> {
|
|||
"#,
|
||||
)?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.lock().env("UV_EXCLUDE_NEWER", "2024-08-29T00:00:00Z"), @r###"
|
||||
uv_snapshot!(context.filters(), context.lock().env(EnvVars::UV_EXCLUDE_NEWER, "2024-08-29T00:00:00Z"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -3488,7 +3489,7 @@ fn lock_requires_python_upper() -> Result<()> {
|
|||
});
|
||||
|
||||
// Re-run with `--locked`.
|
||||
uv_snapshot!(context.filters(), context.lock().arg("--locked").env("UV_EXCLUDE_NEWER", "2024-08-29T00:00:00Z"), @r###"
|
||||
uv_snapshot!(context.filters(), context.lock().arg("--locked").env(EnvVars::UV_EXCLUDE_NEWER, "2024-08-29T00:00:00Z"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -5277,7 +5278,7 @@ fn lock_invalid_hash() -> Result<()> {
|
|||
"#)?;
|
||||
|
||||
// Re-run with `--locked`.
|
||||
uv_snapshot!(context.filters(), context.lock().arg("--locked").env_remove("UV_EXCLUDE_NEWER"), @r###"
|
||||
uv_snapshot!(context.filters(), context.lock().arg("--locked").env_remove(EnvVars::UV_EXCLUDE_NEWER), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -5288,7 +5289,7 @@ fn lock_invalid_hash() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// Install from the lockfile.
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--frozen").env_remove("UV_EXCLUDE_NEWER"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--frozen").env_remove(EnvVars::UV_EXCLUDE_NEWER), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -6196,7 +6197,7 @@ fn lock_redact_https() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// Installing with credentials from with `UV_INDEX_URL` should succeed.
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--frozen").arg("--reinstall").arg("--no-cache").env("UV_INDEX_URL", "https://public:heron@pypi-proxy.fly.dev/basic-auth/simple"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--frozen").arg("--reinstall").arg("--no-cache").env(EnvVars::UV_INDEX_URL, "https://public:heron@pypi-proxy.fly.dev/basic-auth/simple"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -7215,7 +7216,7 @@ fn lock_upgrade_drop_fork_markers() -> Result<()> {
|
|||
.lock()
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.assert()
|
||||
.success();
|
||||
let lock = context.read("uv.lock");
|
||||
|
@ -7227,7 +7228,7 @@ fn lock_upgrade_drop_fork_markers() -> Result<()> {
|
|||
.lock()
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--upgrade")
|
||||
.assert()
|
||||
.success();
|
||||
|
@ -7753,7 +7754,7 @@ fn lock_local_index() -> Result<()> {
|
|||
Url::from_directory_path(&root).unwrap().as_str()
|
||||
})?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.lock().env_remove("UV_EXCLUDE_NEWER"), @r###"
|
||||
uv_snapshot!(context.filters(), context.lock().env_remove(EnvVars::UV_EXCLUDE_NEWER), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -7801,7 +7802,7 @@ fn lock_local_index() -> Result<()> {
|
|||
});
|
||||
|
||||
// Re-run with `--locked`.
|
||||
uv_snapshot!(context.filters(), context.lock().arg("--locked").env_remove("UV_EXCLUDE_NEWER"), @r###"
|
||||
uv_snapshot!(context.filters(), context.lock().arg("--locked").env_remove(EnvVars::UV_EXCLUDE_NEWER), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -7811,7 +7812,7 @@ fn lock_local_index() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// Install from the lockfile.
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--frozen").env_remove("UV_EXCLUDE_NEWER"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--frozen").env_remove(EnvVars::UV_EXCLUDE_NEWER), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -13,6 +13,8 @@ use assert_cmd::assert::OutputAssertExt;
|
|||
use assert_fs::prelude::*;
|
||||
use insta::assert_snapshot;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{packse_index_url, uv_snapshot, TestContext};
|
||||
|
||||
/// This test ensures that multiple non-conflicting but also
|
||||
|
@ -65,7 +67,7 @@ fn fork_allows_non_conflicting_non_overlapping_dependencies() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -121,7 +123,7 @@ fn fork_allows_non_conflicting_non_overlapping_dependencies() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -182,7 +184,7 @@ fn fork_allows_non_conflicting_repeated_dependencies() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -233,7 +235,7 @@ fn fork_allows_non_conflicting_repeated_dependencies() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -281,7 +283,7 @@ fn fork_basic() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -353,7 +355,7 @@ fn fork_basic() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -415,7 +417,7 @@ fn conflict_in_fork() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: false
|
||||
|
@ -483,7 +485,7 @@ fn fork_conflict_unsatisfiable() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: false
|
||||
|
@ -566,7 +568,7 @@ fn fork_filter_sibling_dependencies() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -690,7 +692,7 @@ fn fork_filter_sibling_dependencies() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -744,7 +746,7 @@ fn fork_upgrade() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -804,7 +806,7 @@ fn fork_upgrade() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -864,7 +866,7 @@ fn fork_incomplete_markers() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -959,7 +961,7 @@ fn fork_incomplete_markers() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -1017,7 +1019,7 @@ fn fork_marker_accrue() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -1093,7 +1095,7 @@ fn fork_marker_accrue() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -1150,7 +1152,7 @@ fn fork_marker_disjoint() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: false
|
||||
|
@ -1220,7 +1222,7 @@ fn fork_marker_inherit_combined_allowed() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -1336,7 +1338,7 @@ fn fork_marker_inherit_combined_allowed() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -1400,7 +1402,7 @@ fn fork_marker_inherit_combined_disallowed() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -1504,7 +1506,7 @@ fn fork_marker_inherit_combined_disallowed() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -1569,7 +1571,7 @@ fn fork_marker_inherit_combined() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -1673,7 +1675,7 @@ fn fork_marker_inherit_combined() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -1731,7 +1733,7 @@ fn fork_marker_inherit_isolated() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -1815,7 +1817,7 @@ fn fork_marker_inherit_isolated() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -1879,7 +1881,7 @@ fn fork_marker_inherit_transitive() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -1975,7 +1977,7 @@ fn fork_marker_inherit_transitive() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -2035,7 +2037,7 @@ fn fork_marker_inherit() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -2107,7 +2109,7 @@ fn fork_marker_inherit() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -2173,7 +2175,7 @@ fn fork_marker_limited_inherit() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -2268,7 +2270,7 @@ fn fork_marker_limited_inherit() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -2328,7 +2330,7 @@ fn fork_marker_selection() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -2411,7 +2413,7 @@ fn fork_marker_selection() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -2483,7 +2485,7 @@ fn fork_marker_track() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -2578,7 +2580,7 @@ fn fork_marker_track() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -2635,7 +2637,7 @@ fn fork_non_fork_marker_transitive() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -2711,7 +2713,7 @@ fn fork_non_fork_marker_transitive() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -2769,7 +2771,7 @@ fn fork_non_local_fork_marker_direct() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: false
|
||||
|
@ -2841,7 +2843,7 @@ fn fork_non_local_fork_marker_transitive() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: false
|
||||
|
@ -2934,7 +2936,7 @@ fn fork_overlapping_markers_basic() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -2991,7 +2993,7 @@ fn fork_overlapping_markers_basic() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -3101,7 +3103,7 @@ fn preferences_dependent_forking_bistable() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -3231,7 +3233,7 @@ fn preferences_dependent_forking_bistable() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -3337,7 +3339,7 @@ fn preferences_dependent_forking_conflicting() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -3479,7 +3481,7 @@ fn preferences_dependent_forking_tristable() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -3657,7 +3659,7 @@ fn preferences_dependent_forking_tristable() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -3762,7 +3764,7 @@ fn preferences_dependent_forking() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -3858,7 +3860,7 @@ fn preferences_dependent_forking() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -3936,7 +3938,7 @@ fn fork_remaining_universe_partitioning() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -4040,7 +4042,7 @@ fn fork_remaining_universe_partitioning() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -4088,7 +4090,7 @@ fn fork_requires_python_full_prerelease() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -4124,7 +4126,7 @@ fn fork_requires_python_full_prerelease() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -4172,7 +4174,7 @@ fn fork_requires_python_full() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -4208,7 +4210,7 @@ fn fork_requires_python_full() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -4260,7 +4262,7 @@ fn fork_requires_python_patch_overlap() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -4308,7 +4310,7 @@ fn fork_requires_python_patch_overlap() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -4353,7 +4355,7 @@ fn fork_requires_python() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -4389,7 +4391,7 @@ fn fork_requires_python() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -4436,7 +4438,7 @@ fn unreachable_package() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -4484,7 +4486,7 @@ fn unreachable_package() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -4537,7 +4539,7 @@ fn unreachable_wheels() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -4610,7 +4612,7 @@ fn unreachable_wheels() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
@ -4654,7 +4656,7 @@ fn requires_python_wheels() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
uv_snapshot!(filters, cmd, @r#"
|
||||
success: true
|
||||
|
@ -4703,7 +4705,7 @@ fn requires_python_wheels() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
|
|
@ -11,6 +11,7 @@ use url::Url;
|
|||
|
||||
use crate::common::{download_to_disk, uv_snapshot, TestContext};
|
||||
use uv_fs::Simplified;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[test]
|
||||
fn compile_requirements_in() -> Result<()> {
|
||||
|
@ -2189,7 +2190,7 @@ fn allowed_transitive_url_path_dependency() -> Result<()> {
|
|||
let hatchling_path = current_dir()?.join("../../scripts/packages/hatchling_editable");
|
||||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.env("HATCH_PATH", hatchling_path.as_os_str()), @r###"
|
||||
.env(EnvVars::HATCH_PATH, hatchling_path.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2505,7 +2506,7 @@ fn compile_exclude_newer() -> Result<()> {
|
|||
|
||||
uv_snapshot!(context
|
||||
.pip_compile()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--exclude-newer")
|
||||
// 4.64.0: 2022-04-04T01:48:46.194635Z1
|
||||
|
@ -2528,7 +2529,7 @@ fn compile_exclude_newer() -> Result<()> {
|
|||
// We interpret a date as including this day
|
||||
uv_snapshot!(context
|
||||
.pip_compile()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--exclude-newer")
|
||||
.arg("2022-04-04"), @r###"
|
||||
|
@ -2548,7 +2549,7 @@ fn compile_exclude_newer() -> Result<()> {
|
|||
// Check the error message for invalid datetime
|
||||
uv_snapshot!(context
|
||||
.pip_compile()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--exclude-newer")
|
||||
.arg("2022-04-04+02:00"), @r###"
|
||||
|
@ -2568,7 +2569,7 @@ fn compile_exclude_newer() -> Result<()> {
|
|||
// valid date.
|
||||
uv_snapshot!(context
|
||||
.pip_compile()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--exclude-newer")
|
||||
.arg("2022-04-04T26:00:00+00"), @r###"
|
||||
|
@ -3570,7 +3571,7 @@ fn respect_http_env_var() -> Result<()> {
|
|||
|
||||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.env("URL", "https://files.pythonhosted.org/packages/36/42/015c23096649b908c809c69388a805a571a3bea44362fe87e33fc3afa01f/flask-3.0.0-py3-none-any.whl"), @r###"
|
||||
.env(EnvVars::URL, "https://files.pythonhosted.org/packages/36/42/015c23096649b908c809c69388a805a571a3bea44362fe87e33fc3afa01f/flask-3.0.0-py3-none-any.whl"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -3611,7 +3612,7 @@ fn respect_unnamed_env_var() -> Result<()> {
|
|||
|
||||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.env("URL", "https://files.pythonhosted.org/packages/36/42/015c23096649b908c809c69388a805a571a3bea44362fe87e33fc3afa01f/flask-3.0.0-py3-none-any.whl"), @r###"
|
||||
.env(EnvVars::URL, "https://files.pythonhosted.org/packages/36/42/015c23096649b908c809c69388a805a571a3bea44362fe87e33fc3afa01f/flask-3.0.0-py3-none-any.whl"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -3684,7 +3685,7 @@ fn respect_file_env_var() -> Result<()> {
|
|||
|
||||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.env("FILE_PATH", context.temp_dir.join("flask-3.0.0-py3-none-any.whl")), @r###"
|
||||
.env(EnvVars::FILE_PATH, context.temp_dir.join("flask-3.0.0-py3-none-any.whl")), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -4051,7 +4052,7 @@ fn compile_html() -> Result<()> {
|
|||
requirements_in.write_str("jinja2<=3.1.2")?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--index-url")
|
||||
.arg("https://download.pytorch.org/whl"), @r###"
|
||||
|
@ -4546,7 +4547,7 @@ fn find_links_env_var() -> Result<()> {
|
|||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.arg("--no-index")
|
||||
.env("URL", "https://download.pytorch.org/whl/torch_stable.html"), @r###"
|
||||
.env(EnvVars::URL, "https://download.pytorch.org/whl/torch_stable.html"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -4603,7 +4604,7 @@ fn find_links_uv_env_var() -> Result<()> {
|
|||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.arg("--no-index")
|
||||
.env("UV_FIND_LINKS", "https://download.pytorch.org/whl/torch_stable.html"), @r###"
|
||||
.env(EnvVars::UV_FIND_LINKS, "https://download.pytorch.org/whl/torch_stable.html"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -4721,7 +4722,7 @@ fn requires_python_prefetch() -> Result<()> {
|
|||
|
||||
uv_snapshot!(context
|
||||
.pip_compile()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.in"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -5170,7 +5171,7 @@ fn custom_compile_command() -> Result<()> {
|
|||
// with env var
|
||||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.env("UV_CUSTOM_COMPILE_COMMAND", "./custom-uv-compile.sh"), @r###"
|
||||
.env(EnvVars::UV_CUSTOM_COMPILE_COMMAND, "./custom-uv-compile.sh"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -7579,7 +7580,7 @@ fn existing_prerelease_preference() -> Result<()> {
|
|||
"})?;
|
||||
|
||||
uv_snapshot!(context.filters(), windows_filters=false, context.pip_compile()
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("-o")
|
||||
.arg("requirements.txt"), @r###"
|
||||
|
@ -7614,7 +7615,7 @@ fn universal_disjoint_prereleases() -> Result<()> {
|
|||
"})?;
|
||||
|
||||
uv_snapshot!(context.filters(), windows_filters=false, context.pip_compile()
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--universal"), @r###"
|
||||
success: true
|
||||
|
@ -7654,7 +7655,7 @@ fn universal_disjoint_prereleases_preference() -> Result<()> {
|
|||
"})?;
|
||||
|
||||
uv_snapshot!(context.filters(), windows_filters=false, context.pip_compile()
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("-o")
|
||||
.arg("requirements.txt")
|
||||
|
@ -7699,7 +7700,7 @@ fn universal_disjoint_prereleases_preference_marker() -> Result<()> {
|
|||
"})?;
|
||||
|
||||
uv_snapshot!(context.filters(), windows_filters=false, context.pip_compile()
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("-o")
|
||||
.arg("requirements.txt")
|
||||
|
@ -7736,7 +7737,7 @@ fn universal_disjoint_prereleases_allow() -> Result<()> {
|
|||
"})?;
|
||||
|
||||
uv_snapshot!(context.filters(), windows_filters=false, context.pip_compile()
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--universal")
|
||||
.arg("--prerelease")
|
||||
|
@ -7776,7 +7777,7 @@ fn universal_transitive_disjoint_prerelease_requirement() -> Result<()> {
|
|||
"})?;
|
||||
|
||||
uv_snapshot!(context.filters(), windows_filters=false, context.pip_compile()
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--universal"), @r###"
|
||||
success: true
|
||||
|
@ -7818,7 +7819,7 @@ fn universal_prerelease_mode() -> Result<()> {
|
|||
"})?;
|
||||
|
||||
uv_snapshot!(context.filters(), windows_filters=false, context.pip_compile()
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.arg("--prerelease=allow")
|
||||
.arg("requirements.in")
|
||||
.arg("--universal"), @r###"
|
||||
|
@ -7866,7 +7867,7 @@ fn universal_overlapping_prerelease_requirement() -> Result<()> {
|
|||
"})?;
|
||||
|
||||
uv_snapshot!(context.filters(), windows_filters=false, context.pip_compile()
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--universal"), @r###"
|
||||
success: true
|
||||
|
@ -7920,7 +7921,7 @@ fn universal_disjoint_prerelease_requirement() -> Result<()> {
|
|||
// Some marker expressions on the output here are missing due to https://github.com/astral-sh/uv/issues/5086,
|
||||
// but the pre-release versions are still respected correctly.
|
||||
uv_snapshot!(context.filters(), windows_filters=false, context.pip_compile()
|
||||
.env("UV_EXCLUDE_NEWER", EXCLUDE_NEWER)
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--universal"), @r###"
|
||||
success: true
|
||||
|
@ -8940,7 +8941,7 @@ fn empty_index_url_env_var() -> Result<()> {
|
|||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.arg("--emit-index-url")
|
||||
.env("UV_INDEX_URL", ""), @r###"
|
||||
.env(EnvVars::UV_INDEX_URL, ""), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -8973,7 +8974,7 @@ fn empty_extra_index_url_env_var() -> Result<()> {
|
|||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.arg("--emit-index-url")
|
||||
.env("EXTRA_UV_INDEX_URL", ""), @r###"
|
||||
.env(EnvVars::UV_EXTRA_INDEX_URL, ""), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -9007,7 +9008,7 @@ fn empty_index_url_env_var_override() -> Result<()> {
|
|||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.arg("--emit-index-url")
|
||||
.env("UV_INDEX_URL", ""), @r###"
|
||||
.env(EnvVars::UV_INDEX_URL, ""), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -9036,7 +9037,7 @@ fn index_url_env_var_override() -> Result<()> {
|
|||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.arg("--emit-index-url")
|
||||
.env("UV_INDEX_URL", "https://test.pypi.org/simple"), @r###"
|
||||
.env(EnvVars::UV_INDEX_URL, "https://test.pypi.org/simple"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -9320,7 +9321,7 @@ fn no_stream() -> Result<()> {
|
|||
|
||||
uv_snapshot!(context
|
||||
.pip_compile()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("-c")
|
||||
.arg("constraints.in")
|
||||
|
@ -9419,7 +9420,7 @@ fn compile_root_uri_editable() -> Result<()> {
|
|||
let root_path = current_dir()?.join("../../scripts/packages/root_editable");
|
||||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.env("ROOT_PATH", root_path.as_os_str()), @r###"
|
||||
.env(EnvVars::ROOT_PATH, root_path.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -9450,8 +9451,8 @@ fn compile_root_uri_non_editable() -> Result<()> {
|
|||
let black_path = current_dir()?.join("../../scripts/packages/black_editable");
|
||||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.env("ROOT_PATH", root_path.as_os_str())
|
||||
.env("BLACK_PATH", black_path.as_os_str()), @r###"
|
||||
.env(EnvVars::ROOT_PATH, root_path.as_os_str())
|
||||
.env(EnvVars::BLACK_PATH, black_path.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -10892,7 +10893,7 @@ fn emit_index_annotation_hide_password() -> Result<()> {
|
|||
uv_snapshot!(context.filters(), context.pip_compile()
|
||||
.arg("requirements.in")
|
||||
.arg("--emit-index-annotation")
|
||||
.env("UV_INDEX_URL", "https://test-user:test-password@pypi.org/simple"), @r###"
|
||||
.env(EnvVars::UV_INDEX_URL, "https://test-user:test-password@pypi.org/simple"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -11715,7 +11716,7 @@ fn no_binary_only_binary() -> Result<()> {
|
|||
|
||||
uv_snapshot!(context
|
||||
.pip_compile()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--only-binary")
|
||||
.arg(":all:"), @r###"
|
||||
|
@ -11732,7 +11733,7 @@ fn no_binary_only_binary() -> Result<()> {
|
|||
|
||||
uv_snapshot!(context
|
||||
.pip_compile()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.in")
|
||||
.arg("--only-binary")
|
||||
.arg(":all:")
|
||||
|
|
|
@ -13,6 +13,8 @@ use assert_cmd::assert::OutputAssertExt;
|
|||
use assert_fs::fixture::{FileWriteStr, PathChild};
|
||||
use predicates::prelude::predicate;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{
|
||||
build_vendor_links_url, get_bin, packse_index_url, python_path_with_versions, uv_snapshot,
|
||||
TestContext,
|
||||
|
@ -32,8 +34,8 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command {
|
|||
.arg("--find-links")
|
||||
.arg(build_vendor_links_url());
|
||||
context.add_shared_args(&mut command, true);
|
||||
command.env_remove("UV_EXCLUDE_NEWER");
|
||||
command.env("UV_TEST_PYTHON_PATH", python_path);
|
||||
command.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
command.env(EnvVars::UV_TEST_PYTHON_PATH, python_path);
|
||||
|
||||
command
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ use crate::common::{
|
|||
self, build_vendor_links_url, decode_token, get_bin, uv_snapshot, venv_bin_path, TestContext,
|
||||
};
|
||||
use uv_fs::Simplified;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[test]
|
||||
fn missing_requirements_txt() {
|
||||
|
@ -1393,7 +1394,7 @@ fn install_extra_index_url_has_priority() {
|
|||
let context = TestContext::new("3.12");
|
||||
|
||||
uv_snapshot!(context.pip_install()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple")
|
||||
.arg("--extra-index-url")
|
||||
|
@ -3953,7 +3954,7 @@ fn respect_no_build_isolation_env_var() -> Result<()> {
|
|||
uv_snapshot!(filters, context.pip_install()
|
||||
.arg("-r")
|
||||
.arg("requirements.in")
|
||||
.env("UV_NO_BUILD_ISOLATION", "yes"), @r###"
|
||||
.env(EnvVars::UV_NO_BUILD_ISOLATION, "yes"), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -3990,7 +3991,7 @@ fn respect_no_build_isolation_env_var() -> Result<()> {
|
|||
uv_snapshot!(context.pip_install()
|
||||
.arg("-r")
|
||||
.arg("requirements.in")
|
||||
.env("UV_NO_BUILD_ISOLATION", "yes"), @r###"
|
||||
.env(EnvVars::UV_NO_BUILD_ISOLATION, "yes"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -4018,7 +4019,7 @@ fn install_utf16le_requirements() -> Result<()> {
|
|||
requirements_txt.write_binary(&utf8_to_utf16_with_bom_le("tomli<=2.0.1"))?;
|
||||
|
||||
uv_snapshot!(context.pip_install()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("-r")
|
||||
.arg("requirements.txt"), @r###"
|
||||
success: true
|
||||
|
@ -4045,7 +4046,7 @@ fn install_utf16be_requirements() -> Result<()> {
|
|||
requirements_txt.write_binary(&utf8_to_utf16_with_bom_be("tomli<=2.0.1"))?;
|
||||
|
||||
uv_snapshot!(context.pip_install()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("-r")
|
||||
.arg("requirements.txt"), @r###"
|
||||
success: true
|
||||
|
@ -4419,7 +4420,7 @@ fn install_package_basic_auth_from_netrc_default() -> Result<()> {
|
|||
.arg("anyio")
|
||||
.arg("--index-url")
|
||||
.arg("https://pypi-proxy.fly.dev/basic-auth/simple")
|
||||
.env("NETRC", netrc.to_str().unwrap())
|
||||
.env(EnvVars::NETRC, netrc.to_str().unwrap())
|
||||
.arg("--strict"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -4451,7 +4452,7 @@ fn install_package_basic_auth_from_netrc() -> Result<()> {
|
|||
.arg("anyio")
|
||||
.arg("--index-url")
|
||||
.arg("https://pypi-proxy.fly.dev/basic-auth/simple")
|
||||
.env("NETRC", netrc.to_str().unwrap())
|
||||
.env(EnvVars::NETRC, netrc.to_str().unwrap())
|
||||
.arg("--strict"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -4491,7 +4492,7 @@ anyio
|
|||
uv_snapshot!(context.pip_install()
|
||||
.arg("-r")
|
||||
.arg("requirements.txt")
|
||||
.env("NETRC", netrc.to_str().unwrap())
|
||||
.env(EnvVars::NETRC, netrc.to_str().unwrap())
|
||||
.arg("--strict"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -4564,8 +4565,8 @@ fn install_package_basic_auth_from_keyring() {
|
|||
.arg("--keyring-provider")
|
||||
.arg("subprocess")
|
||||
.arg("--strict")
|
||||
.env("KEYRING_TEST_CREDENTIALS", r#"{"pypi-proxy.fly.dev": {"public": "heron"}}"#)
|
||||
.env("PATH", venv_bin_path(&context.venv)), @r###"
|
||||
.env(EnvVars::KEYRING_TEST_CREDENTIALS, r#"{"pypi-proxy.fly.dev": {"public": "heron"}}"#)
|
||||
.env(EnvVars::PATH, venv_bin_path(&context.venv)), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -4611,8 +4612,8 @@ fn install_package_basic_auth_from_keyring_wrong_password() {
|
|||
.arg("--keyring-provider")
|
||||
.arg("subprocess")
|
||||
.arg("--strict")
|
||||
.env("KEYRING_TEST_CREDENTIALS", r#"{"pypi-proxy.fly.dev": {"public": "foobar"}}"#)
|
||||
.env("PATH", venv_bin_path(&context.venv)), @r###"
|
||||
.env(EnvVars::KEYRING_TEST_CREDENTIALS, r#"{"pypi-proxy.fly.dev": {"public": "foobar"}}"#)
|
||||
.env(EnvVars::PATH, venv_bin_path(&context.venv)), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -4652,8 +4653,8 @@ fn install_package_basic_auth_from_keyring_wrong_username() {
|
|||
.arg("--keyring-provider")
|
||||
.arg("subprocess")
|
||||
.arg("--strict")
|
||||
.env("KEYRING_TEST_CREDENTIALS", r#"{"pypi-proxy.fly.dev": {"other": "heron"}}"#)
|
||||
.env("PATH", venv_bin_path(&context.venv)), @r###"
|
||||
.env(EnvVars::KEYRING_TEST_CREDENTIALS, r#"{"pypi-proxy.fly.dev": {"other": "heron"}}"#)
|
||||
.env(EnvVars::PATH, venv_bin_path(&context.venv)), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -6447,7 +6448,7 @@ fn local_index_absolute() -> Result<()> {
|
|||
"#, Url::from_directory_path(context.workspace_root.join("scripts/links/")).unwrap().as_str()})?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.pip_install()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("tqdm")
|
||||
.arg("--index-url")
|
||||
.arg(Url::from_directory_path(root).unwrap().as_str()), @r###"
|
||||
|
@ -6498,7 +6499,7 @@ fn local_index_relative() -> Result<()> {
|
|||
"#, Url::from_directory_path(context.workspace_root.join("scripts/links/")).unwrap().as_str()})?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.pip_install()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("tqdm")
|
||||
.arg("--index-url")
|
||||
.arg("./simple-html"), @r###"
|
||||
|
@ -6555,7 +6556,7 @@ fn local_index_requirements_txt_absolute() -> Result<()> {
|
|||
"#, Url::from_directory_path(root).unwrap().as_str()})?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.pip_install()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("-r")
|
||||
.arg("requirements.txt"), @r###"
|
||||
success: true
|
||||
|
@ -6613,7 +6614,7 @@ fn local_index_requirements_txt_relative() -> Result<()> {
|
|||
)?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.pip_install()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("-r")
|
||||
.arg("requirements.txt"), @r###"
|
||||
success: true
|
||||
|
|
|
@ -11,6 +11,8 @@ use std::process::Command;
|
|||
use assert_cmd::assert::Assert;
|
||||
use assert_cmd::prelude::*;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{
|
||||
build_vendor_links_url, get_bin, packse_index_url, uv_snapshot, venv_to_interpreter,
|
||||
TestContext,
|
||||
|
@ -49,7 +51,7 @@ fn command(context: &TestContext) -> Command {
|
|||
.arg("--find-links")
|
||||
.arg(build_vendor_links_url());
|
||||
context.add_shared_args(&mut command, true);
|
||||
command.env_remove("UV_EXCLUDE_NEWER");
|
||||
command.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
command
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ use assert_fs::fixture::FileWriteStr;
|
|||
use assert_fs::fixture::PathChild;
|
||||
use indoc::indoc;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
#[test]
|
||||
|
@ -377,7 +379,7 @@ fn show_editable() -> Result<()> {
|
|||
.arg("../../scripts/packages/poetry_editable")
|
||||
.current_dir(current_dir()?)
|
||||
.env(
|
||||
"CARGO_TARGET_DIR",
|
||||
EnvVars::CARGO_TARGET_DIR,
|
||||
"../../../target/target_install_editable",
|
||||
)
|
||||
.assert()
|
||||
|
|
|
@ -16,6 +16,7 @@ use crate::common::{
|
|||
TestContext,
|
||||
};
|
||||
use uv_fs::Simplified;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
fn check_command(venv: &Path, command: &str, temp_dir: &Path) {
|
||||
Command::new(venv_to_interpreter(venv))
|
||||
|
@ -427,7 +428,7 @@ fn link() -> Result<()> {
|
|||
// Create a separate virtual environment, but reuse the same cache.
|
||||
let context2 = TestContext::new("3.12");
|
||||
let mut cmd = context1.pip_sync();
|
||||
cmd.env("VIRTUAL_ENV", context2.venv.as_os_str())
|
||||
cmd.env(EnvVars::VIRTUAL_ENV, context2.venv.as_os_str())
|
||||
.current_dir(&context2.temp_dir);
|
||||
|
||||
uv_snapshot!(cmd
|
||||
|
@ -706,7 +707,7 @@ fn install_sdist() -> Result<()> {
|
|||
requirements_txt.write_str("source-distribution==0.0.1")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--strict"), @r###"
|
||||
success: true
|
||||
|
@ -1539,7 +1540,7 @@ fn install_registry_source_dist_cached() -> Result<()> {
|
|||
requirements_txt.write_str("source_distribution==0.0.1")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--strict"), @r###"
|
||||
success: true
|
||||
|
@ -1562,7 +1563,7 @@ fn install_registry_source_dist_cached() -> Result<()> {
|
|||
context.reset_venv();
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--strict")
|
||||
, @r###"
|
||||
|
@ -1609,7 +1610,7 @@ fn install_registry_source_dist_cached() -> Result<()> {
|
|||
);
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--strict")
|
||||
, @r###"
|
||||
|
@ -3347,7 +3348,7 @@ fn no_stream() -> Result<()> {
|
|||
.write_str("hashb_foxglove_protocolbuffers_python==25.3.0.1.20240226043130+465630478360")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--index-url")
|
||||
.arg("https://buf.build/gen/python"), @r###"
|
||||
|
@ -3626,7 +3627,7 @@ fn require_hashes_source_no_binary() -> Result<()> {
|
|||
.write_str("source-distribution==0.0.1 --hash=sha256:1f83ed7498336c7f2ab9b002cf22583d91115ebc624053dc4eb3a45694490106")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--no-binary")
|
||||
.arg(":all:")
|
||||
|
@ -4827,7 +4828,7 @@ fn require_hashes_registry_no_hash() -> Result<()> {
|
|||
.write_str("example-a-961b4c22==1.0.0 --hash=sha256:5d69f0b590514103234f0c3526563856f04d044d8d0ea1073a843ae429b3187e")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--require-hashes")
|
||||
.arg("--index-url")
|
||||
|
@ -4857,7 +4858,7 @@ fn require_hashes_registry_valid_hash() -> Result<()> {
|
|||
.write_str("example-a-961b4c22==1.0.0 --hash=sha256:5d69f0b590514103234f0c3526563856f04d044d8d0ea1073a843ae429b3187e")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--require-hashes")
|
||||
.arg("--find-links")
|
||||
|
@ -4885,7 +4886,7 @@ fn require_hashes_registry_invalid_hash() -> Result<()> {
|
|||
requirements_txt.write_str("example-a-961b4c22==1.0.0 --hash=sha256:123")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--reinstall")
|
||||
.arg("--require-hashes")
|
||||
|
@ -4915,7 +4916,7 @@ fn require_hashes_registry_invalid_hash() -> Result<()> {
|
|||
.write_str("example-a-961b4c22==1.0.0 --hash=sha256:8838f9d005ff0432b258ba648d9cabb1cbdf06ac29d14f788b02edae544032ea")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--reinstall")
|
||||
.arg("--require-hashes")
|
||||
|
@ -4946,7 +4947,7 @@ fn require_hashes_registry_invalid_hash() -> Result<()> {
|
|||
.write_str("example-a-961b4c22==1.0.0 --hash=sha256:5d69f0b590514103234f0c3526563856f04d044d8d0ea1073a843ae429b3187e")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--reinstall")
|
||||
.arg("--require-hashes")
|
||||
|
@ -4971,7 +4972,7 @@ fn require_hashes_registry_invalid_hash() -> Result<()> {
|
|||
.write_str("example-a-961b4c22==1.0.0 --hash=sha256:5d69f0b590514103234f0c3526563856f04d044d8d0ea1073a843ae429b3187e")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--refresh")
|
||||
.arg("--reinstall")
|
||||
|
@ -4998,7 +4999,7 @@ fn require_hashes_registry_invalid_hash() -> Result<()> {
|
|||
.write_str("example-a-961b4c22==1.0.0 --hash=sha256:5d69f0b590514103234f0c3526563856f04d044d8d0ea1073a843ae429b3187e --hash=sha256:a3cf07a05aac526131a2e8b6e4375ee6c6eaac8add05b88035e960ac6cd999ee")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--refresh")
|
||||
.arg("--reinstall")
|
||||
|
@ -5037,7 +5038,7 @@ fn require_hashes_url() -> Result<()> {
|
|||
.write_str("iniconfig @ https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl#sha256=b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--require-hashes"), @r###"
|
||||
success: true
|
||||
|
@ -5065,7 +5066,7 @@ fn require_hashes_url_other_fragment() -> Result<()> {
|
|||
.write_str("iniconfig @ https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl#foo=bar")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--require-hashes"), @r###"
|
||||
success: false
|
||||
|
@ -5090,7 +5091,7 @@ fn require_hashes_url_invalid() -> Result<()> {
|
|||
.write_str("iniconfig @ https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl#sha256=c6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--require-hashes"), @r###"
|
||||
success: false
|
||||
|
@ -5124,7 +5125,7 @@ fn require_hashes_url_ignore() -> Result<()> {
|
|||
.write_str("iniconfig @ https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl#sha256=b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 --hash sha256:c6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--require-hashes"), @r###"
|
||||
success: false
|
||||
|
@ -5158,7 +5159,7 @@ fn require_hashes_url_unnamed() -> Result<()> {
|
|||
.write_str("https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl#sha256=b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374")?;
|
||||
|
||||
uv_snapshot!(context.pip_sync()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("requirements.txt")
|
||||
.arg("--require-hashes"), @r###"
|
||||
success: true
|
||||
|
@ -5211,7 +5212,7 @@ fn target_built_distribution() -> Result<()> {
|
|||
.arg("-B")
|
||||
.arg("-c")
|
||||
.arg("import iniconfig")
|
||||
.env("PYTHONPATH", context.temp_dir.child("target").path())
|
||||
.env(EnvVars::PYTHONPATH, context.temp_dir.child("target").path())
|
||||
.current_dir(&context.temp_dir)
|
||||
.assert()
|
||||
.success();
|
||||
|
@ -5308,7 +5309,7 @@ fn target_source_distribution() -> Result<()> {
|
|||
.arg("-B")
|
||||
.arg("-c")
|
||||
.arg("import iniconfig")
|
||||
.env("PYTHONPATH", context.temp_dir.child("target").path())
|
||||
.env(EnvVars::PYTHONPATH, context.temp_dir.child("target").path())
|
||||
.current_dir(&context.temp_dir)
|
||||
.assert()
|
||||
.success();
|
||||
|
@ -5375,7 +5376,7 @@ fn target_no_build_isolation() -> Result<()> {
|
|||
.arg("-B")
|
||||
.arg("-c")
|
||||
.arg("import wheel")
|
||||
.env("PYTHONPATH", context.temp_dir.child("target").path())
|
||||
.env(EnvVars::PYTHONPATH, context.temp_dir.child("target").path())
|
||||
.current_dir(&context.temp_dir)
|
||||
.assert()
|
||||
.success();
|
||||
|
@ -5418,7 +5419,7 @@ fn prefix() -> Result<()> {
|
|||
.arg("-c")
|
||||
.arg("import iniconfig")
|
||||
.env(
|
||||
"PYTHONPATH",
|
||||
EnvVars::PYTHONPATH,
|
||||
site_packages_path(&context.temp_dir.join("prefix"), "python3.12"),
|
||||
)
|
||||
.current_dir(&context.temp_dir)
|
||||
|
|
|
@ -3,6 +3,8 @@ use std::process::Command;
|
|||
use assert_fs::fixture::FileWriteStr;
|
||||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::get_bin;
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
|
@ -334,8 +336,8 @@ fn depth() {
|
|||
.arg(context.cache_dir.path())
|
||||
.arg("--depth")
|
||||
.arg("0")
|
||||
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||
.env("UV_NO_WRAP", "1")
|
||||
.env(EnvVars::VIRTUAL_ENV, context.venv.as_os_str())
|
||||
.env(EnvVars::UV_NO_WRAP, "1")
|
||||
.current_dir(&context.temp_dir), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -354,8 +356,8 @@ fn depth() {
|
|||
.arg(context.cache_dir.path())
|
||||
.arg("--depth")
|
||||
.arg("1")
|
||||
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||
.env("UV_NO_WRAP", "1")
|
||||
.env(EnvVars::VIRTUAL_ENV, context.venv.as_os_str())
|
||||
.env(EnvVars::UV_NO_WRAP, "1")
|
||||
.current_dir(&context.temp_dir), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -378,8 +380,8 @@ fn depth() {
|
|||
.arg(context.cache_dir.path())
|
||||
.arg("--depth")
|
||||
.arg("2")
|
||||
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||
.env("UV_NO_WRAP", "1")
|
||||
.env(EnvVars::VIRTUAL_ENV, context.venv.as_os_str())
|
||||
.env(EnvVars::UV_NO_WRAP, "1")
|
||||
.current_dir(&context.temp_dir), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -432,8 +434,8 @@ fn prune() {
|
|||
.arg(context.cache_dir.path())
|
||||
.arg("--prune")
|
||||
.arg("numpy")
|
||||
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||
.env("UV_NO_WRAP", "1")
|
||||
.env(EnvVars::VIRTUAL_ENV, context.venv.as_os_str())
|
||||
.env(EnvVars::UV_NO_WRAP, "1")
|
||||
.current_dir(&context.temp_dir), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -456,8 +458,8 @@ fn prune() {
|
|||
.arg("numpy")
|
||||
.arg("--prune")
|
||||
.arg("joblib")
|
||||
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||
.env("UV_NO_WRAP", "1")
|
||||
.env(EnvVars::VIRTUAL_ENV, context.venv.as_os_str())
|
||||
.env(EnvVars::UV_NO_WRAP, "1")
|
||||
.current_dir(&context.temp_dir), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -477,8 +479,8 @@ fn prune() {
|
|||
.arg(context.cache_dir.path())
|
||||
.arg("--prune")
|
||||
.arg("scipy")
|
||||
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||
.env("UV_NO_WRAP", "1")
|
||||
.env(EnvVars::VIRTUAL_ENV, context.venv.as_os_str())
|
||||
.env(EnvVars::UV_NO_WRAP, "1")
|
||||
.current_dir(&context.temp_dir), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -780,8 +782,8 @@ fn prune_large_tree() {
|
|||
.arg(context.cache_dir.path())
|
||||
.arg("--prune")
|
||||
.arg("hatchling")
|
||||
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||
.env("UV_NO_WRAP", "1")
|
||||
.env(EnvVars::VIRTUAL_ENV, context.venv.as_os_str())
|
||||
.env(EnvVars::UV_NO_WRAP, "1")
|
||||
.current_dir(&context.temp_dir), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -839,7 +841,7 @@ fn cyclic_dependency() {
|
|||
.unwrap();
|
||||
|
||||
let mut command = context.pip_install();
|
||||
command.env_remove("UV_EXCLUDE_NEWER");
|
||||
command.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
command
|
||||
.arg("-r")
|
||||
.arg("requirements.txt")
|
||||
|
@ -1177,7 +1179,7 @@ fn no_dedupe_and_cycle() {
|
|||
);
|
||||
|
||||
let mut command = context.pip_install();
|
||||
command.env_remove("UV_EXCLUDE_NEWER");
|
||||
command.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
command
|
||||
.arg("uv-cyclic-dependencies-c==0.1.0")
|
||||
.arg("--index-url")
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
#[test]
|
||||
|
@ -8,7 +10,7 @@ fn python_dir() {
|
|||
|
||||
let python_dir = context.temp_dir.child("python");
|
||||
uv_snapshot!(context.filters(), context.python_dir()
|
||||
.env("UV_PYTHON_INSTALL_DIR", python_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_PYTHON_INSTALL_DIR, python_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -2,7 +2,9 @@ use assert_fs::prelude::PathChild;
|
|||
use assert_fs::{fixture::FileWriteStr, prelude::PathCreateDir};
|
||||
use fs_err::remove_dir_all;
|
||||
use indoc::indoc;
|
||||
|
||||
use uv_python::platform::{Arch, Os};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
|
@ -12,7 +14,7 @@ fn python_find() {
|
|||
|
||||
// No interpreters on the path
|
||||
if cfg!(windows) {
|
||||
uv_snapshot!(context.filters(), context.python_find().env("UV_TEST_PYTHON_PATH", ""), @r###"
|
||||
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -21,7 +23,7 @@ fn python_find() {
|
|||
error: No interpreter found in virtual environments, managed installations, system path, or `py` launcher
|
||||
"###);
|
||||
} else {
|
||||
uv_snapshot!(context.filters(), context.python_find().env("UV_TEST_PYTHON_PATH", ""), @r###"
|
||||
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_TEST_PYTHON_PATH, ""), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -274,7 +276,7 @@ fn python_find_venv() {
|
|||
|
||||
// Even if the `VIRTUAL_ENV` is not set (the test context includes this by default)
|
||||
#[cfg(not(windows))]
|
||||
uv_snapshot!(context.filters(), context.python_find().env_remove("VIRTUAL_ENV"), @r###"
|
||||
uv_snapshot!(context.filters(), context.python_find().env_remove(EnvVars::VIRTUAL_ENV), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -297,7 +299,7 @@ fn python_find_venv() {
|
|||
"###);
|
||||
|
||||
// Or, `UV_SYSTEM_PYTHON` is set
|
||||
uv_snapshot!(context.filters(), context.python_find().env("UV_SYSTEM_PYTHON", "1"), @r###"
|
||||
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::UV_SYSTEM_PYTHON, "1"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -308,7 +310,7 @@ fn python_find_venv() {
|
|||
|
||||
// Unless, `--no-system` is included
|
||||
// TODO(zanieb): Report this as a bug upstream — this should be allowed.
|
||||
uv_snapshot!(context.filters(), context.python_find().arg("--no-system").env("UV_SYSTEM_PYTHON", "1"), @r###"
|
||||
uv_snapshot!(context.filters(), context.python_find().arg("--no-system").env(EnvVars::UV_SYSTEM_PYTHON, "1"), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -323,7 +325,7 @@ fn python_find_venv() {
|
|||
|
||||
// We should find virtual environments from a child directory
|
||||
#[cfg(not(windows))]
|
||||
uv_snapshot!(context.filters(), context.python_find().current_dir(&child_dir).env_remove("VIRTUAL_ENV"), @r###"
|
||||
uv_snapshot!(context.filters(), context.python_find().current_dir(&child_dir).env_remove(EnvVars::VIRTUAL_ENV), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -342,7 +344,7 @@ fn python_find_venv() {
|
|||
"###);
|
||||
|
||||
#[cfg(not(windows))]
|
||||
uv_snapshot!(context.filters(), context.python_find().current_dir(&child_dir).env_remove("VIRTUAL_ENV"), @r###"
|
||||
uv_snapshot!(context.filters(), context.python_find().current_dir(&child_dir).env_remove(EnvVars::VIRTUAL_ENV), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -377,7 +379,7 @@ fn python_find_venv() {
|
|||
|
||||
// Or activated via `VIRTUAL_ENV`
|
||||
#[cfg(not(windows))]
|
||||
uv_snapshot!(context.filters(), context.python_find().env("VIRTUAL_ENV", child_dir.join(".venv").as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), context.python_find().env(EnvVars::VIRTUAL_ENV, child_dir.join(".venv").as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -8,6 +8,7 @@ use predicates::str::contains;
|
|||
use std::path::Path;
|
||||
|
||||
use uv_python::PYTHON_VERSION_FILENAME;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{copy_dir_all, uv_snapshot, TestContext};
|
||||
|
||||
|
@ -92,7 +93,7 @@ fn run_with_python_version() -> Result<()> {
|
|||
.arg("python")
|
||||
.arg("-B")
|
||||
.arg("main.py")
|
||||
.env_remove("VIRTUAL_ENV");
|
||||
.env_remove(EnvVars::VIRTUAL_ENV);
|
||||
|
||||
uv_snapshot!(context.filters(), command_with_args, @r###"
|
||||
success: true
|
||||
|
@ -122,7 +123,7 @@ fn run_with_python_version() -> Result<()> {
|
|||
.arg("python")
|
||||
.arg("-B")
|
||||
.arg("main.py")
|
||||
.env_remove("VIRTUAL_ENV");
|
||||
.env_remove(EnvVars::VIRTUAL_ENV);
|
||||
|
||||
uv_snapshot!(context.filters(), command_with_args, @r###"
|
||||
success: false
|
||||
|
@ -1603,7 +1604,7 @@ fn run_without_output() -> Result<()> {
|
|||
})?;
|
||||
|
||||
// On the first run, we only show the summary line for each environment.
|
||||
uv_snapshot!(context.filters(), context.run().env_remove("UV_SHOW_RESOLUTION").arg("--with").arg("iniconfig").arg("main.py"), @r###"
|
||||
uv_snapshot!(context.filters(), context.run().env_remove(EnvVars::UV_SHOW_RESOLUTION).arg("--with").arg("iniconfig").arg("main.py"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1614,7 +1615,7 @@ fn run_without_output() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// Subsequent runs are quiet.
|
||||
uv_snapshot!(context.filters(), context.run().env_remove("UV_SHOW_RESOLUTION").arg("--with").arg("iniconfig").arg("main.py"), @r###"
|
||||
uv_snapshot!(context.filters(), context.run().env_remove(EnvVars::UV_SHOW_RESOLUTION).arg("--with").arg("iniconfig").arg("main.py"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -5,6 +5,8 @@ use axoupdater::{
|
|||
ReleaseSourceType,
|
||||
};
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::get_bin;
|
||||
|
||||
#[test]
|
||||
|
@ -12,7 +14,10 @@ fn check_self_update() {
|
|||
// To maximally emulate behaviour in practice, this test actually modifies CARGO_HOME
|
||||
// and therefore should only be run in CI by default, where it can't hurt developers.
|
||||
// We use the "CI" env-var that CI machines tend to run
|
||||
if std::env::var("CI").map(|s| s.is_empty()).unwrap_or(true) {
|
||||
if std::env::var(EnvVars::CI)
|
||||
.map(|s| s.is_empty())
|
||||
.unwrap_or(true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
use std::process::Command;
|
||||
|
||||
use assert_fs::prelude::*;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
/// and operating system.
|
||||
fn add_shared_args(mut command: Command) -> Command {
|
||||
command
|
||||
.env("UV_LINK_MODE", "clone")
|
||||
.env("UV_CONCURRENT_DOWNLOADS", "50")
|
||||
.env("UV_CONCURRENT_BUILDS", "16")
|
||||
.env("UV_CONCURRENT_INSTALLS", "8");
|
||||
.env(EnvVars::UV_LINK_MODE, "clone")
|
||||
.env(EnvVars::UV_CONCURRENT_DOWNLOADS, "50")
|
||||
.env(EnvVars::UV_CONCURRENT_BUILDS, "16")
|
||||
.env(EnvVars::UV_CONCURRENT_INSTALLS, "8");
|
||||
command
|
||||
}
|
||||
|
||||
|
@ -1972,7 +1973,7 @@ fn resolve_user_configuration() -> anyhow::Result<()> {
|
|||
uv_snapshot!(context.filters(), add_shared_args(context.pip_compile())
|
||||
.arg("--show-settings")
|
||||
.arg("requirements.in")
|
||||
.env("XDG_CONFIG_HOME", xdg.path()), @r###"
|
||||
.env(EnvVars::XDG_CONFIG_HOME, xdg.path()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2098,7 +2099,7 @@ fn resolve_user_configuration() -> anyhow::Result<()> {
|
|||
uv_snapshot!(context.filters(), add_shared_args(context.pip_compile())
|
||||
.arg("--show-settings")
|
||||
.arg("requirements.in")
|
||||
.env("XDG_CONFIG_HOME", xdg.path()), @r###"
|
||||
.env(EnvVars::XDG_CONFIG_HOME, xdg.path()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2224,7 +2225,7 @@ fn resolve_user_configuration() -> anyhow::Result<()> {
|
|||
uv_snapshot!(context.filters(), add_shared_args(context.pip_compile())
|
||||
.arg("--show-settings")
|
||||
.arg("requirements.in")
|
||||
.env("XDG_CONFIG_HOME", xdg.path()), @r###"
|
||||
.env(EnvVars::XDG_CONFIG_HOME, xdg.path()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2352,7 +2353,7 @@ fn resolve_user_configuration() -> anyhow::Result<()> {
|
|||
uv_snapshot!(context.filters(), add_shared_args(context.pip_compile())
|
||||
.arg("--show-settings")
|
||||
.arg("requirements.in")
|
||||
.env("XDG_CONFIG_HOME", xdg.path()), @r###"
|
||||
.env(EnvVars::XDG_CONFIG_HOME, xdg.path()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2499,7 +2500,7 @@ fn resolve_tool() -> anyhow::Result<()> {
|
|||
uv_snapshot!(context.filters(), add_shared_args(context.tool_install())
|
||||
.arg("--show-settings")
|
||||
.arg("requirements.in")
|
||||
.env("XDG_CONFIG_HOME", xdg.path()), @r###"
|
||||
.env(EnvVars::XDG_CONFIG_HOME, xdg.path()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -7,6 +7,7 @@ use predicates::prelude::predicate;
|
|||
use tempfile::tempdir_in;
|
||||
|
||||
use crate::common::{download_to_disk, uv_snapshot, venv_bin_path, TestContext};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[test]
|
||||
fn sync() -> Result<()> {
|
||||
|
@ -1643,7 +1644,7 @@ fn sync_custom_environment_path() -> Result<()> {
|
|||
.assert(predicate::path::is_dir());
|
||||
|
||||
// Running `uv sync` should create `foo` in the project directory when customized
|
||||
uv_snapshot!(context.filters(), context.sync().env("UV_PROJECT_ENVIRONMENT", "foo"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1668,7 +1669,7 @@ fn sync_custom_environment_path() -> Result<()> {
|
|||
.assert(predicate::path::is_dir());
|
||||
|
||||
// An absolute path can be provided
|
||||
uv_snapshot!(context.filters(), context.sync().env("UV_PROJECT_ENVIRONMENT", "foobar/.venv"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::UV_PROJECT_ENVIRONMENT, "foobar/.venv"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1693,7 +1694,7 @@ fn sync_custom_environment_path() -> Result<()> {
|
|||
.assert(predicate::path::is_dir());
|
||||
|
||||
// An absolute path can be provided
|
||||
uv_snapshot!(context.filters(), context.sync().env("UV_PROJECT_ENVIRONMENT", context.temp_dir.join("bar")), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::UV_PROJECT_ENVIRONMENT, context.temp_dir.join("bar")), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1714,7 +1715,7 @@ fn sync_custom_environment_path() -> Result<()> {
|
|||
// And, it can be outside the project
|
||||
let tempdir = tempdir_in(TestContext::test_bucket_dir())?;
|
||||
context = context.with_filtered_path(tempdir.path(), "OTHER_TEMPDIR");
|
||||
uv_snapshot!(context.filters(), context.sync().env("UV_PROJECT_ENVIRONMENT", tempdir.path().join(".venv")), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::UV_PROJECT_ENVIRONMENT, tempdir.path().join(".venv")), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1735,7 +1736,7 @@ fn sync_custom_environment_path() -> Result<()> {
|
|||
fs_err::remove_dir_all(context.temp_dir.join("foo"))?;
|
||||
fs_err::create_dir(context.temp_dir.join("foo"))?;
|
||||
fs_err::write(context.temp_dir.join("foo").join("file"), b"")?;
|
||||
uv_snapshot!(context.filters(), context.sync().env("UV_PROJECT_ENVIRONMENT", "foo"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo"), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -1761,7 +1762,7 @@ fn sync_custom_environment_path() -> Result<()> {
|
|||
fs_err::write(context.temp_dir.join("foo").join("file"), b"")?;
|
||||
|
||||
// We can delete and use it
|
||||
uv_snapshot!(context.filters(), context.sync().env("UV_PROJECT_ENVIRONMENT", "foo"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1838,7 +1839,7 @@ fn sync_workspace_custom_environment_path() -> Result<()> {
|
|||
.assert(predicate::path::missing());
|
||||
|
||||
// Running `uv sync` should create `foo` in the workspace root when customized
|
||||
uv_snapshot!(context.filters(), context.sync().env("UV_PROJECT_ENVIRONMENT", "foo"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1863,7 +1864,7 @@ fn sync_workspace_custom_environment_path() -> Result<()> {
|
|||
.assert(predicate::path::is_dir());
|
||||
|
||||
// Similarly, `uv sync` from the child project uses `foo` relative to the workspace root
|
||||
uv_snapshot!(context.filters(), context.sync().env("UV_PROJECT_ENVIRONMENT", "foo").current_dir(context.temp_dir.join("child")), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo").current_dir(context.temp_dir.join("child")), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1886,7 +1887,7 @@ fn sync_workspace_custom_environment_path() -> Result<()> {
|
|||
.assert(predicate::path::missing());
|
||||
|
||||
// And, `uv sync --package child` uses `foo` relative to the workspace root
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--package").arg("child").env("UV_PROJECT_ENVIRONMENT", "foo"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().arg("--package").arg("child").env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1927,7 +1928,7 @@ fn sync_virtual_env_warning() -> Result<()> {
|
|||
)?;
|
||||
|
||||
// We should not warn if it matches the project environment
|
||||
uv_snapshot!(context.filters(), context.sync().env("VIRTUAL_ENV", context.temp_dir.join(".venv")), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::VIRTUAL_ENV, context.temp_dir.join(".venv")), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1940,7 +1941,7 @@ fn sync_virtual_env_warning() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// Including if it's a relative path that matches
|
||||
uv_snapshot!(context.filters(), context.sync().env("VIRTUAL_ENV", ".venv"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::VIRTUAL_ENV, ".venv"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1958,7 +1959,7 @@ fn sync_virtual_env_warning() -> Result<()> {
|
|||
let link = context.temp_dir.join("link");
|
||||
symlink(context.temp_dir.join(".venv"), &link)?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.sync().env("VIRTUAL_ENV", link), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::VIRTUAL_ENV, link), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1970,7 +1971,7 @@ fn sync_virtual_env_warning() -> Result<()> {
|
|||
}
|
||||
|
||||
// But we should warn if it's a different path
|
||||
uv_snapshot!(context.filters(), context.sync().env("VIRTUAL_ENV", "foo"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::VIRTUAL_ENV, "foo"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1982,7 +1983,7 @@ fn sync_virtual_env_warning() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// Including absolute paths
|
||||
uv_snapshot!(context.filters(), context.sync().env("VIRTUAL_ENV", context.temp_dir.join("foo")), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::VIRTUAL_ENV, context.temp_dir.join("foo")), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1994,7 +1995,7 @@ fn sync_virtual_env_warning() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// We should not warn if the project environment has been customized and matches
|
||||
uv_snapshot!(context.filters(), context.sync().env("VIRTUAL_ENV", "foo").env("UV_PROJECT_ENVIRONMENT", "foo"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::VIRTUAL_ENV, "foo").env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2008,7 +2009,7 @@ fn sync_virtual_env_warning() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// But we should warn if they don't match still
|
||||
uv_snapshot!(context.filters(), context.sync().env("VIRTUAL_ENV", "foo").env("UV_PROJECT_ENVIRONMENT", "bar"), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::VIRTUAL_ENV, "foo").env(EnvVars::UV_PROJECT_ENVIRONMENT, "bar"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2027,7 +2028,7 @@ fn sync_virtual_env_warning() -> Result<()> {
|
|||
|
||||
// And `VIRTUAL_ENV` is resolved relative to the project root so with relative paths we should
|
||||
// warn from a child too
|
||||
uv_snapshot!(context.filters(), context.sync().env("VIRTUAL_ENV", "foo").env("UV_PROJECT_ENVIRONMENT", "foo").current_dir(&child), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::VIRTUAL_ENV, "foo").env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo").current_dir(&child), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2039,7 +2040,7 @@ fn sync_virtual_env_warning() -> Result<()> {
|
|||
"###);
|
||||
|
||||
// But, a matching absolute path shouldn't warn
|
||||
uv_snapshot!(context.filters(), context.sync().env("VIRTUAL_ENV", context.temp_dir.join("foo")).env("UV_PROJECT_ENVIRONMENT", "foo").current_dir(&child), @r###"
|
||||
uv_snapshot!(context.filters(), context.sync().env(EnvVars::VIRTUAL_ENV, context.temp_dir.join("foo")).env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo").current_dir(&child), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
#[test]
|
||||
|
@ -9,8 +11,8 @@ fn tool_dir() {
|
|||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_dir()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -27,8 +29,8 @@ fn tool_dir_bin() {
|
|||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_dir().arg("--bin")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -9,6 +9,8 @@ use indoc::indoc;
|
|||
use insta::assert_snapshot;
|
||||
use predicates::prelude::predicate;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
#[test]
|
||||
|
@ -22,9 +24,9 @@ fn tool_install() {
|
|||
// Install `black`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -87,7 +89,7 @@ fn tool_install() {
|
|||
"###);
|
||||
});
|
||||
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env("PATH", bin_dir.as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -100,9 +102,9 @@ fn tool_install() {
|
|||
// Install another tool
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("flask")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -142,7 +144,7 @@ fn tool_install() {
|
|||
"###);
|
||||
});
|
||||
|
||||
uv_snapshot!(context.filters(), Command::new("flask").arg("--version").env("PATH", bin_dir.as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), Command::new("flask").arg("--version").env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -178,12 +180,12 @@ fn tool_install_suggest_other_packages_with_executable() {
|
|||
filters.push(("\\+ uvloop(.+)\n ", ""));
|
||||
|
||||
uv_snapshot!(filters, context.tool_install()
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("fastapi==0.111.0")
|
||||
.env("UV_EXCLUDE_NEWER", "2024-05-04T00:00:00Z") // TODO: Remove this once EXCLUDE_NEWER is bumped past 2024-05-04
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, "2024-05-04T00:00:00Z") // TODO: Remove this once EXCLUDE_NEWER is bumped past 2024-05-04
|
||||
// (FastAPI 0.111 is only available from this date onwards)
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -242,9 +244,9 @@ fn tool_install_version() {
|
|||
// Install `black`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -307,7 +309,7 @@ fn tool_install_version() {
|
|||
"###);
|
||||
});
|
||||
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env("PATH", bin_dir.as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -329,9 +331,9 @@ fn tool_install_editable() {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("-e")
|
||||
.arg(context.workspace_root.join("scripts/packages/black_editable"))
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -388,7 +390,7 @@ fn tool_install_editable() {
|
|||
"###);
|
||||
});
|
||||
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env("PATH", bin_dir.as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -400,9 +402,9 @@ fn tool_install_editable() {
|
|||
// Request `black`. It should reinstall from the registry.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -432,9 +434,9 @@ fn tool_install_editable() {
|
|||
.arg("black")
|
||||
.arg("--from")
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -482,9 +484,9 @@ fn tool_install_remove_on_empty() -> Result<()> {
|
|||
// Request `black`. It should reinstall from the registry.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -548,9 +550,9 @@ fn tool_install_remove_on_empty() -> Result<()> {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("-e")
|
||||
.arg(black.path())
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -573,9 +575,9 @@ fn tool_install_remove_on_empty() -> Result<()> {
|
|||
// Re-request `black`. It should reinstall, without requiring `--force`.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -625,9 +627,9 @@ fn tool_install_editable_from() {
|
|||
.arg("-e")
|
||||
.arg("--from")
|
||||
.arg(context.workspace_root.join("scripts/packages/black_editable"))
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -684,7 +686,7 @@ fn tool_install_editable_from() {
|
|||
"###);
|
||||
});
|
||||
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env("PATH", bin_dir.as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -706,9 +708,9 @@ fn tool_install_from() {
|
|||
.arg("black")
|
||||
.arg("--from")
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -731,9 +733,9 @@ fn tool_install_from() {
|
|||
.arg("black")
|
||||
.arg("--from")
|
||||
.arg("flask==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -747,9 +749,9 @@ fn tool_install_from() {
|
|||
.arg("black==24.2.0")
|
||||
.arg("--from")
|
||||
.arg("black==24.3.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -771,9 +773,9 @@ fn tool_install_already_installed() {
|
|||
// Install `black`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -838,9 +840,9 @@ fn tool_install_already_installed() {
|
|||
// Install `black` again
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -876,9 +878,9 @@ fn tool_install_already_installed() {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.arg("--reinstall")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -903,9 +905,9 @@ fn tool_install_already_installed() {
|
|||
.arg("black")
|
||||
.arg("--reinstall-package")
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -925,9 +927,9 @@ fn tool_install_already_installed() {
|
|||
.arg("black")
|
||||
.arg("--reinstall-package")
|
||||
.arg("click")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -957,9 +959,9 @@ fn tool_install_entry_point_exists() {
|
|||
// Attempt to install `black`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -996,9 +998,9 @@ fn tool_install_entry_point_exists() {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.arg("--reinstall")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -1037,9 +1039,9 @@ fn tool_install_entry_point_exists() {
|
|||
.unwrap();
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -1060,9 +1062,9 @@ fn tool_install_entry_point_exists() {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.arg("--force")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1085,9 +1087,9 @@ fn tool_install_entry_point_exists() {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.arg("--force")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1101,9 +1103,9 @@ fn tool_install_entry_point_exists() {
|
|||
// Re-install `black` without `--force`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1118,9 +1120,9 @@ fn tool_install_entry_point_exists() {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.arg("--reinstall")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1194,7 +1196,7 @@ fn tool_install_entry_point_exists() {
|
|||
"###);
|
||||
});
|
||||
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env("PATH", bin_dir.as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1217,13 +1219,13 @@ fn tool_install_home() {
|
|||
// Install `black`
|
||||
let mut cmd = context.tool_install();
|
||||
cmd.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(
|
||||
"XDG_DATA_HOME",
|
||||
EnvVars::XDG_DATA_HOME,
|
||||
context.home_dir.child(".local").child("share").as_os_str(),
|
||||
)
|
||||
.env(
|
||||
"PATH",
|
||||
EnvVars::PATH,
|
||||
context.home_dir.child(".local").child("bin").as_os_str(),
|
||||
);
|
||||
uv_snapshot!(context.filters(), cmd, @r###"
|
||||
|
@ -1261,9 +1263,9 @@ fn tool_install_xdg_data_home() {
|
|||
// Install `black`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_DATA_HOME", data_home.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_DATA_HOME, data_home.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1297,9 +1299,9 @@ fn tool_install_xdg_bin_home() {
|
|||
// Install `black`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1332,9 +1334,9 @@ fn tool_install_tool_bin_dir() {
|
|||
// Install `black`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("UV_TOOL_BIN_DIR", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_BIN_DIR, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1366,9 +1368,9 @@ fn tool_install_no_entrypoints() {
|
|||
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("iniconfig")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1409,9 +1411,9 @@ fn tool_install_uninstallable() {
|
|||
.collect::<Vec<_>>();
|
||||
uv_snapshot!(filters, context.tool_install()
|
||||
.arg("pyenv")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r##"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r##"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -1455,9 +1457,9 @@ fn tool_install_unnamed_package() {
|
|||
// Install `black`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("https://files.pythonhosted.org/packages/0f/89/294c9a6b6c75a08da55e9d05321d0707e9418735e3062b12ef0f54c33474/black-24.4.2-py3-none-any.whl")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1520,7 +1522,7 @@ fn tool_install_unnamed_package() {
|
|||
"###);
|
||||
});
|
||||
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env("PATH", bin_dir.as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1544,9 +1546,9 @@ fn tool_install_unnamed_conflict() {
|
|||
.arg("black")
|
||||
.arg("--from")
|
||||
.arg("https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -1568,9 +1570,9 @@ fn tool_install_unnamed_from() {
|
|||
.arg("black")
|
||||
.arg("--from")
|
||||
.arg("https://files.pythonhosted.org/packages/0f/89/294c9a6b6c75a08da55e9d05321d0707e9418735e3062b12ef0f54c33474/black-24.4.2-py3-none-any.whl")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1633,7 +1635,7 @@ fn tool_install_unnamed_from() {
|
|||
"###);
|
||||
});
|
||||
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env("PATH", bin_dir.as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1656,9 +1658,9 @@ fn tool_install_unnamed_with() {
|
|||
.arg("black")
|
||||
.arg("--with")
|
||||
.arg("https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1725,7 +1727,7 @@ fn tool_install_unnamed_with() {
|
|||
"###);
|
||||
});
|
||||
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env("PATH", bin_dir.as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), Command::new("black").arg("--version").env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1753,9 +1755,9 @@ fn tool_install_requirements_txt() {
|
|||
.arg("black")
|
||||
.arg("--with-requirements")
|
||||
.arg("requirements.txt")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1802,9 +1804,9 @@ fn tool_install_requirements_txt() {
|
|||
.arg("black")
|
||||
.arg("--with-requirements")
|
||||
.arg("requirements.txt")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1861,9 +1863,9 @@ fn tool_install_requirements_txt_arguments() {
|
|||
.arg("black")
|
||||
.arg("--with-requirements")
|
||||
.arg("requirements.txt")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1918,9 +1920,9 @@ fn tool_install_requirements_txt_arguments() {
|
|||
.arg("black")
|
||||
.arg("--with-requirements")
|
||||
.arg("requirements.txt")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1945,9 +1947,9 @@ fn tool_install_requirements_txt_arguments() {
|
|||
.arg("requirements.txt")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1980,9 +1982,9 @@ fn tool_install_upgrade() {
|
|||
// Install `black`.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black==24.1.1")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2021,9 +2023,9 @@ fn tool_install_upgrade() {
|
|||
// since it's already satisfied in the environment.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2054,9 +2056,9 @@ fn tool_install_upgrade() {
|
|||
.arg("black")
|
||||
.arg("--with")
|
||||
.arg("iniconfig @ https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2094,9 +2096,9 @@ fn tool_install_upgrade() {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.arg("--upgrade")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2144,9 +2146,9 @@ fn tool_install_python_requests() {
|
|||
.arg("-p")
|
||||
.arg("3.12")
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2169,9 +2171,9 @@ fn tool_install_python_requests() {
|
|||
.arg("-p")
|
||||
.arg("3.12")
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2185,9 +2187,9 @@ fn tool_install_python_requests() {
|
|||
.arg("-p")
|
||||
.arg("3.11")
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2223,9 +2225,9 @@ fn tool_install_python_preference() {
|
|||
.arg("-p")
|
||||
.arg("3.12")
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2248,9 +2250,9 @@ fn tool_install_python_preference() {
|
|||
.arg("-p")
|
||||
.arg("3.12")
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2266,9 +2268,9 @@ fn tool_install_python_preference() {
|
|||
.arg("--python-preference")
|
||||
.arg("only-system")
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2294,9 +2296,9 @@ fn tool_install_python_preference() {
|
|||
.arg("--python-preference")
|
||||
.arg("only-system")
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2312,9 +2314,9 @@ fn tool_install_python_preference() {
|
|||
.arg("--python-preference")
|
||||
.arg("only-managed")
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2339,9 +2341,9 @@ fn tool_install_python_preference() {
|
|||
.arg("--python-preference")
|
||||
.arg("only-managed")
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2363,9 +2365,9 @@ fn tool_install_preserve_environment() {
|
|||
// Install `black`.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black==24.1.1")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2388,9 +2390,9 @@ fn tool_install_preserve_environment() {
|
|||
.arg("black==24.1.1")
|
||||
.arg("--with")
|
||||
.arg("packaging==0.0.1")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -2403,9 +2405,9 @@ fn tool_install_preserve_environment() {
|
|||
// Install `black`. The tool should already be installed, since we didn't remove the environment.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black==24.1.1")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2428,9 +2430,9 @@ fn tool_install_warn_path() {
|
|||
// Install `black`.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black==24.1.1")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env_remove("PATH"), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env_remove(EnvVars::PATH), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2462,9 +2464,9 @@ fn tool_install_bad_receipt() -> Result<()> {
|
|||
// Install `black`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2496,9 +2498,9 @@ fn tool_install_bad_receipt() -> Result<()> {
|
|||
// Reinstall `black`, which should remove the invalid receipt.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2532,9 +2534,9 @@ fn tool_install_malformed_dist_info() {
|
|||
// Install `babel`
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("babel")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2605,9 +2607,9 @@ fn tool_install_settings() {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("flask>=3")
|
||||
.arg("--resolution=lowest-direct")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2674,9 +2676,9 @@ fn tool_install_settings() {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("flask>=3")
|
||||
.arg("--resolution=highest")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2709,9 +2711,9 @@ fn tool_install_settings() {
|
|||
.arg("flask>=3")
|
||||
.arg("--resolution=highest")
|
||||
.arg("--upgrade")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2756,9 +2758,9 @@ fn tool_install_at_version() {
|
|||
// Install `black` at `24.1.0`.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black@24.1.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2798,9 +2800,9 @@ fn tool_install_at_version() {
|
|||
.arg("black@24.1.0")
|
||||
.arg("--from")
|
||||
.arg("black==24.1.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -2822,9 +2824,9 @@ fn tool_install_at_latest() {
|
|||
// Install `black` at latest.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black@latest")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2872,9 +2874,9 @@ fn tool_install_from_at_latest() {
|
|||
.arg("pybabel")
|
||||
.arg("--from")
|
||||
.arg("babel@latest")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2916,9 +2918,9 @@ fn tool_install_from_at_version() {
|
|||
.arg("pybabel")
|
||||
.arg("--from")
|
||||
.arg("babel@2.13.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -2959,9 +2961,9 @@ fn tool_install_at_latest_upgrade() {
|
|||
// Install `black`.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black==24.1.1")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -3000,9 +3002,9 @@ fn tool_install_at_latest_upgrade() {
|
|||
// since it's already satisfied in the environment.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -3031,9 +3033,9 @@ fn tool_install_at_latest_upgrade() {
|
|||
// Install with `{package}@{latest}`. `black` should be reinstalled with a more recent version.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black@latest")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -4,6 +4,7 @@ use assert_cmd::assert::OutputAssertExt;
|
|||
use assert_fs::fixture::PathChild;
|
||||
use fs_err as fs;
|
||||
use insta::assert_snapshot;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[test]
|
||||
fn tool_list() {
|
||||
|
@ -15,14 +16,14 @@ fn tool_list() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_list()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -44,14 +45,14 @@ fn tool_list_paths() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_list().arg("--show-paths")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -70,8 +71,8 @@ fn tool_list_empty() {
|
|||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_list()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -91,16 +92,16 @@ fn tool_list_missing_receipt() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
fs_err::remove_file(tool_dir.join("black").join("uv-receipt.toml")).unwrap();
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_list()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -123,8 +124,8 @@ fn tool_list_bad_environment() -> Result<()> {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
|
@ -132,8 +133,8 @@ fn tool_list_bad_environment() -> Result<()> {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("ruff==0.3.4")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
|
@ -145,8 +146,8 @@ fn tool_list_bad_environment() -> Result<()> {
|
|||
context.filters(),
|
||||
context
|
||||
.tool_list()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()),
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()),
|
||||
@r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -172,8 +173,8 @@ fn tool_list_deprecated() -> Result<()> {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
|
@ -209,8 +210,8 @@ fn tool_list_deprecated() -> Result<()> {
|
|||
|
||||
// Ensure that we can still list the tool.
|
||||
uv_snapshot!(context.filters(), context.tool_list()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -236,8 +237,8 @@ fn tool_list_deprecated() -> Result<()> {
|
|||
|
||||
// Ensure that listing fails.
|
||||
uv_snapshot!(context.filters(), context.tool_list()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -259,14 +260,14 @@ fn tool_list_show_version_specifiers() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black<24.3.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_list().arg("--show-version-specifiers")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -279,8 +280,8 @@ fn tool_list_show_version_specifiers() {
|
|||
|
||||
// with paths
|
||||
uv_snapshot!(context.filters(), context.tool_list().arg("--show-version-specifiers").arg("--show-paths")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -2,6 +2,7 @@ use crate::common::{copy_dir_all, uv_snapshot, TestContext};
|
|||
use assert_cmd::prelude::*;
|
||||
use assert_fs::prelude::*;
|
||||
use indoc::indoc;
|
||||
use uv_static::EnvVars;
|
||||
|
||||
#[test]
|
||||
fn tool_run_args() {
|
||||
|
@ -13,8 +14,8 @@ fn tool_run_args() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("--version")
|
||||
.arg("pytest")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -27,8 +28,8 @@ fn tool_run_args() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("pytest")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -49,8 +50,8 @@ fn tool_run_args() {
|
|||
.arg("--")
|
||||
.arg("pytest")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -70,8 +71,8 @@ fn tool_run_at_version() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("pytest@8.0.0")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -91,8 +92,8 @@ fn tool_run_at_version() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("pytest@")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -105,8 +106,8 @@ fn tool_run_at_version() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("pytest@invalid")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -131,8 +132,8 @@ fn tool_run_at_version() {
|
|||
.arg("pytest")
|
||||
.arg("pytest@8.0.0")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -164,8 +165,8 @@ fn tool_run_from_version() {
|
|||
.arg("pytest==8.0.0")
|
||||
.arg("pytest")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -192,8 +193,8 @@ fn tool_run_suggest_valid_commands() {
|
|||
.arg("--from")
|
||||
.arg("black")
|
||||
.arg("orange")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -217,8 +218,8 @@ fn tool_run_suggest_valid_commands() {
|
|||
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("fastapi-cli")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -249,10 +250,10 @@ fn tool_run_warn_executable_not_in_from() {
|
|||
.arg("--from")
|
||||
.arg("fastapi")
|
||||
.arg("fastapi")
|
||||
.env("UV_EXCLUDE_NEWER", "2024-05-04T00:00:00Z") // TODO: Remove this once EXCLUDE_NEWER is bumped past 2024-05-04
|
||||
.env(EnvVars::UV_EXCLUDE_NEWER, "2024-05-04T00:00:00Z") // TODO: Remove this once EXCLUDE_NEWER is bumped past 2024-05-04
|
||||
// (FastAPI 0.111 is only available from this date onwards)
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -309,8 +310,8 @@ fn tool_run_from_install() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.1.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
|
@ -318,8 +319,8 @@ fn tool_run_from_install() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -334,8 +335,8 @@ fn tool_run_from_install() {
|
|||
.arg("--isolated")
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -358,8 +359,8 @@ fn tool_run_from_install() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("black@24.1.1")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -386,8 +387,8 @@ fn tool_run_from_install() {
|
|||
.arg("iniconfig")
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -413,8 +414,8 @@ fn tool_run_from_install() {
|
|||
.arg("black==24.2.0")
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -446,8 +447,8 @@ fn tool_run_cache() {
|
|||
.arg("3.12")
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -472,8 +473,8 @@ fn tool_run_cache() {
|
|||
.arg("3.12")
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -491,8 +492,8 @@ fn tool_run_cache() {
|
|||
.arg("--refresh")
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -519,8 +520,8 @@ fn tool_run_cache() {
|
|||
.arg("packaging")
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -545,8 +546,8 @@ fn tool_run_cache() {
|
|||
.arg("3.11")
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -571,8 +572,8 @@ fn tool_run_cache() {
|
|||
.arg("3.12")
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -591,8 +592,8 @@ fn tool_run_cache() {
|
|||
.arg("iniconfig")
|
||||
.arg("black")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -624,8 +625,8 @@ fn tool_run_url() {
|
|||
.arg("flask @ https://files.pythonhosted.org/packages/61/80/ffe1da13ad9300f87c93af113edd0638c75138c42a0994becfacac078c06/flask-3.0.3-py3-none-any.whl")
|
||||
.arg("flask")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -664,8 +665,8 @@ fn tool_run_requirements_txt() {
|
|||
.arg("typing-extensions")
|
||||
.arg("flask")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -710,8 +711,8 @@ fn tool_run_requirements_txt_arguments() {
|
|||
.arg("requirements.txt")
|
||||
.arg("flask")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -744,8 +745,8 @@ fn tool_run_list_installed() {
|
|||
|
||||
// No tools installed.
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -760,15 +761,15 @@ fn tool_run_list_installed() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
// List installed tools.
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -793,12 +794,12 @@ fn tool_run_without_output() {
|
|||
|
||||
// On the first run, only show the summary line.
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.env_remove("UV_SHOW_RESOLUTION")
|
||||
.env_remove(EnvVars::UV_SHOW_RESOLUTION)
|
||||
.arg("--")
|
||||
.arg("pytest")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -810,12 +811,12 @@ fn tool_run_without_output() {
|
|||
|
||||
// Subsequent runs are quiet.
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.env_remove("UV_SHOW_RESOLUTION")
|
||||
.env_remove(EnvVars::UV_SHOW_RESOLUTION)
|
||||
.arg("--")
|
||||
.arg("pytest")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -869,8 +870,8 @@ fn tool_run_csv_with() -> anyhow::Result<()> {
|
|||
.arg("ipython")
|
||||
.arg("-c")
|
||||
.arg("import numpy; import pandas;")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -949,8 +950,8 @@ fn tool_run_csv_with() -> anyhow::Result<()> {
|
|||
.arg("ipython")
|
||||
.arg("-c")
|
||||
.arg("import numpy; import pandas;")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1028,8 +1029,8 @@ fn tool_run_repeated_with() -> anyhow::Result<()> {
|
|||
.arg("ipython")
|
||||
.arg("-c")
|
||||
.arg("import numpy; import pandas;")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1110,8 +1111,8 @@ fn tool_run_repeated_with() -> anyhow::Result<()> {
|
|||
.arg("ipython")
|
||||
.arg("-c")
|
||||
.arg("import numpy; import pandas;")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1186,8 +1187,8 @@ fn tool_run_with_editable() -> anyhow::Result<()> {
|
|||
.arg("iniconfig")
|
||||
.arg("flask")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1211,7 +1212,7 @@ fn tool_run_with_editable() -> anyhow::Result<()> {
|
|||
"###);
|
||||
|
||||
// Requesting an editable requirement should install it in a layer, even if it satisfied
|
||||
uv_snapshot!(context.filters(), context.tool_run().arg("--with-editable").arg("./src/anyio_local").arg("flask").arg("--version").env("UV_TOOL_DIR", tool_dir.as_os_str()).env("XDG_BIN_HOME", bin_dir.as_os_str()),
|
||||
uv_snapshot!(context.filters(), context.tool_run().arg("--with-editable").arg("./src/anyio_local").arg("flask").arg("--version").env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str()).env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()),
|
||||
@r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
|
@ -1235,7 +1236,7 @@ fn tool_run_with_editable() -> anyhow::Result<()> {
|
|||
"###);
|
||||
|
||||
// Requesting the project itself should use a new environment.
|
||||
uv_snapshot!(context.filters(), context.tool_run().arg("--with-editable").arg(".").arg("flask").arg("--version").env("UV_TOOL_DIR", tool_dir.as_os_str()).env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
uv_snapshot!(context.filters(), context.tool_run().arg("--with-editable").arg(".").arg("flask").arg("--version").env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str()).env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1267,8 +1268,8 @@ fn tool_run_with_editable() -> anyhow::Result<()> {
|
|||
.arg("./foo")
|
||||
.arg("flask")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir
|
||||
.as_os_str()).env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir
|
||||
.as_os_str()).env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1289,8 +1290,8 @@ fn warn_no_executables_found() {
|
|||
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("requests")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1320,8 +1321,8 @@ fn tool_run_upgrade_warn() {
|
|||
.arg("--upgrade")
|
||||
.arg("pytest")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1344,8 +1345,8 @@ fn tool_run_upgrade_warn() {
|
|||
.arg("typing-extensions")
|
||||
.arg("pytest")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1373,8 +1374,8 @@ fn tool_run_resolution_error() {
|
|||
|
||||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("add")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -1395,8 +1396,8 @@ fn tool_run_latest() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("pytest==7.0.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
|
@ -1404,8 +1405,8 @@ fn tool_run_latest() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("pytest")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1418,8 +1419,8 @@ fn tool_run_latest() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("pytest@latest")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1439,8 +1440,8 @@ fn tool_run_latest() {
|
|||
uv_snapshot!(context.filters(), context.tool_run()
|
||||
.arg("pytest")
|
||||
.arg("--version")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use assert_cmd::assert::OutputAssertExt;
|
||||
use assert_fs::fixture::PathChild;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
#[test]
|
||||
|
@ -13,14 +15,14 @@ fn tool_uninstall() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_uninstall().arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -31,8 +33,8 @@ fn tool_uninstall() {
|
|||
|
||||
// After uninstalling the tool, it shouldn't be listed.
|
||||
uv_snapshot!(context.filters(), context.tool_list()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -44,9 +46,9 @@ fn tool_uninstall() {
|
|||
// After uninstalling the tool, we should be able to reinstall it.
|
||||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -74,22 +76,22 @@ fn tool_uninstall_multiple_names() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
context
|
||||
.tool_install()
|
||||
.arg("ruff==0.3.4")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_uninstall().arg("black").arg("ruff")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -100,8 +102,8 @@ fn tool_uninstall_multiple_names() {
|
|||
|
||||
// After uninstalling the tool, it shouldn't be listed.
|
||||
uv_snapshot!(context.filters(), context.tool_list()
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -118,8 +120,8 @@ fn tool_uninstall_not_installed() {
|
|||
let bin_dir = context.temp_dir.child("bin");
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_uninstall().arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
@ -139,16 +141,16 @@ fn tool_uninstall_missing_receipt() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
fs_err::remove_file(tool_dir.join("black").join("uv-receipt.toml")).unwrap();
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_uninstall().arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -168,16 +170,16 @@ fn tool_uninstall_all_missing_receipt() {
|
|||
context
|
||||
.tool_install()
|
||||
.arg("black==24.2.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
fs_err::remove_file(tool_dir.join("black").join("uv-receipt.toml")).unwrap();
|
||||
|
||||
uv_snapshot!(context.filters(), context.tool_uninstall().arg("--all")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
use assert_fs::prelude::*;
|
||||
use insta::assert_snapshot;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
#[test]
|
||||
|
@ -16,9 +18,9 @@ fn test_tool_upgrade_name() {
|
|||
.arg("babel")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -37,9 +39,9 @@ fn test_tool_upgrade_name() {
|
|||
.arg("babel")
|
||||
.arg("--index-url")
|
||||
.arg("https://pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -66,9 +68,9 @@ fn test_tool_upgrade_multiple_names() {
|
|||
.arg("python-dotenv")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -86,9 +88,9 @@ fn test_tool_upgrade_multiple_names() {
|
|||
.arg("babel")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -108,9 +110,9 @@ fn test_tool_upgrade_multiple_names() {
|
|||
.arg("python-dotenv")
|
||||
.arg("--index-url")
|
||||
.arg("https://pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -141,9 +143,9 @@ fn test_tool_upgrade_all() {
|
|||
.arg("python-dotenv")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -161,9 +163,9 @@ fn test_tool_upgrade_all() {
|
|||
.arg("babel")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -182,9 +184,9 @@ fn test_tool_upgrade_all() {
|
|||
.arg("--all")
|
||||
.arg("--index-url")
|
||||
.arg("https://pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -213,9 +215,9 @@ fn test_tool_upgrade_non_existing_package() {
|
|||
// Attempt to upgrade `black`.
|
||||
uv_snapshot!(context.filters(), context.tool_upgrade()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -227,9 +229,9 @@ fn test_tool_upgrade_non_existing_package() {
|
|||
// Attempt to upgrade all.
|
||||
uv_snapshot!(context.filters(), context.tool_upgrade()
|
||||
.arg("--all")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -252,9 +254,9 @@ fn test_tool_upgrade_not_stop_if_upgrade_fails() -> anyhow::Result<()> {
|
|||
.arg("python-dotenv")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -272,9 +274,9 @@ fn test_tool_upgrade_not_stop_if_upgrade_fails() -> anyhow::Result<()> {
|
|||
.arg("babel")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -299,9 +301,9 @@ fn test_tool_upgrade_not_stop_if_upgrade_fails() -> anyhow::Result<()> {
|
|||
.arg("--all")
|
||||
.arg("--index-url")
|
||||
.arg("https://pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: false
|
||||
exit_code: 1
|
||||
----- stdout -----
|
||||
|
@ -330,9 +332,9 @@ fn test_tool_upgrade_settings() {
|
|||
uv_snapshot!(context.filters(), context.tool_install()
|
||||
.arg("black>=23")
|
||||
.arg("--resolution=lowest-direct")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -353,9 +355,9 @@ fn test_tool_upgrade_settings() {
|
|||
// Upgrade `black`. This should be a no-op, since the resolution is set to `lowest-direct`.
|
||||
uv_snapshot!(context.filters(), context.tool_upgrade()
|
||||
.arg("black")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -368,9 +370,9 @@ fn test_tool_upgrade_settings() {
|
|||
uv_snapshot!(context.filters(), context.tool_upgrade()
|
||||
.arg("black")
|
||||
.arg("--resolution=highest")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -396,9 +398,9 @@ fn test_tool_upgrade_respect_constraints() {
|
|||
.arg("babel<2.10")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -417,9 +419,9 @@ fn test_tool_upgrade_respect_constraints() {
|
|||
.arg("babel")
|
||||
.arg("--index-url")
|
||||
.arg("https://pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -447,9 +449,9 @@ fn test_tool_upgrade_constraint() {
|
|||
.arg("babel")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -470,9 +472,9 @@ fn test_tool_upgrade_constraint() {
|
|||
.arg("https://pypi.org/simple/")
|
||||
.arg("--upgrade-package")
|
||||
.arg("babel<2.14.0")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -491,9 +493,9 @@ fn test_tool_upgrade_constraint() {
|
|||
.arg("babel")
|
||||
.arg("--index-url")
|
||||
.arg("https://pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -512,9 +514,9 @@ fn test_tool_upgrade_constraint() {
|
|||
.arg("--index-url")
|
||||
.arg("https://pypi.org/simple/")
|
||||
.arg("--upgrade")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -540,9 +542,9 @@ fn test_tool_upgrade_with() {
|
|||
.arg("babel==2.6.0")
|
||||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -561,9 +563,9 @@ fn test_tool_upgrade_with() {
|
|||
.arg("babel")
|
||||
.arg("--index-url")
|
||||
.arg("https://pypi.org/simple/")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -588,9 +590,9 @@ fn test_tool_upgrade_python() {
|
|||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.arg("--python").arg("3.11")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -608,9 +610,9 @@ fn test_tool_upgrade_python() {
|
|||
context.filters(),
|
||||
context.tool_upgrade().arg("babel")
|
||||
.arg("--python").arg("3.12")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -649,9 +651,9 @@ fn test_tool_upgrade_python_with_all() {
|
|||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.arg("--python").arg("3.11")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -670,9 +672,9 @@ fn test_tool_upgrade_python_with_all() {
|
|||
.arg("--index-url")
|
||||
.arg("https://test.pypi.org/simple/")
|
||||
.arg("--python").arg("3.11")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -689,9 +691,9 @@ fn test_tool_upgrade_python_with_all() {
|
|||
context.filters(),
|
||||
context.tool_upgrade().arg("--all")
|
||||
.arg("--python").arg("3.12")
|
||||
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||
.env("XDG_BIN_HOME", bin_dir.as_os_str())
|
||||
.env("PATH", bin_dir.as_os_str()), @r###"
|
||||
.env(EnvVars::UV_TOOL_DIR, tool_dir.as_os_str())
|
||||
.env(EnvVars::XDG_BIN_HOME, bin_dir.as_os_str())
|
||||
.env(EnvVars::PATH, bin_dir.as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
|
|
@ -3,7 +3,9 @@ use assert_cmd::prelude::*;
|
|||
use assert_fs::prelude::*;
|
||||
use indoc::indoc;
|
||||
use predicates::prelude::*;
|
||||
|
||||
use uv_python::{PYTHON_VERSIONS_FILENAME, PYTHON_VERSION_FILENAME};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{uv_snapshot, TestContext};
|
||||
|
||||
|
@ -53,7 +55,7 @@ fn create_venv_project_environment() -> Result<()> {
|
|||
let context = TestContext::new_with_versions(&["3.12"]);
|
||||
|
||||
// `uv venv` ignores `UV_PROJECT_ENVIRONMENT` when it's not a project
|
||||
uv_snapshot!(context.filters(), context.venv().env("UV_PROJECT_ENVIRONMENT", "foo"), @r###"
|
||||
uv_snapshot!(context.filters(), context.venv().env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -83,7 +85,7 @@ fn create_venv_project_environment() -> Result<()> {
|
|||
)?;
|
||||
|
||||
// But, if we're in a project we'll respect it
|
||||
uv_snapshot!(context.filters(), context.venv().env("UV_PROJECT_ENVIRONMENT", "foo"), @r###"
|
||||
uv_snapshot!(context.filters(), context.venv().env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo"), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -104,7 +106,7 @@ fn create_venv_project_environment() -> Result<()> {
|
|||
let child = context.temp_dir.child("child");
|
||||
child.create_dir_all()?;
|
||||
|
||||
uv_snapshot!(context.filters(), context.venv().env("UV_PROJECT_ENVIRONMENT", "foo").current_dir(child.path()), @r###"
|
||||
uv_snapshot!(context.filters(), context.venv().env(EnvVars::UV_PROJECT_ENVIRONMENT, "foo").current_dir(child.path()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -192,7 +194,7 @@ fn create_venv_ignores_virtual_env_variable() {
|
|||
// We shouldn't care if `VIRTUAL_ENV` is set to an non-existent directory
|
||||
// because we ignore virtual environment interpreter sources (we require a system interpreter)
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.env("VIRTUAL_ENV", context.temp_dir.child("does-not-exist").as_os_str()), @r###"
|
||||
.env(EnvVars::VIRTUAL_ENV, context.temp_dir.child("does-not-exist").as_os_str()), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -594,7 +596,7 @@ fn create_venv_unknown_python_minor() {
|
|||
.arg("--python")
|
||||
.arg("3.100")
|
||||
// Unset this variable to force what the user would see
|
||||
.env_remove("UV_TEST_PYTHON_PATH");
|
||||
.env_remove(EnvVars::UV_TEST_PYTHON_PATH);
|
||||
|
||||
if cfg!(windows) {
|
||||
uv_snapshot!(&mut command, @r###"
|
||||
|
@ -632,7 +634,7 @@ fn create_venv_unknown_python_patch() {
|
|||
.arg("--python")
|
||||
.arg("3.12.100")
|
||||
// Unset this variable to force what the user would see
|
||||
.env_remove("UV_TEST_PYTHON_PATH");
|
||||
.env_remove(EnvVars::UV_TEST_PYTHON_PATH);
|
||||
|
||||
if cfg!(windows) {
|
||||
uv_snapshot!(&mut command, @r###"
|
||||
|
@ -859,7 +861,7 @@ fn windows_shims() -> Result<()> {
|
|||
// Create a virtual environment at `.venv` with the shim
|
||||
uv_snapshot!(context.filters(), context.venv()
|
||||
.arg(context.venv.as_os_str())
|
||||
.env("UV_TEST_PYTHON_PATH", format!("{};{}", shim_path.display(), context.python_path().to_string_lossy())), @r###"
|
||||
.env(EnvVars::UV_TEST_PYTHON_PATH, format!("{};{}", shim_path.display(), context.python_path().to_string_lossy())), @r###"
|
||||
success: true
|
||||
exit_code: 0
|
||||
----- stdout -----
|
||||
|
@ -1001,7 +1003,7 @@ fn verify_nested_pyvenv_cfg() -> Result<()> {
|
|||
.arg(subvenv.as_os_str())
|
||||
.arg("--python")
|
||||
.arg("3.12")
|
||||
.env("VIRTUAL_ENV", context.venv.as_os_str())
|
||||
.env(EnvVars::VIRTUAL_ENV, context.venv.as_os_str())
|
||||
.assert()
|
||||
.success();
|
||||
|
||||
|
@ -1037,7 +1039,7 @@ fn path_with_trailing_space_gives_proper_error() {
|
|||
));
|
||||
uv_snapshot!(filters, std::process::Command::new(crate::common::get_bin())
|
||||
.arg("venv")
|
||||
.env("UV_CACHE_DIR", path_with_trailing_slash), @r###"
|
||||
.env(EnvVars::UV_CACHE_DIR, path_with_trailing_slash), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
|
|
@ -13,7 +13,12 @@ use assert_cmd::assert::OutputAssertExt;
|
|||
use assert_fs::fixture::{FileWriteStr, PathChild};
|
||||
use predicates::prelude::predicate;
|
||||
|
||||
use crate::common::{build_vendor_links_url, packse_index_url, python_path_with_versions, get_bin, uv_snapshot, TestContext};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{
|
||||
build_vendor_links_url, get_bin, packse_index_url, python_path_with_versions, uv_snapshot,
|
||||
TestContext,
|
||||
};
|
||||
|
||||
/// Provision python binaries and return a `pip compile` command with options shared across all scenarios.
|
||||
fn command(context: &TestContext, python_versions: &[&str]) -> Command {
|
||||
|
@ -29,8 +34,8 @@ fn command(context: &TestContext, python_versions: &[&str]) -> Command {
|
|||
.arg("--find-links")
|
||||
.arg(build_vendor_links_url());
|
||||
context.add_shared_args(&mut command, true);
|
||||
command.env_remove("UV_EXCLUDE_NEWER");
|
||||
command.env("UV_TEST_PYTHON_PATH", python_path);
|
||||
command.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
command.env(EnvVars::UV_TEST_PYTHON_PATH, python_path);
|
||||
|
||||
command
|
||||
}
|
||||
|
|
|
@ -11,8 +11,12 @@ use std::process::Command;
|
|||
use assert_cmd::assert::Assert;
|
||||
use assert_cmd::prelude::*;
|
||||
|
||||
use crate::common::{venv_to_interpreter, build_vendor_links_url, get_bin, packse_index_url, uv_snapshot, TestContext};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{
|
||||
build_vendor_links_url, get_bin, packse_index_url, uv_snapshot, venv_to_interpreter,
|
||||
TestContext,
|
||||
};
|
||||
|
||||
fn assert_command(venv: &Path, command: &str, temp_dir: &Path) -> Assert {
|
||||
Command::new(venv_to_interpreter(venv))
|
||||
|
@ -47,7 +51,7 @@ fn command(context: &TestContext) -> Command {
|
|||
.arg("--find-links")
|
||||
.arg(build_vendor_links_url());
|
||||
context.add_shared_args(&mut command, true);
|
||||
command.env_remove("UV_EXCLUDE_NEWER");
|
||||
command.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
command
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ use assert_cmd::assert::OutputAssertExt;
|
|||
use assert_fs::prelude::*;
|
||||
use insta::assert_snapshot;
|
||||
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::common::{packse_index_url, TestContext, uv_snapshot};
|
||||
|
||||
{{#scenarios}}
|
||||
|
@ -51,7 +53,7 @@ fn {{module_name}}() -> Result<()> {
|
|||
)?;
|
||||
|
||||
let mut cmd = context.lock();
|
||||
cmd.env_remove("UV_EXCLUDE_NEWER");
|
||||
cmd.env_remove(EnvVars::UV_EXCLUDE_NEWER);
|
||||
cmd.arg("--index-url").arg(packse_index_url());
|
||||
{{#expected.explanation}}
|
||||
// {{expected.explanation}}
|
||||
|
@ -75,7 +77,7 @@ fn {{module_name}}() -> Result<()> {
|
|||
context
|
||||
.lock()
|
||||
.arg("--locked")
|
||||
.env_remove("UV_EXCLUDE_NEWER")
|
||||
.env_remove(EnvVars::UV_EXCLUDE_NEWER)
|
||||
.arg("--index-url")
|
||||
.arg(packse_index_url())
|
||||
.assert()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue