mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-02 06:51:14 +00:00
Use PythonEnvironment
API in uv pip compile
(#4030)
Same as https://github.com/astral-sh/uv/pull/4029
This commit is contained in:
parent
cc7c780523
commit
cb7d6245ae
1 changed files with 6 additions and 9 deletions
|
@ -31,11 +31,10 @@ use uv_dispatch::BuildDispatch;
|
|||
use uv_distribution::DistributionDatabase;
|
||||
use uv_fs::Simplified;
|
||||
use uv_git::GitResolver;
|
||||
use uv_interpreter::PythonVersion;
|
||||
use uv_interpreter::{
|
||||
find_best_interpreter, find_interpreter, InterpreterRequest, PythonEnvironment, SystemPython,
|
||||
VersionRequest,
|
||||
find_best_interpreter, InterpreterRequest, PythonEnvironment, SystemPython, VersionRequest,
|
||||
};
|
||||
use uv_interpreter::{PythonVersion, SourceSelector};
|
||||
use uv_normalize::{ExtraName, PackageName};
|
||||
use uv_requirements::{
|
||||
upgrade::read_requirements_txt, LookaheadResolver, NamedRequirementsResolver,
|
||||
|
@ -163,9 +162,8 @@ pub(crate) async fn pip_compile(
|
|||
SystemPython::Allowed
|
||||
};
|
||||
let interpreter = if let Some(python) = python.as_ref() {
|
||||
let request = InterpreterRequest::parse(python);
|
||||
let sources = SourceSelector::from_settings(system, preview);
|
||||
find_interpreter(&request, system, &sources, &cache)??
|
||||
PythonEnvironment::from_requested_python(python, system, preview, &cache)?
|
||||
.into_interpreter()
|
||||
} else {
|
||||
let request = if let Some(version) = python_version.as_ref() {
|
||||
// TODO(zanieb): We should consolidate `VersionRequest` and `PythonVersion`
|
||||
|
@ -173,9 +171,8 @@ pub(crate) async fn pip_compile(
|
|||
} else {
|
||||
InterpreterRequest::default()
|
||||
};
|
||||
find_best_interpreter(&request, system, preview, &cache)??
|
||||
}
|
||||
.into_interpreter();
|
||||
find_best_interpreter(&request, system, preview, &cache)??.into_interpreter()
|
||||
};
|
||||
|
||||
debug!(
|
||||
"Using Python {} interpreter at {} for builds",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue