puffin_interpreter cleanup ahead of #235 (#492)

Preparing for #235, some refactoring to `puffin_interpreter`.

* Added a dedicated error type instead of anyhow
* `InterpreterInfo` -> `Interpreter`
* `detect_virtual_env` now returns an option so it can be chained for
#235
This commit is contained in:
konsti 2023-11-23 09:57:33 +01:00 committed by GitHub
parent 9d35128840
commit 1c0e03f807
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 201 additions and 163 deletions

View file

@ -27,7 +27,7 @@ use tracing::{debug, instrument};
use zip::ZipArchive;
use pep508_rs::Requirement;
use puffin_interpreter::{InterpreterInfo, Virtualenv};
use puffin_interpreter::{Interpreter, Virtualenv};
use puffin_traits::BuildContext;
/// e.g. `pygraphviz/graphviz_wrap.c:3020:10: fatal error: graphviz/cgraph.h: No such file or directory`
@ -220,7 +220,7 @@ impl SourceBuild {
pub async fn setup(
source: &Path,
subdirectory: Option<&Path>,
interpreter_info: &InterpreterInfo,
interpreter: &Interpreter,
build_context: &impl BuildContext,
source_build_context: SourceBuildContext,
package_id: &str,
@ -250,7 +250,7 @@ impl SourceBuild {
None
};
let venv = gourgeist::create_venv(&temp_dir.path().join(".venv"), interpreter_info)?;
let venv = gourgeist::create_venv(&temp_dir.path().join(".venv"), interpreter)?;
// There are packages such as DTLSSocket 0.1.16 that say
// ```toml