12345678910111213141516171819202122232425262728293031323334353637383940 |
- #!/usr/bin/env python3
- import re
- import common
- from shell_helpers import LF
- class Main(common.LkmcCliFunction):
- def __init__(self):
- super().__init__(
- defaults = {
- 'show_time': False,
- },
- description='''\
- https://github.com/cirosantilli/linux-kernel-module-cheat#build-the-documentation
- ''',
- )
- def timed_main(self):
- self.sh.run_cmd(
- [
- 'asciidoctor', LF,
- '-o', self.env['readme_out'], LF,
- '-v', self.env['readme'], LF,
- ],
- out_file=self.env['build_doc_log'],
- )
- error_re = re.compile('^asciidoctor: WARNING: ')
- exit_status = 0
- if not self.env['dry_run']:
- with open(self.env['build_doc_log']) as f:
- for line in f:
- if error_re.search(line):
- exit_status = 1
- break
- return exit_status
- if __name__ == '__main__':
- Main().cli()
|