diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f91af4a0c12..74e67f9c1394 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: # For Ubuntu and Windows, this requires Organization-level configuration # See: https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners#about-ubuntu-and-windows-larger-runners - { os: "ubuntu", runner: "ubuntu-latest-large" } - - { os: "windows", runner: "windows-2019" } + - { os: "windows", runner: "windows-latest-large" } - { os: "macos", runner: "macos-14" } fail-fast: false runs-on: @@ -82,10 +82,6 @@ jobs: - uses: Swatinem/rust-cache@v2 with: save-if: ${{ github.ref == 'refs/heads/main' }} - - name: "Cargo build" - run: cargo build - - name: "Do thing" - run: ./target/debug/uv venv && ./target/debug/uv pip install lxml && ./target/debug/uv pip uninstall lxml && ./target/debug/uv pip install lxml - name: "Cargo test" run: | cargo nextest run --workspace --status-level skip --failure-output immediate-final --no-fail-fast -j 12 --final-status-level slow diff --git a/crates/distribution-types/src/installed.rs b/crates/distribution-types/src/installed.rs index ed1f4800a37f..880d0f7f7032 100644 --- a/crates/distribution-types/src/installed.rs +++ b/crates/distribution-types/src/installed.rs @@ -112,14 +112,6 @@ impl InstalledDist { /// Read the `METADATA` file from a `.dist-info` directory. pub fn metadata(&self) -> Result { - // Print the path. - println!("path: {}", self.path().simplified_display()); - // Print everything in the path: - for entry in fs::read_dir(self.path())? { - let entry = entry?; - println!("entry: {}", entry.path().simplified_display()); - } - let path = self.path().join("METADATA"); let contents = fs::read(&path)?; pypi_types::Metadata21::parse(&contents).with_context(|| { diff --git a/crates/install-wheel-rs/src/uninstall.rs b/crates/install-wheel-rs/src/uninstall.rs index b26df7f6d752..de917c09ef8a 100644 --- a/crates/install-wheel-rs/src/uninstall.rs +++ b/crates/install-wheel-rs/src/uninstall.rs @@ -2,9 +2,7 @@ use std::collections::BTreeSet; use std::path::{Component, Path, PathBuf}; use fs_err as fs; -use rustc_hash::FxHashSet; use tracing::debug; -use uv_fs::Simplified; use crate::wheel::read_record_file; use crate::Error; @@ -18,29 +16,29 @@ pub fn uninstall_wheel(dist_info: &Path) -> Result { }; // Read the RECORD file. - let record_path = dist_info.join("RECORD"); - let mut record_file = match fs::File::open(&record_path) { - Ok(record_file) => record_file, - Err(err) if err.kind() == std::io::ErrorKind::NotFound => { - return Err(Error::MissingRecord(record_path)); - } - Err(err) => return Err(err.into()), + let record = { + let record_path = dist_info.join("RECORD"); + let mut record_file = match fs::File::open(&record_path) { + Ok(record_file) => record_file, + Err(err) if err.kind() == std::io::ErrorKind::NotFound => { + return Err(Error::MissingRecord(record_path)); + } + Err(err) => return Err(err.into()), + }; + read_record_file(&mut record_file)? }; - let record = read_record_file(&mut record_file)?; let mut file_count = 0usize; let mut dir_count = 0usize; // Uninstall the files, keeping track of any directories that are left empty. let mut visited = BTreeSet::new(); - let mut deleted = FxHashSet::default(); for entry in &record { let path = site_packages.join(&entry.path); match fs::remove_file(&path) { Ok(()) => { - println!("Removed file: {}", path.display()); + debug!("Removed file: {}", path.display()); file_count += 1; - deleted.insert(normalize_path(&path)); if let Some(parent) = path.parent() { visited.insert(normalize_path(parent)); } @@ -48,9 +46,8 @@ pub fn uninstall_wheel(dist_info: &Path) -> Result { Err(err) if err.kind() == std::io::ErrorKind::NotFound => {} Err(err) => match fs::remove_dir_all(&path) { Ok(()) => { - println!("Removed directory: {}", path.display()); + debug!("Removed directory: {}", path.display()); dir_count += 1; - deleted.insert(normalize_path(&path)); } Err(err) if err.kind() == std::io::ErrorKind::NotFound => {} Err(_) => return Err(err.into()), @@ -82,9 +79,8 @@ pub fn uninstall_wheel(dist_info: &Path) -> Result { let pycache = path.join("__pycache__"); match fs::remove_dir_all(&pycache) { Ok(()) => { - println!("Removed directory: {}", pycache.display()); + debug!("Removed directory: {}", pycache.display()); dir_count += 1; - deleted.insert(normalize_path(path)); } Err(err) if err.kind() == std::io::ErrorKind::NotFound => {} Err(err) => return Err(err.into()), @@ -98,26 +94,15 @@ pub fn uninstall_wheel(dist_info: &Path) -> Result { Err(err) => return Err(err.into()), }; - // Ignore files that were deleted. - let mut entries = read_dir.filter(|entry| { - let Ok(entry) = entry else { - return false; - }; - let is_deleted = deleted.contains(&normalize_path(&entry.path())); - println!("entry is deleted: {} : {}", entry.path().simplified_display(), is_deleted); - !is_deleted - }); - // If the directory is not empty, we're done. - if entries.next().is_some() { + if read_dir.next().is_some() { break; } - fs::remove_dir_all(path)?; + fs::remove_dir(path)?; - println!("Removed directory: {}", path.display()); + debug!("Removed directory: {}", path.display()); dir_count += 1; - deleted.insert(normalize_path(path)); if let Some(parent) = path.parent() { path = parent;