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

@ -46,7 +46,7 @@ pub(crate) async fn build(args: BuildArgs) -> Result<PathBuf> {
let build_dispatch = BuildDispatch::new(
RegistryClientBuilder::new(cache_dir.path().clone()).build(),
cache_dir.path().clone(),
venv.interpreter_info().clone(),
venv.interpreter().clone(),
fs::canonicalize(venv.python_executable())?,
false,
);

View file

@ -50,15 +50,15 @@ pub(crate) async fn resolve_cli(args: ResolveCliArgs) -> Result<()> {
let build_dispatch = BuildDispatch::new(
client.clone(),
cache_dir.path().clone(),
venv.interpreter_info().clone(),
venv.interpreter().clone(),
fs::canonicalize(venv.python_executable())?,
args.no_build,
);
// Copied from `BuildDispatch`
let tags = Tags::from_env(
venv.interpreter_info().platform(),
venv.interpreter_info().simple_version(),
venv.interpreter().platform(),
venv.interpreter().simple_version(),
)?;
let resolver = Resolver::new(
Manifest::new(
@ -68,7 +68,7 @@ pub(crate) async fn resolve_cli(args: ResolveCliArgs) -> Result<()> {
None,
),
ResolutionOptions::default(),
venv.interpreter_info().markers(),
venv.interpreter().markers(),
&tags,
&client,
&build_dispatch,

View file

@ -52,7 +52,7 @@ pub(crate) async fn resolve_many(args: ResolveManyArgs) -> Result<()> {
let build_dispatch = BuildDispatch::new(
RegistryClientBuilder::new(cache_dir.path().clone()).build(),
cache_dir.path().clone(),
venv.interpreter_info().clone(),
venv.interpreter().clone(),
fs::canonicalize(venv.python_executable())?,
args.no_build,
);