83f435164ced3babe3c98faf7c234df62c87abb5
1 '''This module creates the documentation using pydoc.'''
2 from os
import system
, mkdir
, remove
, rename
3 from os
.path
import exists
4 from shutil
import rmtree
, make_archive
5 from lib
.build
.build
import InsideDir
6 from pathlib
import Path
10 #TODO refactor: make class DocsBuilder
14 '''Builds the docs (inside a zip file).'''
15 system('python -m pydoc -w ./')
16 rmtree('docs', ignore_errors
=True)
17 Path('docs').mkdir(exist_ok
=True)
18 [rename(fname
, 'docs/' + fname
) for fname
in glob('*.html')]
19 Path('build').mkdir(exist_ok
=True)
20 rmtree('build/docs', ignore_errors
=True)
21 rename('docs', 'build/docs')
22 with
InsideDir('build'):
23 exists('docs.zip') and remove('docs.zip')
24 make_archive('docs', 'zip', '.', 'docs')