Skip to content

Commit ff5a2b5

Browse files
committed
cleanup
1 parent ccb6752 commit ff5a2b5

File tree

1 file changed

+4
-42
lines changed

1 file changed

+4
-42
lines changed

src/packaging/file_finder.rs

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -230,43 +230,9 @@ impl Files {
230230
prefix: prefix.to_owned(),
231231
});
232232
}
233-
let fs_is_case_sensitive = check_is_case_sensitive()?;
234-
let current_files = record_files(prefix)?;
235-
let previous_files = if prefix.join("conda-meta").exists() {
236-
let prefix_records: Vec<PrefixRecord> = PrefixRecord::collect_from_prefix(prefix)?;
237-
let mut previous_files = prefix_records
238-
.into_iter()
239-
.flat_map(|record| record.files.into_iter().map(|f| prefix.join(f)))
240-
.collect::<HashSet<_>>();
241-
previous_files.extend(record_files(&prefix.join("conda-meta"))?);
242-
previous_files
243-
} else {
244-
HashSet::new()
245-
};
246233

247-
let mut selected_files = find_new_files(
248-
&current_files,
249-
&previous_files,
250-
prefix,
251-
fs_is_case_sensitive,
252-
);
253-
254-
if !files.is_empty() {
255-
selected_files.retain(|f| {
256-
files.is_match(f.strip_prefix(prefix).expect("File should be in prefix"))
257-
});
258-
}
259-
260-
if !always_include.is_empty() {
261-
for file in &current_files {
262-
let file_without_prefix =
263-
file.strip_prefix(prefix).expect("File should be in prefix");
264-
if always_include.is_match(file_without_prefix) {
265-
tracing::info!("Forcing inclusion of file: {:?}", file_without_prefix);
266-
selected_files.insert(file.clone());
267-
}
268-
}
269-
}
234+
let mut result = Self::from_prefix(prefix, always_include, files)?;
235+
let current_files = record_files(prefix)?;
270236

271237
if let Some(cache_files) = restored_cache_prefix_files {
272238
for cache_file in cache_files {
@@ -281,16 +247,12 @@ impl Files {
281247
|| files.is_match(file_without_prefix)
282248
|| always_include.is_match(file_without_prefix)
283249
{
284-
selected_files.insert(full_path);
250+
result.new_files.insert(full_path);
285251
}
286252
}
287253
}
288254

289-
Ok(Files {
290-
new_files: selected_files,
291-
old_files: previous_files,
292-
prefix: prefix.to_owned(),
293-
})
255+
Ok(result)
294256
}
295257

296258
/// Copy the new files to a temporary directory and return the temporary directory and the files that were copied.

0 commit comments

Comments
 (0)