mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Review: Use EnvVars
This commit is contained in:
parent
abc2ab21e7
commit
07be9cef1c
2 changed files with 27 additions and 8 deletions
|
@ -25,6 +25,7 @@ use uv_pep508::{MarkerEnvironment, StringVersion};
|
|||
use uv_platform_tags::Platform;
|
||||
use uv_platform_tags::{Tags, TagsError};
|
||||
use uv_pypi_types::{ResolverMarkerEnvironment, Scheme};
|
||||
use uv_static::EnvVars;
|
||||
|
||||
use crate::implementation::LenientImplementationName;
|
||||
use crate::platform::{Arch, Libc, Os};
|
||||
|
@ -738,14 +739,14 @@ struct PythonEnvVars {
|
|||
impl PythonEnvVars {
|
||||
fn from_env() -> Self {
|
||||
Self {
|
||||
pythonhome: env::var_os("PYTHONHOME"),
|
||||
pythonpath: env::var_os("PYTHONPATH"),
|
||||
pythonsafepath: env::var_os("PYTHONSAFEPATH"),
|
||||
pythonplatlibdir: env::var_os("PYTHONPLATLIBDIR"),
|
||||
pythonnousersite: env::var_os("PYTHONNOUSERSITE"),
|
||||
pythonuserbase: env::var_os("PYTHONUSERBASE"),
|
||||
appdata: env::var_os("APPDATA"),
|
||||
home: env::var_os("HOME"),
|
||||
pythonhome: env::var_os(EnvVars::PYTHONHOME),
|
||||
pythonpath: env::var_os(EnvVars::PYTHONPATH),
|
||||
pythonsafepath: env::var_os(EnvVars::PYTHONSAFEPATH),
|
||||
pythonplatlibdir: env::var_os(EnvVars::PYTHONPLATLIBDIR),
|
||||
pythonnousersite: env::var_os(EnvVars::PYTHONNOUSERSITE),
|
||||
pythonuserbase: env::var_os(EnvVars::PYTHONUSERBASE),
|
||||
appdata: env::var_os(EnvVars::APPDATA),
|
||||
home: env::var_os(EnvVars::HOME),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -649,4 +649,22 @@ impl EnvVars {
|
|||
///
|
||||
/// This is a quasi-standard variable, described e.g. in `ncurses(3x)`.
|
||||
pub const COLUMNS: &'static str = "COLUMNS";
|
||||
|
||||
/// Overrides `sys.prefix`.
|
||||
pub const PYTHONHOME: &'static str = "PYTHONHOME";
|
||||
|
||||
/// Don't prepend a potentially unsafe path to `sys.path`.
|
||||
pub const PYTHONSAFEPATH: &'static str = "PYTHONSAFEPATH";
|
||||
|
||||
/// Overrides `sys.platlibdir`.
|
||||
pub const PYTHONPLATLIBDIR: &'static str = "PYTHONPLATLIBDIR";
|
||||
|
||||
/// Don't add the user site packages to `sys.path`.
|
||||
pub const PYTHONNOUSERSITE: &'static str = "PYTHONNOUSERSITE";
|
||||
|
||||
/// Overrides `site.USER_BASE`.
|
||||
pub const PYTHONUSERBASE: &'static str = "PYTHONUSERBASE";
|
||||
|
||||
/// The base path for user site packages on Windows.
|
||||
pub const APPDATA: &'static str = "APPDATA";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue