| Index: documentation/build_docs.py
 | 
| ===================================================================
 | 
| --- documentation/build_docs.py	(revision 30795)
 | 
| +++ documentation/build_docs.py	(working copy)
 | 
| @@ -96,65 +96,6 @@
 | 
|    return name
 | 
|  
 | 
|  
 | 
| -def UpdateGlobals(dict):
 | 
| -  """Copies pairs from dict into GlobalDict."""
 | 
| -  for i, v in dict.items():
 | 
| -    GlobalsDict.__setitem__(i, v)
 | 
| -
 | 
| -
 | 
| -def GetCallingNamespaces():
 | 
| -  """Return the locals and globals for the function that called
 | 
| -  into this module in the current call stack."""
 | 
| -  try: 1/0
 | 
| -  except ZeroDivisionError:
 | 
| -    # Don't start iterating with the current stack-frame to
 | 
| -    # prevent creating reference cycles (f_back is safe).
 | 
| -    frame = sys.exc_info()[2].tb_frame.f_back
 | 
| -
 | 
| -  # Find the first frame that *isn't* from this file
 | 
| -  while frame.f_globals.get("__name__") == __name__:
 | 
| -    frame = frame.f_back
 | 
| -
 | 
| -  return frame.f_locals, frame.f_globals
 | 
| -
 | 
| -
 | 
| -def ComputeExports(exports):
 | 
| -  """Compute a dictionary of exports given one of the parameters
 | 
| -  to the Export() function or the exports argument to SConscript()."""
 | 
| -
 | 
| -  loc, glob = GetCallingNamespaces()
 | 
| -
 | 
| -  retval = {}
 | 
| -  try:
 | 
| -    for export in exports:
 | 
| -      if isinstance(export, types.DictType):
 | 
| -        retval.update(export)
 | 
| -      else:
 | 
| -        try:
 | 
| -          retval[export] = loc[export]
 | 
| -        except KeyError:
 | 
| -          retval[export] = glob[export]
 | 
| -  except KeyError, x:
 | 
| -    raise Error, "Export of non-existent variable '%s'"%x
 | 
| -
 | 
| -  return retval
 | 
| -
 | 
| -
 | 
| -def Export(*vars):
 | 
| -  """Copies the named variables to GlobalDict."""
 | 
| -  for var in vars:
 | 
| -    UpdateGlobals(ComputeExports(vars))
 | 
| -
 | 
| -
 | 
| -def Import(filename):
 | 
| -  """Imports a python file in a scope with 'Export' defined."""
 | 
| -  scope = {'__builtins__': globals()['__builtins__'],
 | 
| -           'Export': Export}
 | 
| -  file = open(filename, 'r')
 | 
| -  exec file in scope
 | 
| -  file.close()
 | 
| -
 | 
| -
 | 
|  def Execute(args):
 | 
|    """Executes an external program."""
 | 
|    # Comment the next line in for debugging.
 | 
| @@ -366,11 +307,11 @@
 | 
|    externs_path = MakePath('externs', 'externs.js')
 | 
|    o3d_extra_externs_path = MakePath('externs', 'o3d-extra-externs.js')
 | 
|  
 | 
| -  Import(js_list_filename)
 | 
| -  Import(idl_list_filename)
 | 
| +  js_list = eval(open(js_list_filename, "r").read())
 | 
| +  idl_list = eval(open(idl_list_filename, "r").read())
 | 
|  
 | 
| -  idl_files = AppendBasePath(idl_list_basepath, GlobalsDict['O3D_IDL_SOURCES'])
 | 
| -  o3djs_files = AppendBasePath(js_list_basepath, GlobalsDict['O3D_JS_SOURCES'])
 | 
| +  idl_files = AppendBasePath(idl_list_basepath, idl_list)
 | 
| +  o3djs_files = AppendBasePath(js_list_basepath, js_list)
 | 
|  
 | 
|    # we need to put base.js first?
 | 
|    o3djs_files = (
 | 
| @@ -380,7 +321,7 @@
 | 
|    docs_js_files = [os.path.join(
 | 
|                         docs_js_outpath,
 | 
|                         os.path.splitext(os.path.basename(f))[0] + '.js')
 | 
| -                   for f in GlobalsDict['O3D_IDL_SOURCES']]
 | 
| +                   for f in idl_list]
 | 
|  
 | 
|    DeleteOldDocs(MakePath(docs_outpath))
 | 
|    BuildJavaScriptForDocsFromIDLs(idl_files, docs_js_outpath)
 | 
| 
 |