mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-31 20:09:09 +00:00
Use a non-local lock file for locking system interpreters (#2045)
This commit is contained in:
parent
e91fe1925b
commit
ea5ebe59af
1 changed files with 10 additions and 1 deletions
|
|
@ -107,7 +107,16 @@ impl PythonEnvironment {
|
||||||
|
|
||||||
/// Lock the virtual environment to prevent concurrent writes.
|
/// Lock the virtual environment to prevent concurrent writes.
|
||||||
pub fn lock(&self) -> Result<LockedFile, std::io::Error> {
|
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.
|
||||||
LockedFile::acquire(self.root.join(".lock"), self.root.normalized_display())
|
LockedFile::acquire(self.root.join(".lock"), self.root.normalized_display())
|
||||||
|
} else {
|
||||||
|
// Otherwise, use a global lock file.
|
||||||
|
LockedFile::acquire(
|
||||||
|
env::temp_dir().join(format!("uv-{}.lock", cache_key::digest(&self.root))),
|
||||||
|
self.root.normalized_display(),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue