Skip non-existent directories in bytecode compilation (#15608)

## Summary

Closes https://github.com/astral-sh/uv/issues/15577.
This commit is contained in:
Charlie Marsh 2025-08-31 10:53:00 -04:00 committed by GitHub
parent c2c713e5d2
commit 01e5195ef3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 3 deletions

View File

@ -1,12 +1,14 @@
use anstream::AutoStream;
use anyhow::Context;
use owo_colors::OwoColorize;
use std::borrow::Cow; use std::borrow::Cow;
use std::io::stdout; use std::io::stdout;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::time::Duration; use std::time::Duration;
use std::{fmt::Display, fmt::Write, process::ExitCode}; use std::{fmt::Display, fmt::Write, process::ExitCode};
use anstream::AutoStream;
use anyhow::Context;
use owo_colors::OwoColorize;
use tracing::debug;
pub(crate) use build_frontend::build_frontend; pub(crate) use build_frontend::build_frontend;
pub(crate) use cache_clean::cache_clean; pub(crate) use cache_clean::cache_clean;
pub(crate) use cache_dir::cache_dir; pub(crate) use cache_dir::cache_dir;
@ -159,6 +161,13 @@ pub(super) async fn compile_bytecode(
let mut files = 0; let mut files = 0;
for site_packages in venv.site_packages() { for site_packages in venv.site_packages() {
let site_packages = CWD.join(site_packages); let site_packages = CWD.join(site_packages);
if !site_packages.exists() {
debug!(
"Skipping non-existent site-packages directory: {}",
site_packages.display()
);
continue;
}
files += compile_tree( files += compile_tree(
&site_packages, &site_packages,
venv.python_executable(), venv.python_executable(),