| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
# Find manual page dependencies |
| 4 |
# argv1 = doc dir containing conf.py |
| 5 |
|
| 6 |
import importlib.util |
| 7 |
import os.path |
| 8 |
import pathlib |
| 9 |
import sys |
| 10 |
|
| 11 |
if __name__ == "__main__": |
| 12 |
|
| 13 |
if len(sys.argv) != 2: |
| 14 |
sys.exit("Usage: %s sphinx-srcdir" % (sys.argv[0])) |
| 15 |
|
| 16 |
conf_dir = os.path.abspath(sys.argv[1]) |
| 17 |
conf_path = os.path.join(conf_dir, 'conf.py') |
| 18 |
spec = importlib.util.spec_from_file_location('conf', conf_path) |
| 19 |
conf = importlib.util.module_from_spec(spec) |
| 20 |
spec.loader.exec_module(conf) |
| 21 |
|
| 22 |
if hasattr(conf, 'man_pages'): |
| 23 |
for man in conf.man_pages: |
| 24 |
man_path = os.path.join(sys.argv[1], "{}{}".format(man[0], '.rst')) |
| 25 |
man_path_posix = pathlib.PureWindowsPath(man_path).as_posix() |
| 26 |
print(man_path_posix) |
| 27 |
|
| 28 |
print(pathlib.PureWindowsPath(conf_path).as_posix()) |