diff options
| author | 2024-03-30 18:10:37 +0800 | |
|---|---|---|
| committer | 2024-03-30 18:10:37 +0800 | |
| commit | d0249fae9465d11b4d8a84ff2fa96df1617d1887 (patch) | |
| tree | bbf26605c3168508b4157c8ddfe8fd8def3ac331 /src | |
| parent | 74a5743c0f1499f53b9867aa470b9c2f3958774f (diff) | |
| download | ipm-d0249fae9465d11b4d8a84ff2fa96df1617d1887.tar.gz ipm-d0249fae9465d11b4d8a84ff2fa96df1617d1887.zip | |
feat(doc): add support for simple package in doc
Diffstat (limited to 'src')
| -rw-r--r-- | src/ipm/api.py | 8 |
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) |
