BGE API - small changes
[blender.git] / source / gameengine / PyDoc / bge_api_validate_py.txt
index 0920e5d3c7db47d353964a750dc03880d3e7d78f..492dcef408b51bbbeece73148410ae103922ac5d 100644 (file)
 # 
 # Currently it only prints missing modules and methods (not attributes)
 
+import sys, os
 
 BGE_API_DOC_PATH = 'source/gameengine/PyDoc'
 
+
+mods = ['GameLogic', 'Rasterizer', 'GameKeys']
+mods_dict = {}
+for m in mods:
+       mods_dict[m] = sys.modules[m]
+
+
 import GameTypes
 type_members = {}
 
@@ -34,7 +42,7 @@ for type_name in dir(GameTypes):
                # print type_object.__name__ + '.' + k
                members.append(member)
 
-import sys, os
+
 
 doc_dir= os.path.join(os.getcwd(), BGE_API_DOC_PATH)
 
@@ -58,7 +66,7 @@ def check_attribute(type_mame, member):
                        
                '''
                
-               if l.startswith('@ivar'):
+               if l.startswith('@ivar') or l.startswith('@var'):
                        var = l.split()[1].split(':')[0]
                        
                        if var == member:
@@ -108,3 +116,30 @@ for type_name in sorted(type_members.keys()):
                        else:
                                print "\tmissing: %s.%s" % (type_name, member)
 
+
+# Now check the modules
+for mod_name, pymod in mods_dict.iteritems():
+       print pymod
+       del sys.modules[mod_name]
+               
+       # Now well get the python version
+       pydoc = __import__(mod_name)
+       pydoc = reload(pydoc) # avoid using the out dated pyc file only
+       print pydoc.__file__
+       
+       for member in sorted(dir(pymod)):
+               if hasattr(pydoc, member) or check_attribute(mod_name, member):
+                       if PRINT_OK:
+                               print "\tfound module attr: %s.%s" % (mod_name, member)
+               else:
+                       print "\tmissing module attr: %s.%s" % (mod_name, member)
+       
+       # Restore real module
+       sys.modules[mod_name] = pymod
+
+
+sys.path.pop() # remove the pydoc dir from our import paths
+
+
+
+