d9f9ed4aec
## Summary The basic idea here is that we can (should) reuse a build environment across resolution (`prepare_metadata_for_build_wheel`) and installation. This also happens to solve the build-PyTorch-from-source problem, since we use a consistent build environment between the invocations. Since `SourceDistributionBuilder` is stateless, we instead store the builds on `BuildContext`, and we key them by various properties: the underlying interpreter, the configuration settings, etc. This just ensures that if we build the same package twice within a process, we don't accidentally reuse an incompatible build (virtual) environment. (Note that still drop build environments at the end of the command, and don't attempt to reuse them across processes.) Closes #14269.
23 lines
616 B
Rust
23 lines
616 B
Rust
#[derive(
|
|
Debug, Default, Clone, Copy, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize,
|
|
)]
|
|
#[serde(rename_all = "kebab-case", deny_unknown_fields)]
|
|
pub enum SourceStrategy {
|
|
/// Use `tool.uv.sources` when resolving dependencies.
|
|
#[default]
|
|
Enabled,
|
|
/// Ignore `tool.uv.sources` when resolving dependencies.
|
|
Disabled,
|
|
}
|
|
|
|
impl SourceStrategy {
|
|
/// Return the [`SourceStrategy`] from the command-line arguments, if any.
|
|
pub fn from_args(no_sources: bool) -> Self {
|
|
if no_sources {
|
|
Self::Disabled
|
|
} else {
|
|
Self::Enabled
|
|
}
|
|
}
|
|
}
|