mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 02:39:20 +00:00
fix: path resolution bugs
This commit is contained in:
parent
ac7a57a094
commit
a9025507d3
6 changed files with 110 additions and 50 deletions
|
@ -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") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue