forked from samuelcolvin/python-devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·28 lines (20 loc) · 945 Bytes
/
Copy pathmain.py
File metadata and controls
executable file
·28 lines (20 loc) · 945 Bytes
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
#!/usr/bin/env python3
import re
import sys
from importlib.machinery import SourceFileLoader
from pathlib import Path
THIS_DIR = Path(__file__).parent
PROJECT_ROOT = THIS_DIR / '..' / '..'
def main():
history = (PROJECT_ROOT / 'HISTORY.md').read_text()
history = re.sub(r'#(\d+)', r'[#\1](https://github.com/samuelcolvin/python-devtools/issues/\1)', history)
history = re.sub(r'( +)@([\w\-]+)', r'\1[@\2](https://github.com/\2)', history, flags=re.I)
history = re.sub('@@', '@', history)
(PROJECT_ROOT / 'docs/.history.md').write_text(history)
version = SourceFileLoader('version', str(PROJECT_ROOT / 'devtools/version.py')).load_module()
(PROJECT_ROOT / 'docs/.version.md').write_text(f'Documentation for version: **v{version.VERSION}**\n')
sys.path.append(str(THIS_DIR.resolve()))
from gen_html import gen_examples_html
return gen_examples_html()
if __name__ == '__main__':
sys.exit(main())