summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Dirolf <mike@10gen.com>2010-07-14 13:36:29 -0400
committerMike Dirolf <mike@10gen.com>2010-07-14 13:36:29 -0400
commit19f4563195e5401e25ec419ade214bcea0ad2148 (patch)
tree058495eca465fa6586e2e08be5350315ec55842e
parent9c035c362767e448fd9c501c9a1930589841231a (diff)
downloadmongo-19f4563195e5401e25ec419ade214bcea0ad2148.tar.gz
update docs.py to build C++ client docs too
-rw-r--r--.gitignore1
-rw-r--r--buildscripts/docs.py75
-rw-r--r--doxygenConfig2
3 files changed, 57 insertions, 21 deletions
diff --git a/.gitignore b/.gitignore
index 17c33067a82..2c7d1bd175d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,6 +57,7 @@ log
logs
docs/html
docs/latex
+docs/doxygen
32bit
scratch
diff --git a/buildscripts/docs.py b/buildscripts/docs.py
index b4e213c81d7..10bf5af55e9 100644
--- a/buildscripts/docs.py
+++ b/buildscripts/docs.py
@@ -1,33 +1,68 @@
+"""Build the C++ client docs and the MongoDB server docs.
+"""
+from __future__ import with_statement
import os
+import shutil
+import subprocess
+
import markdown
-def convertDir( source , dest ):
-
- if not os.path.exists( dest ):
- os.mkdir( dest )
- for x in os.listdir( source + "/" ):
- if not x.endswith( ".md" ):
+def clean_dir(dir):
+ try:
+ shutil.rmtree(dir)
+ except:
+ pass
+ os.makedirs(dir)
+
+
+def convert_dir(source, dest):
+ clean_dir(dest)
+
+ for x in os.listdir(source + "/"):
+ if not x.endswith(".md"):
continue
- f = open( source + "/" + x , 'r' )
- raw = f.read()
- f.close()
+ with open("%s/%s" % (source, x)) as f:
+ raw = f.read()
+
+ html = markdown.markdown(raw)
+ print(x)
+
+ with open("%s/%s" % (dest, x.replace(".md", ".html")), 'w') as o:
+ o.write(html)
+
- html = markdown.markdown( raw )
- print( x )
-
- o = open( dest + "/" + x.replace( ".md" , ".html" ) , 'w' )
- o.write( html )
- o.close()
-
+def gen_cplusplus(dir):
+ clean_dir(dir)
+ clean_dir("docs/doxygen")
+ # Too noisy...
+ with open("/dev/null") as null:
+ subprocess.call(["doxygen", "doxygenConfig"], stdout=null, stderr=null)
+
+ os.rename("docs/doxygen/html", dir)
+
+
+def version():
+ """Get the server version from doxygenConfig.
+ """
+ with open("doxygenConfig") as f:
+ for line in f.readlines():
+ if line.startswith("PROJECT_NUMBER"):
+ return line.split("=")[1].strip()
+
+
+def main():
+ v = version()
+ print("Generating server docs in docs/html/internal/%s" % v)
+ convert_dir("docs", "docs/html/internal/%s" % v)
+ print("Generating C++ docs in docs/html/cplusplus/%s" % v)
+ gen_cplusplus("docs/html/cplusplus/%s" % v)
-def convertMain():
- convertDir( "docs" , "docs/html" )
if __name__ == "__main__":
- convertMain()
+ main()
+
-
diff --git a/doxygenConfig b/doxygenConfig
index f315de7186d..da62f54741b 100644
--- a/doxygenConfig
+++ b/doxygenConfig
@@ -4,7 +4,7 @@
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = MongoDB
PROJECT_NUMBER = 1.5.4
-OUTPUT_DIRECTORY = docs
+OUTPUT_DIRECTORY = docs/doxygen
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES