mirror of https://github.com/astral-sh/uv
Fix relative paths in bytecode compilation (#11177)
Bytecode compilation would panic with a relative path such as `--target target`.
This commit is contained in:
parent
4a88cdd6ee
commit
d27e41a43a
|
|
@ -75,7 +75,8 @@ pub async fn compile_tree(
|
||||||
) -> Result<usize, CompileError> {
|
) -> Result<usize, CompileError> {
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
dir.is_absolute(),
|
dir.is_absolute(),
|
||||||
"compileall doesn't work with relative paths"
|
"compileall doesn't work with relative paths: `{}`",
|
||||||
|
dir.display()
|
||||||
);
|
);
|
||||||
let worker_count = std::thread::available_parallelism().unwrap_or_else(|err| {
|
let worker_count = std::thread::available_parallelism().unwrap_or_else(|err| {
|
||||||
warn_user!("Couldn't determine number of cores, compiling with a single thread: {err}");
|
warn_user!("Couldn't determine number of cores, compiling with a single thread: {err}");
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ pub(crate) use tool::update_shell::update_shell as tool_update_shell;
|
||||||
pub(crate) use tool::upgrade::upgrade as tool_upgrade;
|
pub(crate) use tool::upgrade::upgrade as tool_upgrade;
|
||||||
use uv_cache::Cache;
|
use uv_cache::Cache;
|
||||||
use uv_distribution_types::InstalledMetadata;
|
use uv_distribution_types::InstalledMetadata;
|
||||||
use uv_fs::Simplified;
|
use uv_fs::{Simplified, CWD};
|
||||||
use uv_installer::compile_tree;
|
use uv_installer::compile_tree;
|
||||||
use uv_normalize::PackageName;
|
use uv_normalize::PackageName;
|
||||||
use uv_python::PythonEnvironment;
|
use uv_python::PythonEnvironment;
|
||||||
|
|
@ -153,6 +153,7 @@ pub(super) async fn compile_bytecode(
|
||||||
let start = std::time::Instant::now();
|
let start = std::time::Instant::now();
|
||||||
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);
|
||||||
files += compile_tree(&site_packages, venv.python_executable(), cache.root())
|
files += compile_tree(&site_packages, venv.python_executable(), cache.root())
|
||||||
.await
|
.await
|
||||||
.with_context(|| {
|
.with_context(|| {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue