Run swig from the main setup.py when building the renamer's XML

instead of from build_renamers.py.  This makes it easy to ensure that
the same flags are used.  Also, use the new swig flag to generate the
XML after the python language module has run, rather than instead of.
This gives us more info in the xml output.

Updated build_renamers.py to expect the xml file to already be
generated, and also allow it to run with a xml doc tree from libxml2
rather than the xml.sax module.  This makes the extraction of info
much cleaner and logical since we usually need info from child or
grandchild nodes.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24780 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-12-11 20:03:42 +00:00
parent 7cb55566ba
commit 8994c3c20c
2 changed files with 164 additions and 81 deletions

View File

@@ -246,6 +246,9 @@ def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=
if not os.path.exists(os.path.join(dir, gendir)):
os.mkdir(os.path.join(dir, gendir))
if not os.path.exists(os.path.join("docs", "xml-raw")):
os.mkdir(os.path.join("docs", "xml-raw"))
sources = []
for file in files:
@@ -253,6 +256,7 @@ def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=
i_file = os.path.join(dir, file)
py_file = os.path.join(dir, gendir, basefile+'.py')
cpp_file = os.path.join(dir, gendir, basefile+'_wrap.cpp')
xml_file = os.path.join("docs", "xml-raw", basefile+'_swig.xml')
sources.append(cpp_file)
@@ -268,14 +272,28 @@ def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=
#i_file = opj(i_file) #'/'.join(i_file.split('\\'))
if BUILD_RENAMERS:
# first run build_renamers
cmd = [ sys.executable, '-u',
'./distrib/build_renamers.py',
i_file, '-D'+WXPLAT, ] + \
[x for x in swig_args if x.startswith('-I')]
#info_file = "./distrib/swig_info"
#info_dict = { 'cmd' : swig_cmd,
# 'args' : swig_args + ['-I'+dir]
# }
#open(info_file, "w").write(str(args_dict))
# First run swig to produce the XML file, adding
# an extra -D that prevents the old rename
# directives from being used
cmd = [ swig_cmd ] + swig_args + \
[ '-DBUILDING_RENAMERS', '-xmlout', xml_file ] + \
['-I'+dir, '-o', cpp_file, i_file]
msg(' '.join(cmd))
spawn(cmd)
# Next run build_renamers to process the XML
cmd = [ sys.executable, '-u',
'./distrib/build_renamers.py', dir, basefile, xml_file]
msg(' '.join(cmd))
spawn(cmd)
#os.remove(info_file)
# Then run swig for real
cmd = [ swig_cmd ] + swig_args + ['-I'+dir, '-o', cpp_file, i_file]
msg(' '.join(cmd))