Files
pydantic/docs/build/main.py
T
Samuel Colvin 95435de452 build history and uprev version (#2040)
* build history and uprev version

* tweak history

* add #744 to changelog

* bump
2020-10-26 11:31:10 +00:00

32 lines
1019 B
Python
Executable File

#!/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/pydantic/issues/\1)', history)
history = re.sub(r'(\s)@([\w\-]+)', r'\1[@\2](https://github.com/\2)', history, flags=re.I)
history = re.sub('@@', '@', history)
(PROJECT_ROOT / 'docs/.changelog.md').write_text(history)
version = SourceFileLoader('version', str(PROJECT_ROOT / 'pydantic/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 schema_mapping import build_schema_mappings
from exec_examples import exec_examples
build_schema_mappings()
return exec_examples()
if __name__ == '__main__':
sys.exit(main())