File: build.py

package info (click to toggle)
cppformat 3.0.1%2Bds-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 844 kB
  • sloc: cpp: 8,205; python: 77; sh: 12; makefile: 8; ansic: 4
file content (46 lines) | stat: -rwxr-xr-x 1,682 bytes parent folder | download
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env python
# Build the documentation.

from __future__ import print_function
import errno, os, shutil, sys, tempfile
from subprocess import check_call, check_output, CalledProcessError, Popen, PIPE

def build_docs(version='dev'):
  doc_dir = os.path.dirname(os.path.realpath(__file__))

  # Build docs.
  cmd = ['doxygen', '-']
  p = Popen(cmd, stdin=PIPE)
  p.communicate(input=r'''
      PROJECT_NAME      = fmt
      GENERATE_LATEX    = NO
      GENERATE_MAN      = NO
      GENERATE_RTF      = NO
      CASE_SENSE_NAMES  = NO
      INPUT             = {0}/format.h {0}/ostream.h
      QUIET             = YES
      JAVADOC_AUTOBRIEF = YES
      AUTOLINK_SUPPORT  = NO
      GENERATE_HTML     = NO
      GENERATE_XML      = YES
      XML_OUTPUT        = doxyxml
      ALIASES           = "rst=\verbatim embed:rst"
      ALIASES          += "endrst=\endverbatim"
      MACRO_EXPANSION   = YES
      PREDEFINED        = _WIN32=1 \
                          FMT_USE_VARIADIC_TEMPLATES=1 \
                          FMT_USE_RVALUE_REFERENCES=1 \
                          FMT_USE_USER_DEFINED_LITERALS=1 \
                          FMT_API=
      EXCLUDE_SYMBOLS   = fmt::internal::* StringValue write_str
    '''.format(os.path.join(os.path.dirname(doc_dir), 'fmt')).encode('UTF-8'))
  if p.returncode != 0:
    raise CalledProcessError(p.returncode, cmd)
  check_call(['sphinx-build',
              '-Dbreathe_projects.format=' + os.path.join(os.getcwd(), 'doxyxml'),
              '-Dversion=' + version, '-Drelease=' + version, '-Aversion=' + version,
              '-b', 'html', doc_dir, 'html'])
  return 'html'

if __name__ == '__main__':
  build_docs(sys.argv[1])