Query interpreter to determine correct virtualenv paths (#2188)

## Summary

This PR migrates our virtualenv creation from a setup that assumes prior
knowledge of the correct paths, to a technique borrowed from
`virtualenv` whereby we use `sysconfig` and `distutils` to determine the
paths. The general trick is to grab the expected paths with `sysconfig`,
then make them all relative, then make them absolute for a given
directory.

Closes #2095.
Closes #2153.
This commit is contained in:
Charlie Marsh 2024-03-05 13:13:24 -08:00 committed by GitHub
parent a8ac7b1eb4
commit 0f6fc117c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 171 additions and 66 deletions

View file

@ -9,7 +9,6 @@ use serde::{Deserialize, Serialize};
/// See: <https://docs.python.org/3.12/library/sysconfig.html#installation-paths>
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct Scheme {
pub stdlib: PathBuf,
pub purelib: PathBuf,
pub platlib: PathBuf,
pub scripts: PathBuf,