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 47 48 49 50 51 52 53 54 55 56 57 58
|
"""Build the C++ client docs.
"""
from __future__ import with_statement
import os
import shutil
import subprocess
def clean_dir(dir):
try:
shutil.rmtree(dir)
except:
pass
os.makedirs(dir)
def gen_cplusplus(dir):
clean_dir(dir)
clean_dir("docs/doxygen")
# Too noisy...
with open("/dev/null") as null:
subprocess.call(["doxygen", "etc/doxygen/config"], stdout=null, stderr=null)
os.rename("docs/doxygen/html", dir)
def version():
"""Get the server version from doxygenConfig.
"""
with open("etc/doxygen/config") as f:
for line in f.readlines():
if line.startswith("PROJECT_NUMBER"):
return line.split("=")[1].strip()
def link_current(version):
"""Create current link to the most recently generated documentation
"""
print("Updating 'current' docs symlink")
link_path = 'docs/html/cplusplus/current'
try:
os.unlink(link_path)
except OSError:
pass
os.symlink(version, link_path)
def main():
v = version()
print("Generating C++ docs in docs/html/cplusplus/%s" % v)
gen_cplusplus("docs/html/cplusplus/%s" % v)
link_current(v)
if __name__ == "__main__":
main()
|