MCPcopy Index your code
hub / github.com/RustPython/RustPython / process_python_libs

Function process_python_libs

crates/pylib/build.rs:37–52  ·  view source on GitHub ↗

remove *.pyc files and add *.py to watch list

(pattern: &str)

Source from the content-addressed store, hash-verified

35
36// remove *.pyc files and add *.py to watch list
37fn process_python_libs(pattern: &str) {
38 let glob = glob::glob(pattern).unwrap_or_else(|e| panic!("failed to glob {pattern:?}: {e}"));
39 for entry in glob.flatten() {
40 if entry.is_dir() {
41 continue;
42 }
43 let display = entry.display();
44 if display.to_string().ends_with(".pyc") {
45 if std::fs::remove_file(&entry).is_err() {
46 println!("cargo:warning=failed to remove {display}")
47 }
48 continue;
49 }
50 println!("cargo:rerun-if-changed={display}");
51 }
52}

Callers 1

mainFunction · 0.85

Calls 7

globFunction · 0.85
ends_withMethod · 0.80
to_stringMethod · 0.80
is_errMethod · 0.80
flattenMethod · 0.45
is_dirMethod · 0.45
displayMethod · 0.45

Tested by

no test coverage detected