Add more stuff to the output file.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Patrick K. O'Brien
2003-05-06 19:20:24 +00:00
parent 4ed72fe0c3
commit f864dfa8f7

View File

@@ -7,20 +7,26 @@ __revision__ = "$Revision$"[11:-2]
import inspect
import os
import sys
import types
header = '''\
"""Decorator classes for documentation and shell scripting."""
"""wxPython decorator classes.
This file is automatically generated, and these are not the real
wxPython classes. These are Python versions for API documentation
purposes only.
Please send corrections, questions, and suggestions to:
Patrick K. O'Brien <pobrien@orbtech.com>
"""
__author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
# This file is automatically generated, and these are not the real
# wxPython classes. These are Python versions for documentation
# purposes only.
from wxPython.py.wxd import Parameters as wx
from wxd import Parameters as wx
try:
True
@@ -29,7 +35,6 @@ except NameError:
False = 1==0
'''
modlist = [
'Base',
'Window',
@@ -68,10 +73,12 @@ modlist = [
'Validators',
]
dir = os.path.realpath('api/wx/')
filename = os.path.join(dir, '__init__.py')
def main():
modules = {}
f = file('api/wx/__init__.py', 'w')
f = file(filename, 'w')
f.write(header)
for modname in modlist:
modules[modname] = __import__(modname, globals())
@@ -94,10 +101,33 @@ def main():
source = splitter + parts[1]
source = '\n\n\n' + source.strip()
f.write(source)
print 'Writing', modname, 'to file...'
print 'Writing', modname
f.write('\n')
f.close()
# Add constants and any other missing stuff.
f = file(filename, 'a')
f.write('\n\n## Other Stuff:\n\n')
import wx as old
old = old.__dict__
sys.path.insert(0, dir) # Munge the sys.path so that we can
import __init__ # import the file we just created.
new = __init__.__dict__
l = [(k, v) for (k, v) in old.items() if (not k.startswith('_')
and not k.endswith('Ptr')
and not (k == 'cvar'))]
l.sort()
from wxPython import wx
for key, value in l:
if key not in new:
if (inspect.isclass(value)
or inspect.isroutine(value)
or type(value) is types.InstanceType):
value = repr(value)
text = '%s = %r' % (key, value)
f.write(text + '\n')
print 'Writing', text
f.close()
if __name__ == '__main__':
main()