aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/ipm/api.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ipm/api.py b/src/ipm/api.py
index 84e389d..61f6f3a 100644
--- a/src/ipm/api.py
+++ b/src/ipm/api.py
@@ -578,8 +578,12 @@ def doc(
project = InfiniProject(toml_path.parent)
loader = Loader()
loader.close()
- sys.path.append(str(target_path))
- module = importlib.import_module("src")
+ if toml_path.parent.joinpath("src", "__init__.py").exists():
+ sys.path.append(str(target_path))
+ module = importlib.import_module("src")
+ else:
+ sys.path.append(str(toml_path.parent.joinpath("src")))
+ module = importlib.import_module(project.name)
loader.load_from_module(module)
dist_path = Path(dist).resolve()
dist_path.mkdir(parents=True, exist_ok=True)