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

Function calculate_stdlib_dir

crates/vm/src/getpath.rs:309–321  ·  view source on GitHub ↗

Calculate stdlib_dir (sys._stdlib_dir) Returns None if the stdlib directory doesn't exist

(prefix: &str)

Source from the content-addressed store, hash-verified

307/// Calculate stdlib_dir (sys._stdlib_dir)
308/// Returns None if the stdlib directory doesn't exist
309fn calculate_stdlib_dir(prefix: &str) -> Option<String> {
310 #[cfg(not(windows))]
311 let stdlib_dir = PathBuf::from(prefix).join(platform::stdlib_subdir());
312
313 #[cfg(windows)]
314 let stdlib_dir = PathBuf::from(prefix).join(platform::STDLIB_SUBDIR);
315
316 if stdlib_dir.is_dir() {
317 Some(stdlib_dir.to_string_lossy().into_owned())
318 } else {
319 None
320 }
321}
322
323/// Build the complete module_search_paths (sys.path)
324fn build_module_search_paths(settings: &Settings, prefix: &str, exec_prefix: &str) -> Vec<String> {

Callers 1

init_path_configFunction · 0.85

Calls 6

stdlib_subdirFunction · 0.85
into_ownedMethod · 0.80
SomeClass · 0.50
joinMethod · 0.45
is_dirMethod · 0.45
to_string_lossyMethod · 0.45

Tested by

no test coverage detected