Переглянути джерело

Added scripts to make the panda API reference docs

Josh Yelon 20 роки тому
батько
коміт
fac75f516f
2 змінених файлів з 103 додано та 0 видалено
  1. 26 0
      doc/makepanda/makedocs.bat
  2. 77 0
      doc/makepanda/makedocs.py

+ 26 - 0
doc/makepanda/makedocs.bat

@@ -0,0 +1,26 @@
+@echo off
+
+REM
+REM Verify that we can find the 'makedocs' python script
+REM and the python interpreter.  If we can find both, then
+REM run 'makedocs'.
+REM
+
+if not exist makepanda\makedocs.py goto :missing1
+if not exist thirdparty\win-python\python.exe goto :missing2
+thirdparty\win-python\python.exe makepanda\makedocs.py %*
+goto done
+
+:missing1
+  echo You need to change directory to the root of the panda source tree
+  echo before invoking makedocs.
+  goto done
+
+:missing2
+  echo You seem to be missing the 'thirdparty' directory.  You probably checked
+  echo the source code out from sourceforge.  The sourceforge repository is
+  echo missing the 'thirdparty' directory.  You will need to supplement the
+  echo code by downloading the 'thirdparty' directory from panda3d.etc.cmu.edu
+  goto done
+
+:done

+ 77 - 0
doc/makepanda/makedocs.py

@@ -0,0 +1,77 @@
+########################################################################
+##
+## Win32 Usage: makepanda\makedocs.bat
+## Linux Usage: makepanda/makedocs.py
+##
+########################################################################
+
+import sys,os,re
+sys.path = ["direct/src/directscripts"] + sys.path
+import gendocs
+
+########################################################################
+##
+## Some handy utility functions.
+##
+########################################################################
+
+def MakeDirectory(path):
+    if os.path.isdir(path): return 0
+    os.mkdir(path)
+
+########################################################################
+##
+## Read the version number from built/include/pandaVersion.h
+##
+########################################################################
+
+VERSION="0.0.0"
+try:
+    f = file("built/include/pandaVersion.h","r")
+    pattern = re.compile('^\s*[#]\s*define\s+PANDA_VERSION_STR\s+["]([0-9.]+)["]')
+    for line in f:
+        match = pattern.match(line,0)
+        if (match):
+            VERSION = match.group(1)
+            break
+    f.close()
+except: sys.exit("Cannot read version number from built/include/pandaVersion.h")
+
+print "Generating docs for "+VERSION
+
+########################################################################
+##
+## Make sure panda has been built.
+##
+########################################################################
+
+if (os.path.isfile("built/pandac/input/libpgraph.in")==0) or (os.path.isfile("built/pandac/input/libputil.in")==0):
+    sys.exit("Cannot read the interrogate-output files in built/pandac/input")
+
+########################################################################
+##
+## Generate the PHP version.
+##
+## The manual is in the form of a bunch of HTML files that can be
+## included by a PHP script called "/apiref.php".
+##
+########################################################################
+
+MakeDirectory("apiref-php")
+gendocs.generate(VERSION, "built/pandac/input", "direct", "apiref-php", "", "", "/apiref.php?page=", "")
+
+########################################################################
+##
+## Generate the HTML version.
+##
+## The manual is in the form of a bunch of standalone HTML files
+## that contain links to each other.
+##
+########################################################################
+
+HEADER = "<html><head></head><body>\n"
+FOOTER = "</body></html>\n"
+
+MakeDirectory("apiref-html")
+gendocs.generate(VERSION, "built/pandac/input", "direct", "apiref-html", HEADER, FOOTER, "", ".html")
+