]>
Commit | Line | Data |
---|---|---|
c368d904 RD |
1 | #!/usr/bin/env python |
2 | #---------------------------------------------------------------------- | |
3 | ||
1fded56b | 4 | import sys, os, glob, fnmatch |
c368d904 RD |
5 | from distutils.core import setup, Extension |
6 | from distutils.file_util import copy_file | |
7 | from distutils.dir_util import mkpath | |
8 | from distutils.dep_util import newer | |
1e4a197e RD |
9 | from distutils.spawn import spawn |
10 | from distutils.command.install_data import install_data | |
c368d904 RD |
11 | |
12 | #---------------------------------------------------------------------- | |
13 | # flags and values that affect this script | |
14 | #---------------------------------------------------------------------- | |
15 | ||
1fded56b RD |
16 | VER_MAJOR = 2 # The first three must match wxWindows |
17 | VER_MINOR = 5 | |
18 | VER_RELEASE = 0 | |
19 | VER_SUBREL = 0 # wxPython release num for x.y.z release of wxWindows | |
20 | VER_FLAGS = "p1" # release flags, such as prerelease num, unicode, etc. | |
21 | ||
c368d904 RD |
22 | DESCRIPTION = "Cross platform GUI toolkit for Python" |
23 | AUTHOR = "Robin Dunn" | |
b166c703 | 24 | AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>" |
c368d904 | 25 | URL = "http://wxPython.org/" |
e2e02194 | 26 | LICENSE = "wxWindows (LGPL derivative)" |
c368d904 RD |
27 | LONG_DESCRIPTION = """\ |
28 | wxPython is a GUI toolkit for Python that is a wrapper around the | |
29 | wxWindows C++ GUI library. wxPython provides a large variety of | |
1b62f00d | 30 | window types and controls, all implemented with a native look and |
1e4a197e | 31 | feel (by using the native widgets) on the platforms it is supported |
c368d904 RD |
32 | on. |
33 | """ | |
34 | ||
35 | ||
1e4a197e RD |
36 | # Config values below this point can be reset on the setup.py command line. |
37 | ||
f221f8eb | 38 | BUILD_GLCANVAS = 1 # If true, build the contrib/glcanvas extension module |
c368d904 RD |
39 | BUILD_OGL = 1 # If true, build the contrib/ogl extension module |
40 | BUILD_STC = 1 # If true, build the contrib/stc extension module | |
d56cebe7 | 41 | BUILD_XRC = 1 # XML based resource system |
ebf4302c | 42 | BUILD_GIZMOS = 1 # Build a module for the gizmos contrib library |
1e4a197e | 43 | BUILD_DLLWIDGET = 0# Build a module that enables unknown wx widgets |
37bd51c0 | 44 | # to be loaded from a DLL and to be used from Python. |
d56cebe7 | 45 | |
c731eb47 RD |
46 | # Internet Explorer wrapper (experimental) |
47 | BUILD_IEWIN = (os.name == 'nt') | |
78e8819c | 48 | |
1e4a197e RD |
49 | BUILD_CANVAS = 0 # Build a canvas module using the one in wx/contrib (experimental) |
50 | BUILD_ART2D = 0 # Build a canvas module using code from the wxArt2D project (experimental) | |
51 | ||
52 | ||
c368d904 | 53 | CORE_ONLY = 0 # if true, don't build any of the above |
4a61305d | 54 | |
1e4a197e | 55 | PREP_ONLY = 0 # Only run the prepatory steps, not the actual build. |
c368d904 RD |
56 | |
57 | USE_SWIG = 0 # Should we actually execute SWIG, or just use the | |
58 | # files already in the distribution? | |
59 | ||
a541c325 RD |
60 | UNICODE = 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and |
61 | # will ensure that the right headers are found and the | |
62 | # right libs are linked. | |
c8bc7bb8 | 63 | |
1e4a197e RD |
64 | IN_CVS_TREE = 1 # Set to true if building in a full wxWindows CVS |
65 | # tree, or the new style of a full wxPythonSrc tarball. | |
66 | # wxPython used to be distributed as a separate source | |
67 | # tarball without the wxWindows but with a copy of the | |
68 | # needed contrib code. That's no longer the case and so | |
69 | # this setting is now defaulting to true. Eventually it | |
70 | # should be removed entirly. | |
c368d904 | 71 | |
5c8e1089 RD |
72 | UNDEF_NDEBUG = 1 # Python 2.2 on Unix/Linux by default defines NDEBUG, |
73 | # and distutils will pick this up and use it on the | |
74 | # compile command-line for the extensions. This could | |
75 | # conflict with how wxWindows was built. If NDEBUG is | |
76 | # set then wxWindows' __WXDEBUG__ setting will be turned | |
77 | # off. If wxWindows was actually built with it turned | |
78 | # on then you end up with mismatched class structures, | |
79 | # and wxPython will crash. | |
80 | ||
2eb31f8b RD |
81 | NO_SCRIPTS = 0 # Don't install the tool scripts |
82 | ||
1e4a197e RD |
83 | WX_CONFIG = None # Usually you shouldn't need to touch this, but you can set |
84 | # it to pass an alternate version of wx-config or alternate | |
85 | # flags, eg. as required by the .deb in-tree build. By | |
86 | # default a wx-config command will be assembled based on | |
87 | # version, port, etc. and it will be looked for on the | |
88 | # default $PATH. | |
89 | ||
90 | WXPORT = 'gtk' # On Linux/Unix there are several ports of wxWindows available. | |
91 | # Setting this value lets you select which will be used for | |
92 | # the wxPython build. Possibilites are 'gtk', 'gtk2' and | |
93 | # 'x11'. Curently only gtk and gtk2 works. | |
94 | ||
95 | BUILD_BASE = "build" # Directory to use for temporary build files. | |
2eb31f8b | 96 | |
c368d904 | 97 | |
a541c325 | 98 | |
c368d904 RD |
99 | # Some MSW build settings |
100 | ||
d440a0e7 | 101 | FINAL = 0 # Mirrors use of same flag in wx makefiles, |
c368d904 RD |
102 | # (0 or 1 only) should probably find a way to |
103 | # autodetect this... | |
104 | ||
d440a0e7 | 105 | HYBRID = 1 # If set and not debug or FINAL, then build a |
c368d904 RD |
106 | # hybrid extension that can be used by the |
107 | # non-debug version of python, but contains | |
108 | # debugging symbols for wxWindows and wxPython. | |
109 | # wxWindows must have been built with /MD, not /MDd | |
110 | # (using FINAL=hybrid will do it.) | |
111 | ||
1e4a197e | 112 | WXDLLVER = '250' # Version part of wxWindows DLL name |
c368d904 RD |
113 | |
114 | ||
cfe766c3 RD |
115 | #---------------------------------------------------------------------- |
116 | ||
117 | def msg(text): | |
118 | if __name__ == "__main__": | |
119 | print text | |
120 | ||
a541c325 | 121 | |
55c020cf RD |
122 | def opj(*args): |
123 | path = apply(os.path.join, args) | |
124 | return os.path.normpath(path) | |
cfe766c3 | 125 | |
a541c325 | 126 | |
a4fbdd76 RD |
127 | def libFlag(): |
128 | if FINAL: | |
c8bc7bb8 | 129 | rv = '' |
a4fbdd76 | 130 | elif HYBRID: |
c8bc7bb8 | 131 | rv = 'h' |
a4fbdd76 | 132 | else: |
c8bc7bb8 | 133 | rv = 'd' |
a541c325 | 134 | if UNICODE: |
c8bc7bb8 RD |
135 | rv = 'u' + rv |
136 | return rv | |
a4fbdd76 RD |
137 | |
138 | ||
c368d904 RD |
139 | #---------------------------------------------------------------------- |
140 | # Some other globals | |
141 | #---------------------------------------------------------------------- | |
142 | ||
143 | PKGDIR = 'wxPython' | |
144 | wxpExtensions = [] | |
1e4a197e | 145 | DATA_FILES = [] |
c368d904 RD |
146 | |
147 | force = '--force' in sys.argv or '-f' in sys.argv | |
148 | debug = '--debug' in sys.argv or '-g' in sys.argv | |
149 | ||
1e4a197e RD |
150 | # change the PORT default for wxMac |
151 | if sys.platform[:6] == "darwin": | |
152 | WXPORT = 'mac' | |
22d08289 | 153 | |
1e4a197e RD |
154 | # and do the same for wxMSW, just for consistency |
155 | if os.name == 'nt': | |
156 | WXPORT = 'msw' | |
22d08289 | 157 | |
c368d904 RD |
158 | |
159 | #---------------------------------------------------------------------- | |
160 | # Check for build flags on the command line | |
161 | #---------------------------------------------------------------------- | |
162 | ||
5c8e1089 | 163 | # Boolean (int) flags |
b166c703 | 164 | for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC', |
c731eb47 | 165 | 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN', |
1e4a197e | 166 | 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'IN_CVS_TREE', 'UNICODE', |
2eb31f8b | 167 | 'UNDEF_NDEBUG', 'NO_SCRIPTS', |
b166c703 | 168 | 'FINAL', 'HYBRID', ]: |
c368d904 | 169 | for x in range(len(sys.argv)): |
1e4a197e RD |
170 | if sys.argv[x].find(flag) == 0: |
171 | pos = sys.argv[x].find('=') + 1 | |
c368d904 RD |
172 | if pos > 0: |
173 | vars()[flag] = eval(sys.argv[x][pos:]) | |
174 | sys.argv[x] = '' | |
175 | ||
5c8e1089 | 176 | # String options |
1e4a197e | 177 | for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT']: |
afa3e1ed | 178 | for x in range(len(sys.argv)): |
1e4a197e RD |
179 | if sys.argv[x].find(option) == 0: |
180 | pos = sys.argv[x].find('=') + 1 | |
afa3e1ed RL |
181 | if pos > 0: |
182 | vars()[option] = sys.argv[x][pos:] | |
183 | sys.argv[x] = '' | |
184 | ||
c368d904 RD |
185 | sys.argv = filter(None, sys.argv) |
186 | ||
187 | ||
1e4a197e RD |
188 | #---------------------------------------------------------------------- |
189 | # some helper functions | |
190 | #---------------------------------------------------------------------- | |
191 | ||
192 | def Verify_WX_CONFIG(): | |
193 | """ Called below for the builds that need wx-config, | |
194 | if WX_CONFIG is not set then tries to select the specific | |
195 | wx*-config script based on build options. If not found | |
196 | then it defaults to 'wx-config'. | |
197 | """ | |
198 | # if WX_CONFIG hasn't been set to an explicit value then construct one. | |
199 | global WX_CONFIG | |
200 | if WX_CONFIG is None: | |
201 | if debug: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWindows... | |
202 | df = 'd' | |
203 | else: | |
204 | df = '' | |
205 | if UNICODE: | |
206 | uf = 'u' | |
207 | else: | |
208 | uf = '' | |
1fded56b | 209 | ver2 = "%s.%s" % (VER_MAJOR, VER_MINOR) |
1e4a197e RD |
210 | WX_CONFIG = 'wx%s%s%s-%s-config' % (WXPORT, uf, df, ver2) |
211 | ||
212 | searchpath = os.environ["PATH"] | |
213 | for p in searchpath.split(':'): | |
214 | fp = os.path.join(p, WX_CONFIG) | |
215 | if os.path.exists(fp) and os.access(fp, os.X_OK): | |
216 | # success | |
217 | msg("Found wx-config: " + fp) | |
218 | WX_CONFIG = fp | |
219 | break | |
220 | else: | |
221 | msg("WX_CONFIG not specified and %s not found on $PATH " | |
222 | "defaulting to \"wx-config\"" % WX_CONFIG) | |
223 | WX_CONFIG = 'wx-config' | |
224 | ||
225 | ||
226 | ||
227 | def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=[]): | |
228 | """Run SWIG the way I want it done""" | |
229 | if not os.path.exists(os.path.join(dir, gendir)): | |
230 | os.mkdir(os.path.join(dir, gendir)) | |
231 | ||
232 | sources = [] | |
233 | ||
234 | for file in files: | |
235 | basefile = os.path.splitext(file)[0] | |
236 | i_file = os.path.join(dir, file) | |
237 | py_file = os.path.join(dir, gendir, basefile+'.py') | |
238 | cpp_file = os.path.join(dir, gendir, basefile+'.cpp') | |
239 | ||
240 | sources.append(cpp_file) | |
241 | ||
242 | if USE_SWIG: | |
243 | for dep in swig_deps: | |
244 | if newer(dep, py_file) or newer(dep, cpp_file): | |
245 | force = 1 | |
246 | break | |
247 | ||
248 | if force or newer(i_file, py_file) or newer(i_file, cpp_file): | |
249 | # we need forward slashes here even on win32 | |
250 | cpp_file = '/'.join(cpp_file.split('\\')) | |
251 | i_file = '/'.join(i_file.split('\\')) | |
252 | ||
253 | cmd = ['./wxSWIG/wxswig'] + swig_args + ['-I'+dir, '-c', '-o', cpp_file, i_file] | |
254 | msg(' '.join(cmd)) | |
255 | spawn(cmd) | |
256 | ||
257 | # copy the generated python file to the package directory | |
258 | copy_file(py_file, package, update=not force, verbose=0) | |
259 | ||
260 | return sources | |
261 | ||
262 | ||
263 | ||
264 | def contrib_copy_tree(src, dest, verbose=0): | |
265 | """Update local copies of wxWindows contrib files""" | |
266 | from distutils.dir_util import mkpath, copy_tree | |
267 | ||
268 | mkpath(dest, verbose=verbose) | |
269 | copy_tree(src, dest, update=1, verbose=verbose) | |
270 | ||
271 | ||
272 | ||
273 | class smart_install_data(install_data): | |
274 | def run(self): | |
275 | #need to change self.install_dir to the actual library dir | |
276 | install_cmd = self.get_finalized_command('install') | |
277 | self.install_dir = getattr(install_cmd, 'install_lib') | |
278 | return install_data.run(self) | |
279 | ||
280 | ||
281 | def build_locale_dir(destdir, verbose=1): | |
282 | """Build a locale dir under the wxPython package for MSW""" | |
283 | moFiles = glob.glob(opj(WXDIR, 'locale', '*.mo')) | |
284 | for src in moFiles: | |
285 | lang = os.path.splitext(os.path.basename(src))[0] | |
286 | dest = opj(destdir, lang, 'LC_MESSAGES') | |
287 | mkpath(dest, verbose=verbose) | |
288 | copy_file(src, opj(dest, 'wxstd.mo'), update=1, verbose=verbose) | |
289 | ||
290 | ||
291 | def build_locale_list(srcdir): | |
292 | # get a list of all files under the srcdir, to be used for install_data | |
293 | def walk_helper(lst, dirname, files): | |
294 | for f in files: | |
295 | filename = opj(dirname, f) | |
296 | if not os.path.isdir(filename): | |
297 | lst.append( (dirname, [filename]) ) | |
298 | file_list = [] | |
299 | os.path.walk(srcdir, walk_helper, file_list) | |
300 | return file_list | |
301 | ||
302 | ||
1fded56b RD |
303 | def find_data_files(srcdir, *wildcards): |
304 | # get a list of all files under the srcdir matching wildcards, | |
305 | # returned in a format to be used for install_data | |
306 | ||
307 | def walk_helper(arg, dirname, files): | |
308 | names = [] | |
309 | lst, wildcards = arg | |
310 | for wc in wildcards: | |
311 | for f in files: | |
312 | filename = opj(dirname, f) | |
313 | if fnmatch.fnmatch(filename, wc) and not os.path.isdir(filename): | |
314 | names.append(filename) | |
315 | if names: | |
316 | lst.append( (dirname, names ) ) | |
317 | ||
318 | file_list = [] | |
319 | os.path.walk(srcdir, walk_helper, (file_list, wildcards)) | |
320 | return file_list | |
1e4a197e RD |
321 | |
322 | ||
c8bc7bb8 RD |
323 | |
324 | #---------------------------------------------------------------------- | |
325 | # sanity checks | |
326 | ||
c368d904 | 327 | if CORE_ONLY: |
f221f8eb | 328 | BUILD_GLCANVAS = 0 |
c368d904 RD |
329 | BUILD_OGL = 0 |
330 | BUILD_STC = 0 | |
b166c703 | 331 | BUILD_XRC = 0 |
ff5f1aba RD |
332 | BUILD_GIZMOS = 0 |
333 | BUILD_DLLWIDGET = 0 | |
c731eb47 | 334 | BUILD_IEWIN = 0 |
ff5f1aba | 335 | |
1e4a197e RD |
336 | if debug: |
337 | FINAL = 0 | |
338 | HYBRID = 0 | |
c368d904 | 339 | |
1e4a197e RD |
340 | if FINAL: |
341 | HYBRID = 0 | |
c8bc7bb8 | 342 | |
1e4a197e RD |
343 | if UNICODE and WXPORT not in ['msw', 'gtk2']: |
344 | raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT | |
a541c325 RD |
345 | |
346 | ||
c368d904 RD |
347 | #---------------------------------------------------------------------- |
348 | # Setup some platform specific stuff | |
349 | #---------------------------------------------------------------------- | |
350 | ||
351 | if os.name == 'nt': | |
352 | # Set compile flags and such for MSVC. These values are derived | |
a541c325 RD |
353 | # from the wxWindows makefiles for MSVC, other compilers settings |
354 | # will probably vary... | |
355 | if os.environ.has_key('WXWIN'): | |
356 | WXDIR = os.environ['WXWIN'] | |
357 | else: | |
358 | msg("WARNING: WXWIN not set in environment.") | |
359 | WXDIR = '..' # assumes in CVS tree | |
c368d904 RD |
360 | WXPLAT = '__WXMSW__' |
361 | GENDIR = 'msw' | |
362 | ||
c368d904 | 363 | includes = ['src', |
a4fbdd76 | 364 | opj(WXDIR, 'lib', 'mswdll' + libFlag()), |
55c020cf | 365 | opj(WXDIR, 'include'), |
c368d904 RD |
366 | ] |
367 | ||
1e4a197e RD |
368 | defines = [ ('WIN32', None), |
369 | ('__WIN32__', None), | |
c368d904 RD |
370 | ('_WINDOWS', None), |
371 | ('__WINDOWS__', None), | |
372 | ('WINVER', '0x0400'), | |
373 | ('__WIN95__', None), | |
374 | ('STRICT', None), | |
375 | ||
376 | (WXPLAT, None), | |
377 | ('WXUSINGDLL', '1'), | |
378 | ||
379 | ('SWIG_GLOBAL', None), | |
380 | ('HAVE_CONFIG_H', None), | |
381 | ('WXP_USE_THREAD', '1'), | |
382 | ] | |
383 | ||
1e4a197e RD |
384 | if UNDEF_NDEBUG: |
385 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
22d08289 RD |
386 | |
387 | ||
c368d904 RD |
388 | if not FINAL or HYBRID: |
389 | defines.append( ('__WXDEBUG__', None) ) | |
390 | ||
d440a0e7 | 391 | libdirs = [ opj(WXDIR, 'lib') ] |
a4fbdd76 | 392 | wxdll = 'wxmsw' + WXDLLVER + libFlag() |
d440a0e7 | 393 | libs = [ wxdll ] |
a4fbdd76 | 394 | |
22d08289 | 395 | libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32', |
c368d904 | 396 | 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32', |
1e4a197e | 397 | 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4', |
c368d904 RD |
398 | 'advapi32', 'wsock32'] |
399 | ||
22d08289 | 400 | |
d440a0e7 | 401 | cflags = [ '/Gy', |
ad07d019 RD |
402 | # '/GX-' # workaround for internal compiler error in MSVC on some machines |
403 | ] | |
c368d904 RD |
404 | lflags = None |
405 | ||
1e4a197e | 406 | # Other MSVC flags... |
1fded56b | 407 | # Too bad I don't remember why I was playing with these, can they be removed? |
1e4a197e RD |
408 | if FINAL: |
409 | pass #cflags = cflags + ['/O1'] | |
410 | elif HYBRID : | |
411 | pass #cflags = cflags + ['/Ox'] | |
412 | else: | |
413 | pass # cflags = cflags + ['/Od', '/Z7'] | |
414 | # lflags = ['/DEBUG', ] | |
22d08289 RD |
415 | |
416 | ||
22d08289 | 417 | |
1e4a197e | 418 | #---------------------------------------------------------------------- |
c368d904 | 419 | |
dbd3685c | 420 | elif os.name == 'posix' and sys.platform[:6] == "darwin": |
e6056257 | 421 | # Flags and such for a Darwin (Max OS X) build of Python |
e6056257 RD |
422 | WXDIR = '..' # assumes IN_CVS_TREE |
423 | WXPLAT = '__WXMAC__' | |
424 | GENDIR = 'mac' | |
425 | ||
426 | includes = ['src'] | |
427 | defines = [('SWIG_GLOBAL', None), | |
428 | ('HAVE_CONFIG_H', None), | |
429 | ('WXP_USE_THREAD', '1'), | |
430 | ] | |
1e4a197e RD |
431 | if UNDEF_NDEBUG: |
432 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
e6056257 | 433 | libdirs = [] |
1e4a197e RD |
434 | libs = ['stdc++'] |
435 | ||
436 | Verify_WX_CONFIG() | |
e6056257 RD |
437 | |
438 | cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] | |
1e4a197e | 439 | cflags = cflags.split() |
ba201fa4 RD |
440 | if debug: |
441 | cflags.append('-g') | |
442 | cflags.append('-O0') | |
e6056257 RD |
443 | |
444 | lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] | |
1e4a197e | 445 | lflags = lflags.split() |
e6056257 | 446 | |
2eb31f8b | 447 | NO_SCRIPTS = 1 |
e6056257 RD |
448 | |
449 | ||
1e4a197e | 450 | #---------------------------------------------------------------------- |
c368d904 | 451 | |
1e4a197e RD |
452 | elif os.name == 'posix': |
453 | # Set flags for other Unix type platforms | |
c368d904 | 454 | WXDIR = '..' # assumes IN_CVS_TREE |
1e4a197e RD |
455 | GENDIR = WXPORT |
456 | ||
457 | if WXPORT == 'gtk': | |
458 | WXPLAT = '__WXGTK__' | |
459 | portcfg = os.popen('gtk-config --cflags', 'r').read()[:-1] | |
460 | elif WXPORT == 'gtk2': | |
461 | WXPLAT = '__WXGTK__' | |
462 | GENDIR = 'gtk' # no code differences so use the same generated sources | |
463 | portcfg = os.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1] | |
464 | BUILD_BASE = BUILD_BASE + '-' + WXPORT | |
465 | elif WXPORT == 'x11': | |
466 | WXPLAT = '__WXX11__' | |
467 | portcfg = '' | |
468 | BUILD_BASE = BUILD_BASE + '-' + WXPORT | |
469 | else: | |
470 | raise SystemExit, "Unknown WXPORT value: " + WXPORT | |
c368d904 RD |
471 | |
472 | includes = ['src'] | |
473 | defines = [('SWIG_GLOBAL', None), | |
474 | ('HAVE_CONFIG_H', None), | |
475 | ('WXP_USE_THREAD', '1'), | |
476 | ] | |
1e4a197e RD |
477 | if UNDEF_NDEBUG: |
478 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
479 | ||
c368d904 RD |
480 | libdirs = [] |
481 | libs = [] | |
482 | ||
1e4a197e RD |
483 | Verify_WX_CONFIG() |
484 | ||
485 | cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] + ' ' + portcfg | |
486 | ||
487 | cflags = cflags.split() | |
ba201fa4 RD |
488 | if debug: |
489 | cflags.append('-g') | |
490 | cflags.append('-O0') | |
c368d904 | 491 | |
afa3e1ed | 492 | lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] |
1e4a197e RD |
493 | lflags = lflags.split() |
494 | ||
495 | # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but | |
496 | # wx-config doesn't output that for some reason. For now, just | |
497 | # add it unconditionally but we should really check if the lib is | |
498 | # really found there or wx-config should be fixed. | |
499 | libdirs.append("/usr/X11R6/lib") | |
c368d904 RD |
500 | |
501 | ||
1e4a197e | 502 | #---------------------------------------------------------------------- |
c368d904 | 503 | else: |
1e4a197e RD |
504 | raise 'Sorry Charlie, platform not supported...' |
505 | ||
506 | ||
507 | #---------------------------------------------------------------------- | |
1fded56b | 508 | # post platform setup checks and tweaks, create the full version string |
1e4a197e RD |
509 | #---------------------------------------------------------------------- |
510 | ||
511 | if UNICODE: | |
512 | BUILD_BASE = BUILD_BASE + '.unicode' | |
1fded56b | 513 | VER_FLAGS += 'u' |
c368d904 RD |
514 | |
515 | ||
1fded56b RD |
516 | VERSION = "%s.%s.%s.%s%s" % (VER_MAJOR, VER_MINOR, VER_RELEASE, |
517 | VER_SUBREL, VER_FLAGS) | |
518 | ||
c368d904 | 519 | #---------------------------------------------------------------------- |
1fded56b | 520 | # Update the version file |
c368d904 RD |
521 | #---------------------------------------------------------------------- |
522 | ||
1fded56b RD |
523 | # Unconditionally updated since the version string can change based |
524 | # on the UNICODE flag | |
525 | open('src/__version__.py', 'w').write("""\ | |
526 | # This file was generated by setup.py... | |
527 | ||
528 | wxVERSION_STRING = '%(VERSION)s' | |
529 | wxMAJOR_VERSION = %(VER_MAJOR)s | |
530 | wxMINOR_VERSION = %(VER_MINOR)s | |
531 | wxRELEASE_VERSION = %(VER_RELEASE)s | |
532 | wxSUBREL_VERSION = %(VER_SUBREL)s | |
533 | ||
534 | wxVERSION = (wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_VERSION, | |
535 | wxSUBREL_VERSION, '%(VER_FLAGS)s') | |
536 | ||
537 | wxRELEASE_NUMBER = wxRELEASE_VERSION # for compatibility | |
538 | """ % globals()) | |
1e4a197e | 539 | |
c368d904 | 540 | |
1b62f00d RD |
541 | |
542 | ||
c368d904 | 543 | #---------------------------------------------------------------------- |
1b62f00d | 544 | # SWIG defaults |
c368d904 RD |
545 | #---------------------------------------------------------------------- |
546 | ||
c368d904 | 547 | swig_force = force |
00b6c4e3 RD |
548 | swig_args = ['-c++', '-shadow', '-python', '-keyword', |
549 | '-dnone', | |
550 | #'-dascii', | |
551 | #'-docstring', '-Sbefore', | |
e6056257 RD |
552 | '-I./src', '-D'+WXPLAT, |
553 | ] | |
a541c325 | 554 | if UNICODE: |
c8bc7bb8 RD |
555 | swig_args.append('-DwxUSE_UNICODE') |
556 | ||
185d7c3e | 557 | swig_deps = ['src/my_typemaps.i'] |
c368d904 | 558 | |
c368d904 | 559 | |
1b62f00d RD |
560 | #---------------------------------------------------------------------- |
561 | # Define the CORE extension module | |
562 | #---------------------------------------------------------------------- | |
563 | ||
1e4a197e RD |
564 | msg('Preparing CORE...') |
565 | swig_files = [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i', | |
566 | 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i', | |
567 | 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i', | |
568 | 'printfw.i', 'sizers.i', 'clip_dnd.i', | |
569 | 'filesys.i', 'streams.i', 'utils.i', 'fonts.i' | |
570 | ] | |
1b62f00d | 571 | |
1e4a197e RD |
572 | swig_sources = run_swig(swig_files, 'src', GENDIR, PKGDIR, |
573 | USE_SWIG, swig_force, swig_args, swig_deps) | |
1b62f00d | 574 | |
1e4a197e RD |
575 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) |
576 | copy_file('src/__version__.py', PKGDIR, update=1, verbose=0) | |
1b62f00d RD |
577 | |
578 | ||
1e4a197e RD |
579 | if IN_CVS_TREE: # update the license files |
580 | mkpath('licence') | |
581 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
582 | copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0) | |
c368d904 | 583 | |
c368d904 | 584 | |
1e4a197e RD |
585 | if os.name == 'nt': |
586 | build_locale_dir(opj(PKGDIR, 'locale')) | |
587 | DATA_FILES += build_locale_list(opj(PKGDIR, 'locale')) | |
4f3449b4 RD |
588 | |
589 | ||
1e4a197e RD |
590 | if os.name == 'nt': |
591 | rc_file = ['src/wxc.rc'] | |
592 | else: | |
593 | rc_file = [] | |
594 | ||
595 | ||
596 | ext = Extension('wxc', ['src/helpers.cpp', | |
597 | 'src/drawlist.cpp', | |
598 | 'src/libpy.c', | |
599 | ] + rc_file + swig_sources, | |
600 | ||
601 | include_dirs = includes, | |
602 | define_macros = defines, | |
603 | ||
604 | library_dirs = libdirs, | |
605 | libraries = libs, | |
606 | ||
607 | extra_compile_args = cflags, | |
608 | extra_link_args = lflags, | |
609 | ) | |
610 | wxpExtensions.append(ext) | |
611 | ||
612 | ||
613 | # Extension for the grid module | |
614 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
615 | USE_SWIG, swig_force, swig_args, swig_deps) | |
616 | ext = Extension('gridc', swig_sources, | |
617 | include_dirs = includes, | |
618 | define_macros = defines, | |
619 | library_dirs = libdirs, | |
620 | libraries = libs, | |
621 | extra_compile_args = cflags, | |
622 | extra_link_args = lflags, | |
623 | ) | |
624 | wxpExtensions.append(ext) | |
625 | ||
626 | ||
627 | # Extension for the html modules | |
628 | swig_sources = run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR, PKGDIR, | |
629 | USE_SWIG, swig_force, swig_args, swig_deps) | |
630 | ext = Extension('htmlc', swig_sources, | |
631 | include_dirs = includes, | |
632 | define_macros = defines, | |
633 | library_dirs = libdirs, | |
634 | libraries = libs, | |
635 | extra_compile_args = cflags, | |
636 | extra_link_args = lflags, | |
637 | ) | |
638 | wxpExtensions.append(ext) | |
639 | ||
640 | ||
641 | # Extension for the calendar module | |
642 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, | |
643 | USE_SWIG, swig_force, swig_args, swig_deps) | |
644 | ext = Extension('calendarc', swig_sources, | |
645 | include_dirs = includes, | |
646 | define_macros = defines, | |
647 | library_dirs = libdirs, | |
648 | libraries = libs, | |
649 | extra_compile_args = cflags, | |
650 | extra_link_args = lflags, | |
651 | ) | |
652 | wxpExtensions.append(ext) | |
653 | ||
654 | ||
655 | # Extension for the help module | |
656 | swig_sources = run_swig(['help.i'], 'src', GENDIR, PKGDIR, | |
657 | USE_SWIG, swig_force, swig_args, swig_deps) | |
658 | ext = Extension('helpc', swig_sources, | |
659 | include_dirs = includes, | |
660 | define_macros = defines, | |
661 | library_dirs = libdirs, | |
662 | libraries = libs, | |
663 | extra_compile_args = cflags, | |
664 | extra_link_args = lflags, | |
665 | ) | |
666 | wxpExtensions.append(ext) | |
667 | ||
668 | ||
669 | # Extension for the wizard module | |
670 | swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR, | |
671 | USE_SWIG, swig_force, swig_args, swig_deps) | |
672 | ext = Extension('wizardc', swig_sources, | |
673 | include_dirs = includes, | |
674 | define_macros = defines, | |
675 | library_dirs = libdirs, | |
676 | libraries = libs, | |
677 | extra_compile_args = cflags, | |
678 | extra_link_args = lflags, | |
679 | ) | |
680 | wxpExtensions.append(ext) | |
af83019e RD |
681 | |
682 | ||
c368d904 RD |
683 | #---------------------------------------------------------------------- |
684 | # Define the GLCanvas extension module | |
685 | #---------------------------------------------------------------------- | |
686 | ||
55c020cf RD |
687 | CTRB_SRC = opj(WXDIR, 'contrib/src') |
688 | CTRB_INC = opj(WXDIR, 'contrib/include/wx') | |
689 | ||
1e4a197e | 690 | if BUILD_GLCANVAS: |
cfe766c3 | 691 | msg('Preparing GLCANVAS...') |
c368d904 RD |
692 | location = 'contrib/glcanvas' |
693 | swig_files = ['glcanvas.i'] | |
19cf4f80 | 694 | other_sources = [] |
c368d904 RD |
695 | |
696 | swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, | |
10ef30eb | 697 | USE_SWIG, swig_force, swig_args, swig_deps) |
c368d904 RD |
698 | |
699 | gl_libs = [] | |
700 | if os.name == 'posix': | |
f32afe1c | 701 | gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] |
1e4a197e | 702 | gl_lflags = gl_config.split() + lflags |
f32afe1c | 703 | gl_libs = libs |
19cf4f80 | 704 | else: |
55c020cf | 705 | other_sources = [opj(location, 'msw/myglcanvas.cpp')] |
f32afe1c RD |
706 | gl_libs = libs + ['opengl32', 'glu32'] |
707 | gl_lflags = lflags | |
c368d904 | 708 | |
1e7ecb7b | 709 | ext = Extension('glcanvasc', |
19cf4f80 | 710 | swig_sources + other_sources, |
1e7ecb7b RD |
711 | |
712 | include_dirs = includes, | |
713 | define_macros = defines, | |
714 | ||
715 | library_dirs = libdirs, | |
f32afe1c | 716 | libraries = gl_libs, |
1e7ecb7b RD |
717 | |
718 | extra_compile_args = cflags, | |
f32afe1c | 719 | extra_link_args = gl_lflags, |
1e7ecb7b RD |
720 | ) |
721 | ||
722 | wxpExtensions.append(ext) | |
c368d904 RD |
723 | |
724 | ||
725 | #---------------------------------------------------------------------- | |
726 | # Define the OGL extension module | |
727 | #---------------------------------------------------------------------- | |
728 | ||
1e4a197e | 729 | if BUILD_OGL: |
cfe766c3 | 730 | msg('Preparing OGL...') |
c368d904 | 731 | location = 'contrib/ogl' |
55c020cf RD |
732 | OGLLOC = opj(location, 'contrib/src/ogl') |
733 | OGLINC = opj(location, 'contrib/include') | |
c368d904 RD |
734 | |
735 | swig_files = ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i', | |
736 | 'oglcanvas.i'] | |
737 | ||
738 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 739 | USE_SWIG, swig_force, swig_args, swig_deps) |
c368d904 | 740 | |
c368d904 | 741 | if IN_CVS_TREE: |
55c020cf RD |
742 | # make sure local copy of contrib files are up to date |
743 | contrib_copy_tree(opj(CTRB_INC, 'ogl'), opj(OGLINC, 'wx/ogl')) | |
744 | contrib_copy_tree(opj(CTRB_SRC, 'ogl'), OGLLOC) | |
c368d904 | 745 | |
1e7ecb7b RD |
746 | ext = Extension('oglc', ['%s/basic.cpp' % OGLLOC, |
747 | '%s/bmpshape.cpp' % OGLLOC, | |
748 | '%s/composit.cpp' % OGLLOC, | |
749 | '%s/divided.cpp' % OGLLOC, | |
750 | '%s/lines.cpp' % OGLLOC, | |
751 | '%s/misc.cpp' % OGLLOC, | |
752 | '%s/basic2.cpp' % OGLLOC, | |
753 | '%s/canvas.cpp' % OGLLOC, | |
754 | '%s/constrnt.cpp' % OGLLOC, | |
755 | '%s/drawn.cpp' % OGLLOC, | |
756 | '%s/mfutils.cpp' % OGLLOC, | |
757 | '%s/ogldiag.cpp' % OGLLOC, | |
758 | ] + swig_sources, | |
759 | ||
760 | include_dirs = [OGLINC] + includes, | |
761 | define_macros = defines, | |
762 | ||
763 | library_dirs = libdirs, | |
764 | libraries = libs, | |
765 | ||
766 | extra_compile_args = cflags, | |
767 | extra_link_args = lflags, | |
768 | ) | |
769 | ||
770 | wxpExtensions.append(ext) | |
771 | ||
772 | ||
c368d904 RD |
773 | |
774 | #---------------------------------------------------------------------- | |
775 | # Define the STC extension module | |
776 | #---------------------------------------------------------------------- | |
777 | ||
1e4a197e | 778 | if BUILD_STC: |
cfe766c3 | 779 | msg('Preparing STC...') |
c368d904 | 780 | location = 'contrib/stc' |
55c020cf RD |
781 | STCLOC = opj(location, 'contrib/src/stc') |
782 | STCINC = opj(location, 'contrib/include') | |
783 | STC_H = opj(location, 'contrib/include/wx/stc') | |
c368d904 | 784 | |
c368d904 | 785 | if IN_CVS_TREE: |
55c020cf RD |
786 | # Check if gen_iface needs to be run for the wxSTC sources |
787 | if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or | |
788 | newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or | |
789 | newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))): | |
790 | ||
791 | msg('Running gen_iface.py, regenerating stc.h and stc.cpp...') | |
792 | cwd = os.getcwd() | |
793 | os.chdir(opj(CTRB_SRC, 'stc')) | |
1e4a197e | 794 | sys.path.insert(0, os.curdir) |
55c020cf RD |
795 | import gen_iface |
796 | gen_iface.main([]) | |
797 | os.chdir(cwd) | |
798 | ||
799 | ||
800 | # make sure local copy of contrib files are up to date | |
801 | contrib_copy_tree(opj(CTRB_INC, 'stc'), opj(STCINC, 'wx/stc')) | |
802 | contrib_copy_tree(opj(CTRB_SRC, 'stc'), STCLOC) | |
803 | ||
c368d904 RD |
804 | |
805 | ||
806 | swig_files = ['stc_.i'] | |
74933d75 | 807 | swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR, |
c368d904 RD |
808 | USE_SWIG, swig_force, |
809 | swig_args + ['-I'+STC_H, '-I'+location], | |
10ef30eb | 810 | [opj(STC_H, 'stc.h')] + swig_deps) |
c368d904 | 811 | |
4a61305d | 812 | # copy a contrib project specific py module to the main package dir |
55c020cf | 813 | copy_file(opj(location, 'stc.py'), PKGDIR, update=1, verbose=0) |
c368d904 RD |
814 | |
815 | # add some include dirs to the standard set | |
1e7ecb7b RD |
816 | stc_includes = includes[:] |
817 | stc_includes.append('%s/scintilla/include' % STCLOC) | |
818 | stc_includes.append('%s/scintilla/src' % STCLOC) | |
819 | stc_includes.append(STCINC) | |
c368d904 RD |
820 | |
821 | # and some macro definitions | |
1e7ecb7b RD |
822 | stc_defines = defines[:] |
823 | stc_defines.append( ('__WX__', None) ) | |
824 | stc_defines.append( ('SCI_LEXER', None) ) | |
1a2fb4cd | 825 | stc_defines.append( ('LINK_LEXERS', None) ) |
c368d904 RD |
826 | |
827 | ||
1e7ecb7b | 828 | ext = Extension('stc_c', |
1fded56b RD |
829 | ['%s/PlatWX.cpp' % STCLOC, |
830 | '%s/ScintillaWX.cpp' % STCLOC, | |
831 | '%s/stc.cpp' % STCLOC, | |
832 | ||
833 | '%s/scintilla/src/AutoComplete.cxx' % STCLOC, | |
c368d904 RD |
834 | '%s/scintilla/src/CallTip.cxx' % STCLOC, |
835 | '%s/scintilla/src/CellBuffer.cxx' % STCLOC, | |
836 | '%s/scintilla/src/ContractionState.cxx' % STCLOC, | |
837 | '%s/scintilla/src/Document.cxx' % STCLOC, | |
55c020cf | 838 | '%s/scintilla/src/DocumentAccessor.cxx' % STCLOC, |
c368d904 RD |
839 | '%s/scintilla/src/Editor.cxx' % STCLOC, |
840 | '%s/scintilla/src/Indicator.cxx' % STCLOC, | |
841 | '%s/scintilla/src/KeyMap.cxx' % STCLOC, | |
842 | '%s/scintilla/src/KeyWords.cxx' % STCLOC, | |
843 | '%s/scintilla/src/LineMarker.cxx' % STCLOC, | |
844 | '%s/scintilla/src/PropSet.cxx' % STCLOC, | |
55c020cf | 845 | '%s/scintilla/src/RESearch.cxx' % STCLOC, |
c368d904 RD |
846 | '%s/scintilla/src/ScintillaBase.cxx' % STCLOC, |
847 | '%s/scintilla/src/Style.cxx' % STCLOC, | |
fe0aca37 | 848 | '%s/scintilla/src/StyleContext.cxx' % STCLOC, |
55c020cf | 849 | '%s/scintilla/src/UniConversion.cxx' % STCLOC, |
c368d904 | 850 | '%s/scintilla/src/ViewStyle.cxx' % STCLOC, |
55c020cf | 851 | '%s/scintilla/src/WindowAccessor.cxx' % STCLOC, |
1fded56b RD |
852 | '%s/scintilla/src/XPM.cxx' % STCLOC, |
853 | ] | |
854 | + glob.glob('%s/scintilla/src/Lex*.cxx' % STCLOC) | |
855 | + swig_sources, | |
1e7ecb7b RD |
856 | |
857 | include_dirs = stc_includes, | |
858 | define_macros = stc_defines, | |
859 | ||
860 | library_dirs = libdirs, | |
861 | libraries = libs, | |
c368d904 | 862 | |
1e7ecb7b RD |
863 | extra_compile_args = cflags, |
864 | extra_link_args = lflags, | |
865 | ) | |
866 | ||
867 | wxpExtensions.append(ext) | |
c368d904 RD |
868 | |
869 | ||
870 | ||
926bb76c RD |
871 | #---------------------------------------------------------------------- |
872 | # Define the IEWIN extension module (experimental) | |
873 | #---------------------------------------------------------------------- | |
874 | ||
1e4a197e | 875 | if BUILD_IEWIN: |
cfe766c3 | 876 | msg('Preparing IEWIN...') |
926bb76c RD |
877 | location = 'contrib/iewin' |
878 | ||
879 | swig_files = ['iewin.i', ] | |
880 | ||
881 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 882 | USE_SWIG, swig_force, swig_args, swig_deps) |
926bb76c RD |
883 | |
884 | ||
885 | ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location, | |
c731eb47 | 886 | '%s/wxactivex.cpp' % location, |
926bb76c RD |
887 | ] + swig_sources, |
888 | ||
889 | include_dirs = includes, | |
890 | define_macros = defines, | |
891 | ||
892 | library_dirs = libdirs, | |
893 | libraries = libs, | |
894 | ||
895 | extra_compile_args = cflags, | |
896 | extra_link_args = lflags, | |
897 | ) | |
898 | ||
899 | wxpExtensions.append(ext) | |
900 | ||
901 | ||
d56cebe7 RD |
902 | #---------------------------------------------------------------------- |
903 | # Define the XRC extension module | |
904 | #---------------------------------------------------------------------- | |
905 | ||
1e4a197e | 906 | if BUILD_XRC: |
cfe766c3 | 907 | msg('Preparing XRC...') |
d56cebe7 | 908 | location = 'contrib/xrc' |
55c020cf RD |
909 | XMLLOC = opj(location, 'contrib/src/xrc') |
910 | XMLINC = opj(location, 'contrib/include') | |
d56cebe7 RD |
911 | |
912 | swig_files = ['xrc.i'] | |
913 | ||
914 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 915 | USE_SWIG, swig_force, swig_args, swig_deps) |
d56cebe7 RD |
916 | |
917 | xmlres_includes = includes[:] | |
918 | xmlres_includes.append('%s/expat/xmlparse' % XMLLOC) | |
919 | xmlres_includes.append('%s/expat/xmltok' % XMLLOC) | |
920 | xmlres_includes.append(XMLINC) | |
921 | ||
922 | ||
923 | # make sure local copy of contrib files are up to date | |
924 | if IN_CVS_TREE: | |
55c020cf RD |
925 | contrib_copy_tree(opj(CTRB_INC, 'xrc'), opj(XMLINC, 'wx/xrc')) |
926 | contrib_copy_tree(opj(CTRB_SRC, 'xrc'), XMLLOC) | |
d56cebe7 | 927 | |
1fded56b RD |
928 | ext = Extension('xrcc', |
929 | ['%s/expat/xmlparse/xmlparse.c' % XMLLOC, | |
930 | '%s/expat/xmltok/xmlrole.c' % XMLLOC, | |
931 | '%s/expat/xmltok/xmltok.c' % XMLLOC, | |
d56cebe7 | 932 | |
1fded56b RD |
933 | ] + glob.glob('%s/xh_*.cpp' % XMLLOC) + |
934 | ||
935 | [ '%s/xml.cpp' % XMLLOC, | |
936 | '%s/xmlres.cpp' % XMLLOC, | |
937 | '%s/xmlrsall.cpp' % XMLLOC, | |
938 | ] + swig_sources, | |
d56cebe7 RD |
939 | |
940 | include_dirs = xmlres_includes, | |
941 | define_macros = defines, | |
942 | ||
943 | library_dirs = libdirs, | |
944 | libraries = libs, | |
945 | ||
946 | extra_compile_args = cflags, | |
947 | extra_link_args = lflags, | |
948 | ) | |
949 | ||
950 | wxpExtensions.append(ext) | |
951 | ||
952 | ||
953 | ||
ebf4302c RD |
954 | #---------------------------------------------------------------------- |
955 | # Define the GIZMOS extension module | |
956 | #---------------------------------------------------------------------- | |
957 | ||
1e4a197e | 958 | if BUILD_GIZMOS: |
ebf4302c RD |
959 | msg('Preparing GIZMOS...') |
960 | location = 'contrib/gizmos' | |
961 | GIZMOLOC = opj(location, 'contrib/src/gizmos') | |
962 | GIZMOINC = opj(location, 'contrib/include') | |
963 | ||
964 | swig_files = ['gizmos.i'] | |
965 | ||
966 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 967 | USE_SWIG, swig_force, swig_args, swig_deps) |
ebf4302c RD |
968 | |
969 | gizmos_includes = includes[:] | |
970 | gizmos_includes.append(GIZMOINC) | |
971 | ||
972 | ||
973 | # make sure local copy of contrib files are up to date | |
974 | if IN_CVS_TREE: | |
975 | contrib_copy_tree(opj(CTRB_INC, 'gizmos'), opj(GIZMOINC, 'wx/gizmos')) | |
976 | contrib_copy_tree(opj(CTRB_SRC, 'gizmos'), GIZMOLOC) | |
977 | ||
978 | ext = Extension('gizmosc', [ | |
1fded56b RD |
979 | '%s/dynamicsash.cpp' % GIZMOLOC, |
980 | '%s/editlbox.cpp' % GIZMOLOC, | |
981 | '%s/splittree.cpp' % GIZMOLOC, | |
982 | '%s/ledctrl.cpp' % GIZMOLOC, | |
983 | #'%s/multicell.cpp' % GIZMOLOC, | |
984 | ||
985 | '%s/treelistctrl.cpp' % location, | |
986 | ||
ebf4302c RD |
987 | ] + swig_sources, |
988 | ||
989 | include_dirs = gizmos_includes, | |
990 | define_macros = defines, | |
991 | ||
992 | library_dirs = libdirs, | |
993 | libraries = libs, | |
994 | ||
995 | extra_compile_args = cflags, | |
996 | extra_link_args = lflags, | |
997 | ) | |
998 | ||
999 | wxpExtensions.append(ext) | |
1000 | ||
1001 | ||
1002 | ||
4a61305d RD |
1003 | #---------------------------------------------------------------------- |
1004 | # Define the DLLWIDGET extension module | |
1005 | #---------------------------------------------------------------------- | |
1006 | ||
1e4a197e | 1007 | if BUILD_DLLWIDGET: |
4a61305d RD |
1008 | msg('Preparing DLLWIDGET...') |
1009 | location = 'contrib/dllwidget' | |
1010 | swig_files = ['dllwidget_.i'] | |
1011 | ||
1012 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 1013 | USE_SWIG, swig_force, swig_args, swig_deps) |
4a61305d RD |
1014 | |
1015 | # copy a contrib project specific py module to the main package dir | |
1016 | copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0) | |
1017 | ||
1018 | ext = Extension('dllwidget_c', [ | |
1019 | '%s/dllwidget.cpp' % location, | |
1020 | ] + swig_sources, | |
1021 | ||
1022 | include_dirs = includes, | |
1023 | define_macros = defines, | |
1024 | ||
1025 | library_dirs = libdirs, | |
1026 | libraries = libs, | |
1027 | ||
1028 | extra_compile_args = cflags, | |
1029 | extra_link_args = lflags, | |
1030 | ) | |
1031 | ||
1032 | wxpExtensions.append(ext) | |
1033 | ||
1034 | ||
8916d007 | 1035 | #---------------------------------------------------------------------- |
1e4a197e | 1036 | # Define the CANVAS extension module |
8916d007 RD |
1037 | #---------------------------------------------------------------------- |
1038 | ||
1e4a197e RD |
1039 | if BUILD_CANVAS: |
1040 | msg('Preparing CANVAS...') | |
1041 | location = 'contrib/canvas' | |
1042 | CANVASLOC = opj(location, 'contrib/src/canvas') | |
1043 | CANVASINC = opj(location, 'contrib/include') | |
8916d007 | 1044 | |
1e4a197e RD |
1045 | swig_files = ['canvas.i'] |
1046 | ||
1047 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
1048 | USE_SWIG, swig_force, swig_args, swig_deps) | |
1049 | ||
1050 | if IN_CVS_TREE: | |
1051 | # make sure local copy of contrib files are up to date | |
1052 | contrib_copy_tree(opj(CTRB_INC, 'canvas'), opj(CANVASINC, 'wx/canvas')) | |
1053 | contrib_copy_tree(opj(CTRB_SRC, 'canvas'), CANVASLOC) | |
1054 | ||
1055 | ext = Extension('canvasc', ['%s/bbox.cpp' % CANVASLOC, | |
1056 | '%s/liner.cpp' % CANVASLOC, | |
1057 | '%s/polygon.cpp' % CANVASLOC, | |
1058 | '%s/canvas.cpp' % CANVASLOC, | |
1059 | ] + swig_sources, | |
1060 | ||
1061 | include_dirs = [CANVASINC] + includes, | |
1062 | define_macros = defines, | |
1063 | ||
1064 | library_dirs = libdirs, | |
1065 | libraries = libs, | |
1066 | ||
1067 | extra_compile_args = cflags, | |
1068 | extra_link_args = lflags, | |
1069 | ) | |
1070 | ||
1071 | wxpExtensions.append(ext) | |
1072 | ||
1073 | ||
1074 | #---------------------------------------------------------------------- | |
1075 | # Define the ART2D extension module | |
1076 | #---------------------------------------------------------------------- | |
1077 | ||
1078 | if BUILD_ART2D: | |
1079 | msg('Preparing ART2D...') | |
1080 | location = 'contrib/art2d' | |
1081 | ART2DLOC = opj(location, 'modules/canvas/src') | |
1082 | ART2DINC = opj(location, 'modules/canvas/include') | |
1083 | EXPATLOC = opj(location, 'modules/expat') | |
1084 | EXPATINC = opj(location, 'modules/expat/include') | |
1085 | ||
1086 | swig_files = ['art2d.i', | |
1087 | 'art2d_misc.i', | |
1088 | 'art2d_base.i', | |
1089 | 'art2d_canvas.i', | |
1090 | ] | |
1091 | ||
1092 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
1093 | USE_SWIG, swig_force, swig_args, swig_deps) | |
1094 | ||
1095 | if IN_CVS_TREE: | |
1096 | # Don't copy data in this case as the code snapshots are | |
1097 | # taken manually | |
1098 | pass | |
1099 | ||
1100 | ext = Extension('art2dc', [ opj(ART2DLOC, 'afmatrix.cpp'), | |
1101 | opj(ART2DLOC, 'bbox.cpp'), | |
1102 | opj(ART2DLOC, 'cancom.cpp'), | |
1103 | opj(ART2DLOC, 'candoc.cpp'), | |
1104 | opj(ART2DLOC, 'canglob.cpp'), | |
1105 | opj(ART2DLOC, 'canobj3d.cpp'), | |
1106 | opj(ART2DLOC, 'canobj.cpp'), | |
1107 | opj(ART2DLOC, 'canprim.cpp'), | |
1108 | opj(ART2DLOC, 'canprop.cpp'), | |
1109 | opj(ART2DLOC, 'canvas.cpp'), | |
1110 | opj(ART2DLOC, 'docviewref.cpp'), | |
1111 | opj(ART2DLOC, 'drawer.cpp'), | |
1112 | opj(ART2DLOC, 'eval.cpp'), | |
1113 | opj(ART2DLOC, 'graph.cpp'), | |
1114 | opj(ART2DLOC, 'layerinf.cpp'), | |
1115 | opj(ART2DLOC, 'liner.cpp'), | |
1116 | opj(ART2DLOC, 'meta.cpp'), | |
1117 | opj(ART2DLOC, 'objlist.cpp'), | |
1118 | opj(ART2DLOC, 'polygon.cpp'), | |
1119 | opj(ART2DLOC, 'recur.cpp'), | |
1120 | opj(ART2DLOC, 'rendimg.cpp'), | |
1121 | opj(ART2DLOC, 'tools.cpp'), | |
1122 | opj(ART2DLOC, 'vpath.cpp'), | |
1123 | opj(ART2DLOC, 'xmlpars.cpp'), | |
1124 | ||
1125 | opj(EXPATLOC, 'xmlparse/xmlparse.c'), | |
1126 | opj(EXPATLOC, 'xmltok/xmlrole.c'), | |
1127 | opj(EXPATLOC, 'xmltok/xmltok.c'), | |
1128 | ||
1129 | ] + swig_sources, | |
1130 | ||
1131 | include_dirs = [ ART2DINC, | |
1132 | EXPATINC, | |
1133 | opj(EXPATLOC, 'xmltok'), | |
1134 | opj(EXPATLOC, 'xmlparse'), | |
1135 | ] + includes, | |
1136 | define_macros = defines, | |
1137 | ||
1138 | library_dirs = libdirs, | |
1139 | libraries = libs, | |
1140 | ||
1141 | extra_compile_args = cflags, | |
1142 | extra_link_args = lflags, | |
1143 | ) | |
1144 | ||
1145 | wxpExtensions.append(ext) | |
1146 | ||
1147 | ||
1148 | #---------------------------------------------------------------------- | |
1149 | # Tools and scripts | |
1150 | #---------------------------------------------------------------------- | |
8916d007 | 1151 | |
2eb31f8b RD |
1152 | if NO_SCRIPTS: |
1153 | SCRIPTS = None | |
1154 | else: | |
1e4a197e RD |
1155 | SCRIPTS = [opj('scripts/helpviewer'), |
1156 | opj('scripts/img2png'), | |
2eb31f8b RD |
1157 | opj('scripts/img2xpm'), |
1158 | opj('scripts/img2py'), | |
1159 | opj('scripts/xrced'), | |
1160 | opj('scripts/pyshell'), | |
1161 | opj('scripts/pycrust'), | |
1fded56b RD |
1162 | opj('scripts/pywrap'), |
1163 | opj('scripts/pywrap'), | |
1164 | opj('scripts/pyalacarte'), | |
1165 | opj('scripts/pyalamode'), | |
2eb31f8b | 1166 | ] |
4a61305d | 1167 | |
926bb76c | 1168 | |
1fded56b RD |
1169 | DATA_FILES += find_data_files('wxPython/tools/XRCed', '*.txt', '*.xrc') |
1170 | DATA_FILES += find_data_files('wxPython/py', '*.txt', '*.ico', '*.css', '*.html') | |
1171 | DATA_FILES += find_data_files('wx', '*.txt', '*.css', '*.html') | |
1e4a197e RD |
1172 | |
1173 | ||
c368d904 RD |
1174 | #---------------------------------------------------------------------- |
1175 | # Do the Setup/Build/Install/Whatever | |
1176 | #---------------------------------------------------------------------- | |
1177 | ||
1b62f00d | 1178 | if __name__ == "__main__": |
1e4a197e | 1179 | if not PREP_ONLY: |
1b62f00d RD |
1180 | setup(name = PKGDIR, |
1181 | version = VERSION, | |
1182 | description = DESCRIPTION, | |
1183 | long_description = LONG_DESCRIPTION, | |
1184 | author = AUTHOR, | |
1185 | author_email = AUTHOR_EMAIL, | |
1186 | url = URL, | |
e2e02194 | 1187 | license = LICENSE, |
1b62f00d | 1188 | |
1fded56b RD |
1189 | packages = ['wxPython', |
1190 | 'wxPython.lib', | |
1191 | 'wxPython.lib.colourchooser', | |
1192 | 'wxPython.lib.editor', | |
1193 | 'wxPython.lib.mixins', | |
1194 | 'wxPython.lib.PyCrust', | |
1195 | 'wxPython.py', | |
1196 | 'wxPython.py.wxd', | |
1197 | 'wxPython.tools', | |
1198 | 'wxPython.tools.XRCed', | |
1199 | ||
1200 | 'wx', | |
1201 | 'wx.lib', | |
1202 | 'wx.lib.colourchooser', | |
1203 | 'wx.lib.editor', | |
1204 | 'wx.lib.mixins', | |
1205 | 'wx.py', | |
1206 | 'wx.tools', | |
1207 | 'wx.tools.XRCed', | |
1b62f00d RD |
1208 | ], |
1209 | ||
1210 | ext_package = PKGDIR, | |
1211 | ext_modules = wxpExtensions, | |
8916d007 | 1212 | |
f6f98ecc | 1213 | options = { 'build' : { 'build_base' : BUILD_BASE }}, |
a541c325 | 1214 | |
b817523b | 1215 | scripts = SCRIPTS, |
c368d904 | 1216 | |
1e4a197e RD |
1217 | cmdclass = { 'install_data': smart_install_data}, |
1218 | data_files = DATA_FILES, | |
8916d007 | 1219 | |
1b62f00d | 1220 | ) |
c368d904 | 1221 | |
c368d904 | 1222 | |
c368d904 RD |
1223 | #---------------------------------------------------------------------- |
1224 | #---------------------------------------------------------------------- |