]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/create_setup.h.py
non-pch build fix
[wxWidgets.git] / wxPython / distrib / create_setup.h.py
1 import sys, os, string, shutil, re
2
3 #TODO: copy .make files to build/msw
4
5 # update setup_h defines to match official wxPython settings
6 defines = {
7 'wxDIALOG_UNIT_COMPATIBILITY' :'0',
8 'wxUSE_DEBUG_CONTEXT' :'0',
9 'wxUSE_MEMORY_TRACING' :'0',
10 'wxUSE_DIALUP_MANAGER' :'0',
11 'wxUSE_GLCANVAS' :'1',
12 'wxUSE_POSTSCRIPT' :'1',
13 'wxUSE_AFM_FOR_POSTSCRIPT' :'0',
14 'wxUSE_DISPLAY' :'1',
15 'wxUSE_DEBUGREPORT' :'0'
16 }
17
18 uni_defines = {
19 'wxUSE_UNICODE' :'1',
20 'wxUSE_UNICODE_MSLU' :'1'
21 }
22
23 debug_defines = {
24 'wxUSE_DEBUG_CONTEXT' :'1',
25 'wxUSE_MEMORY_TRACING' :'1',
26 }
27
28 if "UNICODE=1" in sys.argv:
29 defines.update(uni_defines)
30
31 if "DEBUG=1" in sys.argv:
32 defines.update(debug_defines)
33
34 setup_dir = os.path.join("..", "..", "include", "wx", "msw")
35
36 # copy the file over if it doesn't exist
37 setup_h = os.path.join(setup_dir, "setup.h")
38 setup0_h = os.path.join(setup_dir, "setup0.h")
39 if not os.path.exists(setup_h) and os.path.exists(setup0_h):
40 shutil.copyfile(setup0_h, setup_h)
41
42 setup_file = open(setup_h, "rb").read()
43
44 for define in defines:
45 setup_file, num_subs = re.subn("%s\s+\d" % (define), "%s\t%s" % (define, defines[define]), setup_file)
46 print "# of subs made for pattern %s: %d" % (define, num_subs)
47
48 output = open(setup_h, "wb")
49 output.write(setup_file)
50 output.close()