Skip to content

Commit d27e41a

Browse files
authored
Fix relative paths in bytecode compilation (#11177)
Bytecode compilation would panic with a relative path such as `--target target`.
1 parent 4a88cdd commit d27e41a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/uv-installer/src/compile.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ pub async fn compile_tree(
7575
) -> Result<usize, CompileError> {
7676
debug_assert!(
7777
dir.is_absolute(),
78-
"compileall doesn't work with relative paths"
78+
"compileall doesn't work with relative paths: `{}`",
79+
dir.display()
7980
);
8081
let worker_count = std::thread::available_parallelism().unwrap_or_else(|err| {
8182
warn_user!("Couldn't determine number of cores, compiling with a single thread: {err}");

crates/uv/src/commands/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub(crate) use tool::update_shell::update_shell as tool_update_shell;
4848
pub(crate) use tool::upgrade::upgrade as tool_upgrade;
4949
use uv_cache::Cache;
5050
use uv_distribution_types::InstalledMetadata;
51-
use uv_fs::Simplified;
51+
use uv_fs::{Simplified, CWD};
5252
use uv_installer::compile_tree;
5353
use uv_normalize::PackageName;
5454
use uv_python::PythonEnvironment;
@@ -153,6 +153,7 @@ pub(super) async fn compile_bytecode(
153153
let start = std::time::Instant::now();
154154
let mut files = 0;
155155
for site_packages in venv.site_packages() {
156+
let site_packages = CWD.join(site_packages);
156157
files += compile_tree(&site_packages, venv.python_executable(), cache.root())
157158
.await
158159
.with_context(|| {

0 commit comments

Comments
 (0)