summaryrefslogtreecommitdiff
path: root/dev-util/pkgdev/files/pkgdev-0.2.3-docs-path.patch
blob: 3386c3e96cfff732b5d9944124d5e6b38cf71d04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
https://github.com/pkgcore/pkgdev/commit/640c78d7

doc: fix generating of code when built in PEP517 mode

When in PEP517 mode, the source code is located in a different location,
so use better relative fallback place. Also cleanup a little the code
handling to use pathlib.

Bug: https://bugs.gentoo.org/877189
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -16,13 +16,17 @@
 import os
 import sys
 from importlib import import_module
+from pathlib import Path

 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
-libdir = os.path.abspath(os.path.join('..', 'build', 'lib'))
-if os.path.exists(libdir):
-    sys.path.insert(0, libdir)
+
+if (src_path := Path(__file__).parent.parent / 'src').is_dir():
+    sys.path.insert(0, str(src_path.resolve()))
+
+if (libdir := Path(__file__).parent.parent / 'build/lib').is_dir():
+    sys.path.insert(0, str(libdir.resolve()))

 os.environ['PKGDIST_REPODIR'] = os.path.abspath('..')
 from snakeoil.dist import distutils_extensions as pkgdist
@@ -241,11 +245,9 @@

 # -- Options for manual page output ---------------------------------------

-bin_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'bin')
-scripts = os.listdir(bin_path)
-
 generated_man_pages = [
-    (f"{project}.scripts.{s.replace('-', '_')}", s) for s in scripts
+    (f"{project}.scripts.{s.name.replace('-', '_')}", s.name)
+    for s in (Path(__file__).parent.parent / 'bin').iterdir()
 ]

 # One entry per manual page. List of tuples