Add support for --no-build-isolation (#2258)

## Summary

This PR adds support for pip's `--no-build-isolation`. When enabled,
build requirements won't be installed during PEP 517-style builds, but
the source environment _will_ be used when executing the build steps
themselves.

Closes https://github.com/astral-sh/uv/issues/1715.
This commit is contained in:
Charlie Marsh
2024-03-07 06:04:02 -08:00
committed by GitHub
parent d249574a47
commit 5ae5980c88
19 changed files with 244 additions and 64 deletions
@@ -65,8 +65,11 @@ impl PythonEnvironment {
}
/// Create a [`PythonEnvironment`] from an existing [`Interpreter`] and root directory.
pub fn from_interpreter(interpreter: Interpreter, root: PathBuf) -> Self {
Self { root, interpreter }
pub fn from_interpreter(interpreter: Interpreter) -> Self {
Self {
root: interpreter.prefix().to_path_buf(),
interpreter,
}
}
/// Returns the location of the Python interpreter.
@@ -100,7 +103,7 @@ impl PythonEnvironment {
self.interpreter.scripts()
}
/// Lock the virtual environment to prevent concurrent writes.
/// Grab a file lock for the virtual environment to prevent concurrent writes across processes.
pub fn lock(&self) -> Result<LockedFile, std::io::Error> {
if self.interpreter.is_virtualenv() {
// If the environment a virtualenv, use a virtualenv-specific lock file.