build-doc 973 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env python3
  2. import re
  3. import common
  4. from shell_helpers import LF
  5. class Main(common.LkmcCliFunction):
  6. def __init__(self):
  7. super().__init__(
  8. defaults = {
  9. 'print_time': False,
  10. },
  11. description='''\
  12. https://github.com/cirosantilli/linux-kernel-module-cheat#build-the-documentation
  13. ''',
  14. )
  15. def timed_main(self):
  16. self.sh.run_cmd(
  17. [
  18. 'asciidoctor', LF,
  19. '-o', self.env['readme_out'], LF,
  20. '-v', self.env['readme'], LF,
  21. ],
  22. out_file=self.env['build_doc_log'],
  23. )
  24. error_re = re.compile('^asciidoctor: WARNING: ')
  25. exit_status = 0
  26. with open(self.env['build_doc_log']) as f:
  27. for line in f:
  28. if error_re.search(line):
  29. exit_status = 1
  30. break
  31. return exit_status
  32. if __name__ == '__main__':
  33. Main().cli()