Skip to content

Commit c3415bc

Browse files
committed
Modify docs/make.py to allow building docs for older versions of module
1 parent 22fabc1 commit c3415bc

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

docs/make.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@
77
import pdoc
88
from packaging import version
99

10-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../screen_brightness_control'))
11-
from _version import __version__ # noqa: E402
12-
1310
HERE = Path(__file__).parent
1411
TEMPLATES = HERE / 'templates'
1512
OUTPUT_DIR = HERE / 'docs'
13+
14+
if os.path.isfile(HERE / '..' / 'screen_brightness_control' / '_version.py'):
15+
sys.path.insert(0, str(HERE / '..' / 'screen_brightness_control'))
16+
from _version import __version__ # noqa: E402
17+
else:
18+
sys.path.insert(0, str(HERE / '..'))
19+
from screen_brightness_control import __version__
20+
21+
1622
pdoc.docstrings.GOOGLE_LIST_SECTIONS.extend(["Returns", "Yields"])
1723
pdoc.render.configure(docformat='google', template_directory=TEMPLATES, footer_text=f'screen_brightness_control v{__version__}') # noqa: E501
1824

0 commit comments

Comments
 (0)