Skip to content

Commit 8fbc189

Browse files
committed
[import] Use pathlib for search locations
1 parent 5b2eaf3 commit 8fbc189

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

xpp/modules/ops/stdlib/import_.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Modules
44
import os
55
import json
6+
from pathlib import Path
67
from copy import copy as copyobj
78

89
from xpp import config, load_sections
@@ -12,8 +13,8 @@
1213

1314
# Initialization
1415
search_locations = [
15-
os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../pkgs")),
16-
os.path.abspath(os.path.join(os.getcwd(), "pkgs")),
16+
str(Path(__file__).parents[4] / "pkgs"), # Global pkgs folder (assuming module install)
17+
str(Path("pkgs").absolute()) # Local pkgs folder (relative to cwd)
1718
]
1819
main_namespace = config.get("main", "main").split(os.sep)[-1].removesuffix(".xpp")
1920

0 commit comments

Comments
 (0)