commit: ee4e6eb2fc34b70c2dfe1858f43636bf13db1be9
Author: Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Wed Dec 3 18:58:45 2025 +0000
Commit: Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Wed Dec 3 19:52:33 2025 +0000
URL:
https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=ee4e6eb2
refactor: convert custom man generation to import_module_from_path
Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
src/snakeoil/dist/generate_docs.py | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/snakeoil/dist/generate_docs.py
b/src/snakeoil/dist/generate_docs.py
index 8534aed..8312188 100644
--- a/src/snakeoil/dist/generate_docs.py
+++ b/src/snakeoil/dist/generate_docs.py
@@ -8,7 +8,6 @@ from io import StringIO
from snakeoil import python_namespaces
-from ..contexts import syspath
from .generate_man_rsts import ManConverter
@@ -41,12 +40,10 @@ def _generate_custom(project, docdir, gendir):
continue
fake_file = StringIO()
- with syspath(os.path.dirname(script_path)):
- module =
import_module(os.path.basename(os.path.splitext(script_path)[0]))
- module.main(fake_file, docdir=docdir, gendir=gendir)
+ module = python_namespaces.import_module_from_path(script_path)
+ module.main(fake_file, docdir=docdir, gendir=gendir)
- fake_file.seek(0)
- if data := fake_file.read():
+ if data := fake_file.getvalue():
rst = os.path.join(gendir, subdir, os.path.splitext(script)[0]
+ '.rst')
print(f"generating {rst}")
with open(rst, 'w') as f: