mirror of https://github.com/astral-sh/uv
Use `EnvVars` in linehaul (#15931)
This commit is contained in:
parent
e23da5b315
commit
4c2d9e19b0
|
|
@ -5,6 +5,7 @@ use tracing::instrument;
|
|||
|
||||
use uv_pep508::MarkerEnvironment;
|
||||
use uv_platform_tags::{Os, Platform};
|
||||
use uv_static::EnvVars;
|
||||
use uv_version::version;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
||||
|
|
@ -64,9 +65,14 @@ impl LineHaul {
|
|||
#[instrument(name = "linehaul", skip_all)]
|
||||
pub fn new(markers: &MarkerEnvironment, platform: Option<&Platform>) -> Self {
|
||||
// https://github.com/pypa/pip/blob/24.0/src/pip/_internal/network/session.py#L87
|
||||
let looks_like_ci = ["BUILD_BUILDID", "BUILD_ID", "CI", "PIP_IS_CI"]
|
||||
.iter()
|
||||
.find_map(|&var_name| env::var(var_name).ok().map(|_| true));
|
||||
let looks_like_ci = [
|
||||
EnvVars::BUILD_BUILDID,
|
||||
EnvVars::BUILD_ID,
|
||||
EnvVars::CI,
|
||||
EnvVars::PIP_IS_CI,
|
||||
]
|
||||
.iter()
|
||||
.find_map(|&var_name| env::var(var_name).ok().map(|_| true));
|
||||
|
||||
let libc = match platform.map(Platform::os) {
|
||||
Some(Os::Manylinux { major, minor }) => Some(Libc {
|
||||
|
|
|
|||
|
|
@ -662,6 +662,18 @@ impl EnvVars {
|
|||
#[attr_hidden]
|
||||
pub const CI: &'static str = "CI";
|
||||
|
||||
/// Azure DevOps build identifier, used to detect CI environments.
|
||||
#[attr_hidden]
|
||||
pub const BUILD_BUILDID: &'static str = "BUILD_BUILDID";
|
||||
|
||||
/// Generic build identifier, used to detect CI environments.
|
||||
#[attr_hidden]
|
||||
pub const BUILD_ID: &'static str = "BUILD_ID";
|
||||
|
||||
/// Pip environment variable to indicate CI environment.
|
||||
#[attr_hidden]
|
||||
pub const PIP_IS_CI: &'static str = "PIP_IS_CI";
|
||||
|
||||
/// Use to set the .netrc file location.
|
||||
pub const NETRC: &'static str = "NETRC";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue