fix: path resolution bugs

This commit is contained in:
Shunsuke Shibayama 2023-05-25 11:25:02 +09:00
parent ac7a57a094
commit a9025507d3
6 changed files with 110 additions and 50 deletions

View file

@ -54,7 +54,7 @@ fn _erg_external_lib_path() -> PathBuf {
})
}
fn _python_site_packages() -> impl Iterator<Item = PathBuf> {
get_sys_path()
get_sys_path(None)
.into_iter()
.filter(|p| p.ends_with("site-packages"))
.map(|p| {
@ -98,6 +98,12 @@ pub fn python_site_packages() -> Vec<PathBuf> {
PYTHON_SITE_PACKAGES.with(|s| s.clone())
}
pub fn is_std_decl_path(path: &Path) -> bool {
path.starts_with(erg_pystd_path())
|| path.starts_with(erg_std_decl_path())
|| path.starts_with(erg_py_external_lib_path())
}
pub fn is_pystd_main_module(path: &Path) -> bool {
let mut path = PathBuf::from(path);
if path.ends_with("__init__.d.er") {