]>
Commit | Line | Data |
---|---|---|
c368d904 RD |
1 | #!/usr/bin/env python |
2 | #---------------------------------------------------------------------- | |
3 | ||
d14a1e28 | 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 | |
4326f7b7 | 18 | VER_RELEASE = 1 |
1fded56b | 19 | VER_SUBREL = 0 # wxPython release num for x.y.z release of wxWindows |
f696721e | 20 | VER_FLAGS = "p4" # release flags, such as prerelease num, unicode, etc. |
1fded56b | 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/" |
851d4ac7 RD |
26 | DOWNLOAD_URL = "http://wxPython.org/download.php" |
27 | LICENSE = "wxWindows Library License (LGPL derivative)" | |
28 | PLATFORMS = "WIN32,OSX,POSIX" | |
29 | KEYWORDS = "GUI,wx,wxWindows,cross-platform" | |
30 | ||
c368d904 RD |
31 | LONG_DESCRIPTION = """\ |
32 | wxPython is a GUI toolkit for Python that is a wrapper around the | |
33 | wxWindows C++ GUI library. wxPython provides a large variety of | |
1b62f00d | 34 | window types and controls, all implemented with a native look and |
1e4a197e | 35 | feel (by using the native widgets) on the platforms it is supported |
c368d904 RD |
36 | on. |
37 | """ | |
38 | ||
851d4ac7 RD |
39 | CLASSIFIERS = """\ |
40 | Development Status :: 6 - Mature | |
41 | Environment :: MacOS X :: Carbon | |
42 | Environment :: Win32 (MS Windows) | |
43 | Environment :: X11 Applications :: GTK | |
44 | Intended Audience :: Developers | |
45 | License :: OSI Approved | |
46 | Operating System :: MacOS :: MacOS X | |
47 | Operating System :: Microsoft :: Windows :: Windows 95/98/2000 | |
48 | Operating System :: POSIX | |
49 | Programming Language :: Python | |
50 | Topic :: Software Development :: User Interfaces | |
51 | """ | |
52 | ||
53 | ## License :: OSI Approved :: wxWindows Library Licence | |
54 | ||
c368d904 | 55 | |
1e4a197e RD |
56 | # Config values below this point can be reset on the setup.py command line. |
57 | ||
f221f8eb | 58 | BUILD_GLCANVAS = 1 # If true, build the contrib/glcanvas extension module |
c368d904 RD |
59 | BUILD_OGL = 1 # If true, build the contrib/ogl extension module |
60 | BUILD_STC = 1 # If true, build the contrib/stc extension module | |
d56cebe7 | 61 | BUILD_XRC = 1 # XML based resource system |
ebf4302c | 62 | BUILD_GIZMOS = 1 # Build a module for the gizmos contrib library |
1e4a197e | 63 | BUILD_DLLWIDGET = 0# Build a module that enables unknown wx widgets |
37bd51c0 | 64 | # to be loaded from a DLL and to be used from Python. |
d56cebe7 | 65 | |
c731eb47 | 66 | # Internet Explorer wrapper (experimental) |
d14a1e28 | 67 | BUILD_IEWIN = 0 #(os.name == 'nt') |
78e8819c | 68 | |
1e4a197e | 69 | |
c368d904 | 70 | CORE_ONLY = 0 # if true, don't build any of the above |
4a61305d | 71 | |
1e4a197e | 72 | PREP_ONLY = 0 # Only run the prepatory steps, not the actual build. |
c368d904 RD |
73 | |
74 | USE_SWIG = 0 # Should we actually execute SWIG, or just use the | |
75 | # files already in the distribution? | |
76 | ||
d14a1e28 RD |
77 | SWIG = "swig" # The swig executable to use. |
78 | ||
79 | BUILD_RENAMERS = 1 # Should we build the renamer modules too? | |
80 | ||
a541c325 RD |
81 | UNICODE = 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and |
82 | # will ensure that the right headers are found and the | |
83 | # right libs are linked. | |
c8bc7bb8 | 84 | |
5c8e1089 RD |
85 | UNDEF_NDEBUG = 1 # Python 2.2 on Unix/Linux by default defines NDEBUG, |
86 | # and distutils will pick this up and use it on the | |
87 | # compile command-line for the extensions. This could | |
88 | # conflict with how wxWindows was built. If NDEBUG is | |
89 | # set then wxWindows' __WXDEBUG__ setting will be turned | |
90 | # off. If wxWindows was actually built with it turned | |
91 | # on then you end up with mismatched class structures, | |
92 | # and wxPython will crash. | |
93 | ||
2eb31f8b RD |
94 | NO_SCRIPTS = 0 # Don't install the tool scripts |
95 | ||
1e4a197e RD |
96 | WX_CONFIG = None # Usually you shouldn't need to touch this, but you can set |
97 | # it to pass an alternate version of wx-config or alternate | |
98 | # flags, eg. as required by the .deb in-tree build. By | |
99 | # default a wx-config command will be assembled based on | |
100 | # version, port, etc. and it will be looked for on the | |
101 | # default $PATH. | |
102 | ||
103 | WXPORT = 'gtk' # On Linux/Unix there are several ports of wxWindows available. | |
104 | # Setting this value lets you select which will be used for | |
105 | # the wxPython build. Possibilites are 'gtk', 'gtk2' and | |
106 | # 'x11'. Curently only gtk and gtk2 works. | |
107 | ||
108 | BUILD_BASE = "build" # Directory to use for temporary build files. | |
2eb31f8b | 109 | |
c368d904 | 110 | |
a541c325 | 111 | |
c368d904 RD |
112 | # Some MSW build settings |
113 | ||
d440a0e7 | 114 | FINAL = 0 # Mirrors use of same flag in wx makefiles, |
c368d904 RD |
115 | # (0 or 1 only) should probably find a way to |
116 | # autodetect this... | |
117 | ||
d440a0e7 | 118 | HYBRID = 1 # If set and not debug or FINAL, then build a |
c368d904 RD |
119 | # hybrid extension that can be used by the |
120 | # non-debug version of python, but contains | |
121 | # debugging symbols for wxWindows and wxPython. | |
122 | # wxWindows must have been built with /MD, not /MDd | |
123 | # (using FINAL=hybrid will do it.) | |
124 | ||
3e46a8e6 RD |
125 | # Version part of wxWindows LIB/DLL names |
126 | WXDLLVER = '%d%d' % (VER_MAJOR, VER_MINOR) | |
c368d904 RD |
127 | |
128 | ||
cfe766c3 RD |
129 | #---------------------------------------------------------------------- |
130 | ||
131 | def msg(text): | |
132 | if __name__ == "__main__": | |
133 | print text | |
134 | ||
a541c325 | 135 | |
55c020cf RD |
136 | def opj(*args): |
137 | path = apply(os.path.join, args) | |
138 | return os.path.normpath(path) | |
cfe766c3 | 139 | |
a541c325 | 140 | |
a4fbdd76 RD |
141 | def libFlag(): |
142 | if FINAL: | |
c8bc7bb8 | 143 | rv = '' |
a4fbdd76 | 144 | elif HYBRID: |
c8bc7bb8 | 145 | rv = 'h' |
a4fbdd76 | 146 | else: |
c8bc7bb8 | 147 | rv = 'd' |
a541c325 | 148 | if UNICODE: |
c8bc7bb8 RD |
149 | rv = 'u' + rv |
150 | return rv | |
a4fbdd76 RD |
151 | |
152 | ||
c368d904 RD |
153 | #---------------------------------------------------------------------- |
154 | # Some other globals | |
155 | #---------------------------------------------------------------------- | |
156 | ||
d14a1e28 | 157 | PKGDIR = 'wx' |
c368d904 | 158 | wxpExtensions = [] |
1e4a197e | 159 | DATA_FILES = [] |
c368d904 RD |
160 | |
161 | force = '--force' in sys.argv or '-f' in sys.argv | |
162 | debug = '--debug' in sys.argv or '-g' in sys.argv | |
ce8f00f3 RD |
163 | cleaning = 'clean' in sys.argv |
164 | ||
c368d904 | 165 | |
1e4a197e RD |
166 | # change the PORT default for wxMac |
167 | if sys.platform[:6] == "darwin": | |
168 | WXPORT = 'mac' | |
22d08289 | 169 | |
1e4a197e RD |
170 | # and do the same for wxMSW, just for consistency |
171 | if os.name == 'nt': | |
172 | WXPORT = 'msw' | |
22d08289 | 173 | |
c368d904 RD |
174 | |
175 | #---------------------------------------------------------------------- | |
176 | # Check for build flags on the command line | |
177 | #---------------------------------------------------------------------- | |
178 | ||
5c8e1089 | 179 | # Boolean (int) flags |
b166c703 | 180 | for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC', |
c731eb47 | 181 | 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN', |
d14a1e28 RD |
182 | 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'UNICODE', |
183 | 'UNDEF_NDEBUG', 'NO_SCRIPTS', 'BUILD_RENAMERS', | |
b166c703 | 184 | 'FINAL', 'HYBRID', ]: |
c368d904 | 185 | for x in range(len(sys.argv)): |
1e4a197e RD |
186 | if sys.argv[x].find(flag) == 0: |
187 | pos = sys.argv[x].find('=') + 1 | |
c368d904 RD |
188 | if pos > 0: |
189 | vars()[flag] = eval(sys.argv[x][pos:]) | |
190 | sys.argv[x] = '' | |
191 | ||
5c8e1089 | 192 | # String options |
d14a1e28 | 193 | for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT', 'SWIG']: |
afa3e1ed | 194 | for x in range(len(sys.argv)): |
1e4a197e RD |
195 | if sys.argv[x].find(option) == 0: |
196 | pos = sys.argv[x].find('=') + 1 | |
afa3e1ed RL |
197 | if pos > 0: |
198 | vars()[option] = sys.argv[x][pos:] | |
199 | sys.argv[x] = '' | |
200 | ||
c368d904 RD |
201 | sys.argv = filter(None, sys.argv) |
202 | ||
203 | ||
1e4a197e RD |
204 | #---------------------------------------------------------------------- |
205 | # some helper functions | |
206 | #---------------------------------------------------------------------- | |
207 | ||
208 | def Verify_WX_CONFIG(): | |
209 | """ Called below for the builds that need wx-config, | |
210 | if WX_CONFIG is not set then tries to select the specific | |
211 | wx*-config script based on build options. If not found | |
212 | then it defaults to 'wx-config'. | |
213 | """ | |
214 | # if WX_CONFIG hasn't been set to an explicit value then construct one. | |
215 | global WX_CONFIG | |
216 | if WX_CONFIG is None: | |
217 | if debug: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWindows... | |
218 | df = 'd' | |
219 | else: | |
220 | df = '' | |
221 | if UNICODE: | |
222 | uf = 'u' | |
223 | else: | |
224 | uf = '' | |
1fded56b | 225 | ver2 = "%s.%s" % (VER_MAJOR, VER_MINOR) |
1e4a197e RD |
226 | WX_CONFIG = 'wx%s%s%s-%s-config' % (WXPORT, uf, df, ver2) |
227 | ||
228 | searchpath = os.environ["PATH"] | |
229 | for p in searchpath.split(':'): | |
230 | fp = os.path.join(p, WX_CONFIG) | |
231 | if os.path.exists(fp) and os.access(fp, os.X_OK): | |
232 | # success | |
233 | msg("Found wx-config: " + fp) | |
234 | WX_CONFIG = fp | |
235 | break | |
236 | else: | |
237 | msg("WX_CONFIG not specified and %s not found on $PATH " | |
238 | "defaulting to \"wx-config\"" % WX_CONFIG) | |
239 | WX_CONFIG = 'wx-config' | |
240 | ||
241 | ||
242 | ||
243 | def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=[]): | |
244 | """Run SWIG the way I want it done""" | |
d14a1e28 | 245 | |
1e4a197e RD |
246 | if not os.path.exists(os.path.join(dir, gendir)): |
247 | os.mkdir(os.path.join(dir, gendir)) | |
248 | ||
8994c3c2 RD |
249 | if not os.path.exists(os.path.join("docs", "xml-raw")): |
250 | os.mkdir(os.path.join("docs", "xml-raw")) | |
251 | ||
1e4a197e RD |
252 | sources = [] |
253 | ||
254 | for file in files: | |
255 | basefile = os.path.splitext(file)[0] | |
256 | i_file = os.path.join(dir, file) | |
257 | py_file = os.path.join(dir, gendir, basefile+'.py') | |
d14a1e28 | 258 | cpp_file = os.path.join(dir, gendir, basefile+'_wrap.cpp') |
8994c3c2 | 259 | xml_file = os.path.join("docs", "xml-raw", basefile+'_swig.xml') |
1e4a197e RD |
260 | |
261 | sources.append(cpp_file) | |
262 | ||
ce8f00f3 | 263 | if not cleaning and USE_SWIG: |
1e4a197e RD |
264 | for dep in swig_deps: |
265 | if newer(dep, py_file) or newer(dep, cpp_file): | |
266 | force = 1 | |
267 | break | |
268 | ||
269 | if force or newer(i_file, py_file) or newer(i_file, cpp_file): | |
d14a1e28 RD |
270 | ## we need forward slashes here even on win32 |
271 | #cpp_file = opj(cpp_file) #'/'.join(cpp_file.split('\\')) | |
272 | #i_file = opj(i_file) #'/'.join(i_file.split('\\')) | |
273 | ||
274 | if BUILD_RENAMERS: | |
8994c3c2 RD |
275 | #info_file = "./distrib/swig_info" |
276 | #info_dict = { 'cmd' : swig_cmd, | |
277 | # 'args' : swig_args + ['-I'+dir] | |
278 | # } | |
279 | #open(info_file, "w").write(str(args_dict)) | |
280 | ||
281 | # First run swig to produce the XML file, adding | |
282 | # an extra -D that prevents the old rename | |
283 | # directives from being used | |
284 | cmd = [ swig_cmd ] + swig_args + \ | |
285 | [ '-DBUILDING_RENAMERS', '-xmlout', xml_file ] + \ | |
286 | ['-I'+dir, '-o', cpp_file, i_file] | |
287 | msg(' '.join(cmd)) | |
288 | spawn(cmd) | |
289 | ||
290 | # Next run build_renamers to process the XML | |
d14a1e28 | 291 | cmd = [ sys.executable, '-u', |
8994c3c2 | 292 | './distrib/build_renamers.py', dir, basefile, xml_file] |
d14a1e28 RD |
293 | msg(' '.join(cmd)) |
294 | spawn(cmd) | |
8994c3c2 | 295 | #os.remove(info_file) |
d14a1e28 RD |
296 | |
297 | # Then run swig for real | |
298 | cmd = [ swig_cmd ] + swig_args + ['-I'+dir, '-o', cpp_file, i_file] | |
1e4a197e RD |
299 | msg(' '.join(cmd)) |
300 | spawn(cmd) | |
301 | ||
d14a1e28 | 302 | |
1e4a197e RD |
303 | # copy the generated python file to the package directory |
304 | copy_file(py_file, package, update=not force, verbose=0) | |
305 | ||
306 | return sources | |
307 | ||
308 | ||
309 | ||
310 | def contrib_copy_tree(src, dest, verbose=0): | |
311 | """Update local copies of wxWindows contrib files""" | |
312 | from distutils.dir_util import mkpath, copy_tree | |
313 | ||
314 | mkpath(dest, verbose=verbose) | |
315 | copy_tree(src, dest, update=1, verbose=verbose) | |
316 | ||
317 | ||
318 | ||
319 | class smart_install_data(install_data): | |
320 | def run(self): | |
321 | #need to change self.install_dir to the actual library dir | |
322 | install_cmd = self.get_finalized_command('install') | |
323 | self.install_dir = getattr(install_cmd, 'install_lib') | |
324 | return install_data.run(self) | |
325 | ||
326 | ||
327 | def build_locale_dir(destdir, verbose=1): | |
328 | """Build a locale dir under the wxPython package for MSW""" | |
329 | moFiles = glob.glob(opj(WXDIR, 'locale', '*.mo')) | |
330 | for src in moFiles: | |
331 | lang = os.path.splitext(os.path.basename(src))[0] | |
332 | dest = opj(destdir, lang, 'LC_MESSAGES') | |
333 | mkpath(dest, verbose=verbose) | |
334 | copy_file(src, opj(dest, 'wxstd.mo'), update=1, verbose=verbose) | |
335 | ||
336 | ||
337 | def build_locale_list(srcdir): | |
338 | # get a list of all files under the srcdir, to be used for install_data | |
339 | def walk_helper(lst, dirname, files): | |
340 | for f in files: | |
341 | filename = opj(dirname, f) | |
342 | if not os.path.isdir(filename): | |
343 | lst.append( (dirname, [filename]) ) | |
344 | file_list = [] | |
345 | os.path.walk(srcdir, walk_helper, file_list) | |
346 | return file_list | |
347 | ||
348 | ||
1fded56b RD |
349 | def find_data_files(srcdir, *wildcards): |
350 | # get a list of all files under the srcdir matching wildcards, | |
351 | # returned in a format to be used for install_data | |
352 | ||
353 | def walk_helper(arg, dirname, files): | |
354 | names = [] | |
355 | lst, wildcards = arg | |
356 | for wc in wildcards: | |
357 | for f in files: | |
358 | filename = opj(dirname, f) | |
359 | if fnmatch.fnmatch(filename, wc) and not os.path.isdir(filename): | |
360 | names.append(filename) | |
361 | if names: | |
362 | lst.append( (dirname, names ) ) | |
363 | ||
364 | file_list = [] | |
365 | os.path.walk(srcdir, walk_helper, (file_list, wildcards)) | |
366 | return file_list | |
1e4a197e RD |
367 | |
368 | ||
3ef86e32 RD |
369 | def makeLibName(name): |
370 | if os.name == 'posix': | |
371 | libname = '%s_%s-%s' % (WXBASENAME, name, WXRELEASE) | |
372 | else: | |
3e46a8e6 | 373 | libname = 'wxmsw%s%s_%s' % (WXDLLVER, libFlag(), name) |
3ef86e32 RD |
374 | |
375 | return [libname] | |
376 | ||
377 | ||
378 | ||
379 | def adjustCFLAGS(cflags, defines, includes): | |
d14a1e28 | 380 | '''Extrace the raw -I, -D, and -U flags and put them into |
3ef86e32 RD |
381 | defines and includes as needed.''' |
382 | newCFLAGS = [] | |
383 | for flag in cflags: | |
384 | if flag[:2] == '-I': | |
385 | includes.append(flag[2:]) | |
386 | elif flag[:2] == '-D': | |
387 | flag = flag[2:] | |
388 | if flag.find('=') == -1: | |
389 | defines.append( (flag, None) ) | |
390 | else: | |
391 | defines.append( tuple(flag.split('=')) ) | |
392 | elif flag[:2] == '-U': | |
393 | defines.append( (flag[2:], ) ) | |
394 | else: | |
395 | newCFLAGS.append(flag) | |
396 | return newCFLAGS | |
397 | ||
398 | ||
399 | ||
400 | def adjustLFLAGS(lfags, libdirs, libs): | |
d14a1e28 | 401 | '''Extrace the -L and -l flags and put them in libdirs and libs as needed''' |
3ef86e32 RD |
402 | newLFLAGS = [] |
403 | for flag in lflags: | |
404 | if flag[:2] == '-L': | |
405 | libdirs.append(flag[2:]) | |
406 | elif flag[:2] == '-l': | |
407 | libs.append(flag[2:]) | |
408 | else: | |
409 | newLFLAGS.append(flag) | |
410 | ||
411 | return newLFLAGS | |
c8bc7bb8 RD |
412 | |
413 | #---------------------------------------------------------------------- | |
414 | # sanity checks | |
415 | ||
c368d904 | 416 | if CORE_ONLY: |
f221f8eb | 417 | BUILD_GLCANVAS = 0 |
c368d904 RD |
418 | BUILD_OGL = 0 |
419 | BUILD_STC = 0 | |
b166c703 | 420 | BUILD_XRC = 0 |
ff5f1aba RD |
421 | BUILD_GIZMOS = 0 |
422 | BUILD_DLLWIDGET = 0 | |
c731eb47 | 423 | BUILD_IEWIN = 0 |
ff5f1aba | 424 | |
1e4a197e RD |
425 | if debug: |
426 | FINAL = 0 | |
427 | HYBRID = 0 | |
c368d904 | 428 | |
1e4a197e RD |
429 | if FINAL: |
430 | HYBRID = 0 | |
c8bc7bb8 | 431 | |
1e4a197e RD |
432 | if UNICODE and WXPORT not in ['msw', 'gtk2']: |
433 | raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT | |
a541c325 RD |
434 | |
435 | ||
c368d904 RD |
436 | #---------------------------------------------------------------------- |
437 | # Setup some platform specific stuff | |
438 | #---------------------------------------------------------------------- | |
439 | ||
440 | if os.name == 'nt': | |
441 | # Set compile flags and such for MSVC. These values are derived | |
a541c325 RD |
442 | # from the wxWindows makefiles for MSVC, other compilers settings |
443 | # will probably vary... | |
444 | if os.environ.has_key('WXWIN'): | |
445 | WXDIR = os.environ['WXWIN'] | |
446 | else: | |
447 | msg("WARNING: WXWIN not set in environment.") | |
448 | WXDIR = '..' # assumes in CVS tree | |
c368d904 RD |
449 | WXPLAT = '__WXMSW__' |
450 | GENDIR = 'msw' | |
451 | ||
d14a1e28 RD |
452 | includes = ['include', 'src', |
453 | opj(WXDIR, 'lib', 'vc_dll', 'msw' + libFlag()), | |
55c020cf | 454 | opj(WXDIR, 'include'), |
5a2a9da2 | 455 | opj(WXDIR, 'contrib', 'include'), |
c368d904 RD |
456 | ] |
457 | ||
1e4a197e | 458 | defines = [ ('WIN32', None), |
c368d904 | 459 | ('_WINDOWS', None), |
c368d904 RD |
460 | |
461 | (WXPLAT, None), | |
462 | ('WXUSINGDLL', '1'), | |
463 | ||
464 | ('SWIG_GLOBAL', None), | |
c368d904 RD |
465 | ('WXP_USE_THREAD', '1'), |
466 | ] | |
467 | ||
1e4a197e RD |
468 | if UNDEF_NDEBUG: |
469 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
22d08289 RD |
470 | |
471 | ||
c368d904 RD |
472 | if not FINAL or HYBRID: |
473 | defines.append( ('__WXDEBUG__', None) ) | |
474 | ||
1e521887 | 475 | libdirs = [ opj(WXDIR, 'lib', 'vc_dll') ] |
0a67b751 RD |
476 | libs = [ 'wxbase' + WXDLLVER + libFlag(), # TODO: trim this down to what is really needed for the core |
477 | 'wxbase' + WXDLLVER + libFlag() + '_net', | |
478 | 'wxbase' + WXDLLVER + libFlag() + '_xml', | |
479 | makeLibName('core')[0], | |
480 | makeLibName('adv')[0], | |
481 | makeLibName('html')[0], | |
482 | ] | |
a4fbdd76 | 483 | |
22d08289 | 484 | libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32', |
c368d904 | 485 | 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32', |
1e4a197e | 486 | 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4', |
c368d904 RD |
487 | 'advapi32', 'wsock32'] |
488 | ||
22d08289 | 489 | |
d440a0e7 | 490 | cflags = [ '/Gy', |
ad07d019 RD |
491 | # '/GX-' # workaround for internal compiler error in MSVC on some machines |
492 | ] | |
c368d904 RD |
493 | lflags = None |
494 | ||
1e4a197e | 495 | # Other MSVC flags... |
1fded56b | 496 | # Too bad I don't remember why I was playing with these, can they be removed? |
1e4a197e RD |
497 | if FINAL: |
498 | pass #cflags = cflags + ['/O1'] | |
499 | elif HYBRID : | |
500 | pass #cflags = cflags + ['/Ox'] | |
501 | else: | |
502 | pass # cflags = cflags + ['/Od', '/Z7'] | |
503 | # lflags = ['/DEBUG', ] | |
22d08289 RD |
504 | |
505 | ||
22d08289 | 506 | |
1e4a197e | 507 | #---------------------------------------------------------------------- |
c368d904 | 508 | |
3ef86e32 | 509 | elif os.name == 'posix': |
d14a1e28 RD |
510 | WXDIR = '..' |
511 | includes = ['include', 'src'] | |
e6056257 RD |
512 | defines = [('SWIG_GLOBAL', None), |
513 | ('HAVE_CONFIG_H', None), | |
514 | ('WXP_USE_THREAD', '1'), | |
515 | ] | |
1e4a197e RD |
516 | if UNDEF_NDEBUG: |
517 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
1e4a197e RD |
518 | |
519 | Verify_WX_CONFIG() | |
e6056257 | 520 | |
3ef86e32 RD |
521 | libdirs = [] |
522 | libs = [] | |
523 | ||
e6056257 | 524 | cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] |
1e4a197e | 525 | cflags = cflags.split() |
ba201fa4 RD |
526 | if debug: |
527 | cflags.append('-g') | |
528 | cflags.append('-O0') | |
8b9a4190 RD |
529 | else: |
530 | cflags.append('-O3') | |
e6056257 RD |
531 | |
532 | lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] | |
1e4a197e | 533 | lflags = lflags.split() |
e6056257 | 534 | |
3ef86e32 RD |
535 | WXBASENAME = os.popen(WX_CONFIG + ' --basename').read()[:-1] |
536 | WXRELEASE = os.popen(WX_CONFIG + ' --release').read()[:-1] | |
537 | WXPREFIX = os.popen(WX_CONFIG + ' --prefix').read()[:-1] | |
e6056257 RD |
538 | |
539 | ||
3ef86e32 RD |
540 | if sys.platform[:6] == "darwin": |
541 | # Flags and such for a Darwin (Max OS X) build of Python | |
542 | WXPLAT = '__WXMAC__' | |
543 | GENDIR = 'mac' | |
544 | libs = ['stdc++'] | |
545 | NO_SCRIPTS = 1 | |
c368d904 | 546 | |
1e4a197e | 547 | |
3ef86e32 RD |
548 | else: |
549 | # Set flags for other Unix type platforms | |
550 | GENDIR = WXPORT | |
551 | ||
552 | if WXPORT == 'gtk': | |
553 | WXPLAT = '__WXGTK__' | |
554 | portcfg = os.popen('gtk-config --cflags', 'r').read()[:-1] | |
555 | elif WXPORT == 'gtk2': | |
556 | WXPLAT = '__WXGTK__' | |
557 | GENDIR = 'gtk' # no code differences so use the same generated sources | |
558 | portcfg = os.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1] | |
559 | BUILD_BASE = BUILD_BASE + '-' + WXPORT | |
560 | elif WXPORT == 'x11': | |
561 | WXPLAT = '__WXX11__' | |
562 | portcfg = '' | |
563 | BUILD_BASE = BUILD_BASE + '-' + WXPORT | |
564 | else: | |
565 | raise SystemExit, "Unknown WXPORT value: " + WXPORT | |
1e4a197e | 566 | |
3ef86e32 | 567 | cflags += portcfg.split() |
1e4a197e | 568 | |
d14a1e28 RD |
569 | # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but |
570 | # wx-config doesn't output that for some reason. For now, just | |
571 | # add it unconditionally but we should really check if the lib is | |
572 | # really found there or wx-config should be fixed. | |
573 | libdirs.append("/usr/X11R6/lib") | |
c368d904 | 574 | |
1e4a197e | 575 | |
3ef86e32 RD |
576 | # Move the various -I, -D, etc. flags we got from the *config scripts |
577 | # into the distutils lists. | |
578 | cflags = adjustCFLAGS(cflags, defines, includes) | |
579 | lflags = adjustLFLAGS(lflags, libdirs, libs) | |
c368d904 RD |
580 | |
581 | ||
1e4a197e | 582 | #---------------------------------------------------------------------- |
c368d904 | 583 | else: |
1e4a197e RD |
584 | raise 'Sorry Charlie, platform not supported...' |
585 | ||
586 | ||
587 | #---------------------------------------------------------------------- | |
1fded56b | 588 | # post platform setup checks and tweaks, create the full version string |
1e4a197e RD |
589 | #---------------------------------------------------------------------- |
590 | ||
591 | if UNICODE: | |
592 | BUILD_BASE = BUILD_BASE + '.unicode' | |
1fded56b | 593 | VER_FLAGS += 'u' |
c368d904 RD |
594 | |
595 | ||
1fded56b RD |
596 | VERSION = "%s.%s.%s.%s%s" % (VER_MAJOR, VER_MINOR, VER_RELEASE, |
597 | VER_SUBREL, VER_FLAGS) | |
598 | ||
c368d904 | 599 | #---------------------------------------------------------------------- |
1fded56b | 600 | # Update the version file |
c368d904 RD |
601 | #---------------------------------------------------------------------- |
602 | ||
1fded56b RD |
603 | # Unconditionally updated since the version string can change based |
604 | # on the UNICODE flag | |
605 | open('src/__version__.py', 'w').write("""\ | |
606 | # This file was generated by setup.py... | |
607 | ||
d14a1e28 RD |
608 | VERSION_STRING = '%(VERSION)s' |
609 | MAJOR_VERSION = %(VER_MAJOR)s | |
610 | MINOR_VERSION = %(VER_MINOR)s | |
611 | RELEASE_VERSION = %(VER_RELEASE)s | |
612 | SUBREL_VERSION = %(VER_SUBREL)s | |
1fded56b | 613 | |
d14a1e28 RD |
614 | VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION, |
615 | SUBREL_VERSION, '%(VER_FLAGS)s') | |
1fded56b | 616 | |
d14a1e28 | 617 | RELEASE_NUMBER = RELEASE_VERSION # for compatibility |
1fded56b | 618 | """ % globals()) |
1e4a197e | 619 | |
c368d904 | 620 | |
1b62f00d RD |
621 | |
622 | ||
c368d904 | 623 | #---------------------------------------------------------------------- |
1b62f00d | 624 | # SWIG defaults |
c368d904 RD |
625 | #---------------------------------------------------------------------- |
626 | ||
d14a1e28 | 627 | swig_cmd = SWIG |
c368d904 | 628 | swig_force = force |
d14a1e28 RD |
629 | swig_args = ['-c++', |
630 | '-Wall', | |
631 | '-nodefault', | |
632 | ||
633 | ## '-xml', | |
634 | ||
635 | '-python', | |
636 | '-keyword', | |
637 | '-new_repr', | |
638 | '-modern', | |
639 | ||
640 | '-I./src', | |
641 | '-D'+WXPLAT, | |
98fb9b71 | 642 | '-noruntime' |
e6056257 | 643 | ] |
a541c325 | 644 | if UNICODE: |
c8bc7bb8 RD |
645 | swig_args.append('-DwxUSE_UNICODE') |
646 | ||
d14a1e28 RD |
647 | swig_deps = [ 'src/my_typemaps.i', |
648 | 'src/common.swg', | |
649 | 'src/pyrun.swg', | |
650 | ] | |
651 | ||
652 | depends = [ #'include/wx/wxPython/wxPython.h', | |
653 | #'include/wx/wxPython/wxPython_int.h', | |
654 | #'src/pyclasses.h', | |
655 | ] | |
c368d904 | 656 | |
c368d904 | 657 | |
1b62f00d RD |
658 | #---------------------------------------------------------------------- |
659 | # Define the CORE extension module | |
660 | #---------------------------------------------------------------------- | |
661 | ||
1e4a197e | 662 | msg('Preparing CORE...') |
d14a1e28 RD |
663 | swig_sources = run_swig(['core.i'], 'src', GENDIR, PKGDIR, |
664 | USE_SWIG, swig_force, swig_args, swig_deps + | |
1e0c8722 RD |
665 | [ 'src/_accel.i', |
666 | 'src/_app.i', | |
d14a1e28 RD |
667 | 'src/_app_ex.py', |
668 | 'src/_constraints.i', | |
669 | 'src/_core_api.i', | |
670 | 'src/_core_ex.py', | |
671 | 'src/_core_rename.i', | |
672 | 'src/_core_reverse.txt', | |
673 | 'src/_defs.i', | |
674 | 'src/_event.i', | |
675 | 'src/_event_ex.py', | |
676 | 'src/_evthandler.i', | |
677 | 'src/_filesys.i', | |
678 | 'src/_gdicmn.i', | |
679 | 'src/_image.i', | |
680 | 'src/_menu.i', | |
681 | 'src/_obj.i', | |
682 | 'src/_sizers.i', | |
683 | 'src/_gbsizer.i', | |
684 | 'src/_streams.i', | |
685 | 'src/_validator.i', | |
686 | 'src/_window.i', | |
687 | ]) | |
1b62f00d | 688 | |
1e4a197e RD |
689 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) |
690 | copy_file('src/__version__.py', PKGDIR, update=1, verbose=0) | |
1b62f00d RD |
691 | |
692 | ||
d14a1e28 RD |
693 | # update the license files |
694 | mkpath('licence') | |
695 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
696 | copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0) | |
c368d904 | 697 | |
c368d904 | 698 | |
1e4a197e RD |
699 | if os.name == 'nt': |
700 | build_locale_dir(opj(PKGDIR, 'locale')) | |
701 | DATA_FILES += build_locale_list(opj(PKGDIR, 'locale')) | |
4f3449b4 RD |
702 | |
703 | ||
1e4a197e RD |
704 | if os.name == 'nt': |
705 | rc_file = ['src/wxc.rc'] | |
706 | else: | |
707 | rc_file = [] | |
708 | ||
709 | ||
d14a1e28 RD |
710 | ext = Extension('_core', ['src/helpers.cpp', |
711 | 'src/libpy.c', | |
1e4a197e RD |
712 | ] + rc_file + swig_sources, |
713 | ||
714 | include_dirs = includes, | |
715 | define_macros = defines, | |
716 | ||
717 | library_dirs = libdirs, | |
718 | libraries = libs, | |
719 | ||
720 | extra_compile_args = cflags, | |
721 | extra_link_args = lflags, | |
d14a1e28 RD |
722 | |
723 | depends = depends | |
1e4a197e RD |
724 | ) |
725 | wxpExtensions.append(ext) | |
726 | ||
727 | ||
d14a1e28 RD |
728 | |
729 | ||
730 | ||
731 | # Extension for the GDI module | |
732 | swig_sources = run_swig(['gdi.i'], 'src', GENDIR, PKGDIR, | |
733 | USE_SWIG, swig_force, swig_args, swig_deps + | |
734 | ['src/_gdi_rename.i', | |
735 | 'src/_bitmap.i', 'src/_brush.i', | |
736 | 'src/_colour.i', 'src/_cursor.i', | |
737 | 'src/_dc.i', 'src/_font.i', | |
738 | 'src/_gdiobj.i', 'src/_icon.i', | |
739 | 'src/_imaglist.i', 'src/_pen.i', | |
740 | 'src/_region.i', 'src/_palette.i', | |
dd9f7fea | 741 | 'src/_stockobjs.i', |
d14a1e28 RD |
742 | 'src/_effects.i', |
743 | 'src/_intl.i', | |
744 | 'src/_intl_ex.py', | |
745 | ]) | |
746 | ext = Extension('_gdi', ['src/drawlist.cpp'] + swig_sources, | |
1e4a197e RD |
747 | include_dirs = includes, |
748 | define_macros = defines, | |
749 | library_dirs = libdirs, | |
750 | libraries = libs, | |
751 | extra_compile_args = cflags, | |
752 | extra_link_args = lflags, | |
d14a1e28 | 753 | depends = depends |
1e4a197e RD |
754 | ) |
755 | wxpExtensions.append(ext) | |
756 | ||
757 | ||
d14a1e28 RD |
758 | |
759 | ||
760 | ||
761 | ||
762 | # Extension for the windows module | |
763 | swig_sources = run_swig(['windows.i'], 'src', GENDIR, PKGDIR, | |
764 | USE_SWIG, swig_force, swig_args, swig_deps + | |
765 | ['src/_windows_rename.i', 'src/_windows_reverse.txt', | |
766 | 'src/_panel.i', | |
d14a1e28 RD |
767 | 'src/_toplvl.i', 'src/_statusbar.i', |
768 | 'src/_splitter.i', 'src/_sashwin.i', | |
769 | 'src/_popupwin.i', 'src/_tipwin.i', | |
770 | 'src/_vscroll.i', 'src/_taskbar.i', | |
771 | 'src/_cmndlgs.i', 'src/_mdi.i', | |
772 | 'src/_pywindows.i', 'src/_printfw.i', | |
773 | ]) | |
774 | ext = Extension('_windows', swig_sources, | |
1e4a197e RD |
775 | include_dirs = includes, |
776 | define_macros = defines, | |
777 | library_dirs = libdirs, | |
778 | libraries = libs, | |
779 | extra_compile_args = cflags, | |
780 | extra_link_args = lflags, | |
d14a1e28 | 781 | depends = depends |
1e4a197e RD |
782 | ) |
783 | wxpExtensions.append(ext) | |
784 | ||
785 | ||
d14a1e28 RD |
786 | |
787 | ||
788 | # Extension for the controls module | |
789 | swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR, | |
790 | USE_SWIG, swig_force, swig_args, swig_deps + | |
791 | [ 'src/_controls_rename.i', 'src/_controls_reverse.txt', | |
792 | 'src/_control.i', 'src/_toolbar.i', | |
793 | 'src/_button.i', 'src/_checkbox.i', | |
794 | 'src/_choice.i', 'src/_combobox.i', | |
795 | 'src/_gauge.i', 'src/_statctrls.i', | |
796 | 'src/_listbox.i', 'src/_textctrl.i', | |
797 | 'src/_scrolbar.i', 'src/_spin.i', | |
798 | 'src/_radio.i', 'src/_slider.i', | |
799 | 'src/_tglbtn.i', 'src/_notebook.i', | |
800 | 'src/_listctrl.i', 'src/_treectrl.i', | |
801 | 'src/_dirctrl.i', 'src/_pycontrol.i', | |
dd9f7fea | 802 | 'src/_cshelp.i', 'src/_dragimg.i', |
d14a1e28 RD |
803 | ]) |
804 | ext = Extension('_controls', swig_sources, | |
805 | include_dirs = includes, | |
806 | define_macros = defines, | |
807 | library_dirs = libdirs, | |
808 | libraries = libs, | |
809 | extra_compile_args = cflags, | |
810 | extra_link_args = lflags, | |
811 | depends = depends | |
812 | ) | |
813 | wxpExtensions.append(ext) | |
814 | ||
815 | ||
816 | ||
817 | ||
818 | # Extension for the misc module | |
819 | swig_sources = run_swig(['misc.i'], 'src', GENDIR, PKGDIR, | |
820 | USE_SWIG, swig_force, swig_args, swig_deps + | |
821 | [ 'src/_settings.i', 'src/_functions.i', | |
822 | 'src/_misc.i', 'src/_tipdlg.i', | |
823 | 'src/_timer.i', 'src/_log.i', | |
824 | 'src/_process.i', 'src/_joystick.i', | |
825 | 'src/_wave.i', 'src/_mimetype.i', | |
826 | 'src/_artprov.i', 'src/_config.i', | |
827 | 'src/_datetime.i', 'src/_dataobj.i', | |
828 | 'src/_dnd.i', | |
829 | 'src/_clipbrd.i', | |
830 | ]) | |
831 | ext = Extension('_misc', swig_sources, | |
832 | include_dirs = includes, | |
833 | define_macros = defines, | |
834 | library_dirs = libdirs, | |
835 | libraries = libs, | |
836 | extra_compile_args = cflags, | |
837 | extra_link_args = lflags, | |
838 | depends = depends | |
839 | ) | |
840 | wxpExtensions.append(ext) | |
841 | ||
842 | ||
843 | ||
844 | ## | |
845 | ## Core modules that are not in the "core" namespace start here | |
846 | ## | |
847 | ||
1e4a197e RD |
848 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, |
849 | USE_SWIG, swig_force, swig_args, swig_deps) | |
d14a1e28 RD |
850 | ext = Extension('_calendar', swig_sources, |
851 | include_dirs = includes, | |
852 | define_macros = defines, | |
853 | library_dirs = libdirs, | |
854 | libraries = libs, | |
855 | extra_compile_args = cflags, | |
856 | extra_link_args = lflags, | |
857 | depends = depends | |
858 | ) | |
859 | wxpExtensions.append(ext) | |
860 | ||
861 | ||
862 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
863 | USE_SWIG, swig_force, swig_args, swig_deps) | |
864 | ext = Extension('_grid', swig_sources, | |
1e4a197e RD |
865 | include_dirs = includes, |
866 | define_macros = defines, | |
867 | library_dirs = libdirs, | |
868 | libraries = libs, | |
869 | extra_compile_args = cflags, | |
870 | extra_link_args = lflags, | |
d14a1e28 | 871 | depends = depends |
1e4a197e RD |
872 | ) |
873 | wxpExtensions.append(ext) | |
874 | ||
875 | ||
d14a1e28 RD |
876 | |
877 | swig_sources = run_swig(['html.i'], 'src', GENDIR, PKGDIR, | |
1e4a197e | 878 | USE_SWIG, swig_force, swig_args, swig_deps) |
d14a1e28 | 879 | ext = Extension('_html', swig_sources, |
1e4a197e RD |
880 | include_dirs = includes, |
881 | define_macros = defines, | |
882 | library_dirs = libdirs, | |
883 | libraries = libs, | |
884 | extra_compile_args = cflags, | |
885 | extra_link_args = lflags, | |
d14a1e28 | 886 | depends = depends |
1e4a197e RD |
887 | ) |
888 | wxpExtensions.append(ext) | |
889 | ||
890 | ||
d14a1e28 | 891 | |
1e4a197e RD |
892 | swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR, |
893 | USE_SWIG, swig_force, swig_args, swig_deps) | |
d14a1e28 | 894 | ext = Extension('_wizard', swig_sources, |
1e4a197e RD |
895 | include_dirs = includes, |
896 | define_macros = defines, | |
897 | library_dirs = libdirs, | |
898 | libraries = libs, | |
899 | extra_compile_args = cflags, | |
900 | extra_link_args = lflags, | |
d14a1e28 | 901 | depends = depends |
1e4a197e RD |
902 | ) |
903 | wxpExtensions.append(ext) | |
af83019e RD |
904 | |
905 | ||
d14a1e28 RD |
906 | |
907 | ||
908 | ||
c368d904 RD |
909 | #---------------------------------------------------------------------- |
910 | # Define the GLCanvas extension module | |
911 | #---------------------------------------------------------------------- | |
912 | ||
1e4a197e | 913 | if BUILD_GLCANVAS: |
cfe766c3 | 914 | msg('Preparing GLCANVAS...') |
c368d904 | 915 | location = 'contrib/glcanvas' |
c368d904 | 916 | |
d14a1e28 | 917 | swig_sources = run_swig(['glcanvas.i'], location, GENDIR, PKGDIR, |
10ef30eb | 918 | USE_SWIG, swig_force, swig_args, swig_deps) |
c368d904 RD |
919 | |
920 | gl_libs = [] | |
921 | if os.name == 'posix': | |
f32afe1c | 922 | gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] |
1e4a197e | 923 | gl_lflags = gl_config.split() + lflags |
f32afe1c | 924 | gl_libs = libs |
19cf4f80 | 925 | else: |
3e46a8e6 | 926 | gl_libs = libs + ['opengl32', 'glu32'] + makeLibName('gl') |
f32afe1c | 927 | gl_lflags = lflags |
c368d904 | 928 | |
d14a1e28 | 929 | ext = Extension('_glcanvas', |
3e46a8e6 | 930 | swig_sources, |
1e7ecb7b RD |
931 | |
932 | include_dirs = includes, | |
933 | define_macros = defines, | |
934 | ||
935 | library_dirs = libdirs, | |
f32afe1c | 936 | libraries = gl_libs, |
1e7ecb7b RD |
937 | |
938 | extra_compile_args = cflags, | |
f32afe1c | 939 | extra_link_args = gl_lflags, |
1e7ecb7b RD |
940 | ) |
941 | ||
942 | wxpExtensions.append(ext) | |
c368d904 RD |
943 | |
944 | ||
945 | #---------------------------------------------------------------------- | |
946 | # Define the OGL extension module | |
947 | #---------------------------------------------------------------------- | |
948 | ||
1e4a197e | 949 | if BUILD_OGL: |
cfe766c3 | 950 | msg('Preparing OGL...') |
c368d904 | 951 | location = 'contrib/ogl' |
c368d904 | 952 | |
a32360e0 | 953 | swig_sources = run_swig(['ogl.i'], location, GENDIR, PKGDIR, |
d14a1e28 RD |
954 | USE_SWIG, swig_force, swig_args, swig_deps + |
955 | [ '%s/_oglbasic.i' % location, | |
956 | '%s/_oglshapes.i' % location, | |
957 | '%s/_oglshapes2.i' % location, | |
958 | '%s/_oglcanvas.i' % location, | |
959 | '%s/_ogldefs.i' % location, | |
960 | ]) | |
c368d904 | 961 | |
d14a1e28 | 962 | ext = Extension('_ogl', |
3ef86e32 | 963 | swig_sources, |
1e7ecb7b | 964 | |
a32360e0 | 965 | include_dirs = includes + [ location ], |
dd116e73 | 966 | define_macros = defines + [('wxUSE_DEPRECATED', '0')], |
1e7ecb7b RD |
967 | |
968 | library_dirs = libdirs, | |
3ef86e32 | 969 | libraries = libs + makeLibName('ogl'), |
1e7ecb7b RD |
970 | |
971 | extra_compile_args = cflags, | |
972 | extra_link_args = lflags, | |
973 | ) | |
974 | ||
975 | wxpExtensions.append(ext) | |
976 | ||
977 | ||
c368d904 RD |
978 | |
979 | #---------------------------------------------------------------------- | |
980 | # Define the STC extension module | |
981 | #---------------------------------------------------------------------- | |
982 | ||
1e4a197e | 983 | if BUILD_STC: |
cfe766c3 | 984 | msg('Preparing STC...') |
c368d904 | 985 | location = 'contrib/stc' |
5a2a9da2 RD |
986 | if os.name == 'nt': |
987 | STC_H = opj(WXDIR, 'contrib', 'include/wx/stc') | |
988 | else: | |
989 | STC_H = opj(WXPREFIX, 'include/wx/stc') | |
55c020cf | 990 | |
3ef86e32 | 991 | ## NOTE: need to add this to the stc.bkl... |
55c020cf | 992 | |
3ef86e32 RD |
993 | ## # Check if gen_iface needs to be run for the wxSTC sources |
994 | ## if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or | |
995 | ## newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or | |
996 | ## newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))): | |
55c020cf | 997 | |
3ef86e32 RD |
998 | ## msg('Running gen_iface.py, regenerating stc.h and stc.cpp...') |
999 | ## cwd = os.getcwd() | |
1000 | ## os.chdir(opj(CTRB_SRC, 'stc')) | |
1001 | ## sys.path.insert(0, os.curdir) | |
1002 | ## import gen_iface | |
1003 | ## gen_iface.main([]) | |
1004 | ## os.chdir(cwd) | |
c368d904 RD |
1005 | |
1006 | ||
d14a1e28 | 1007 | swig_sources = run_swig(['stc.i'], location, '', PKGDIR, |
c368d904 RD |
1008 | USE_SWIG, swig_force, |
1009 | swig_args + ['-I'+STC_H, '-I'+location], | |
10ef30eb | 1010 | [opj(STC_H, 'stc.h')] + swig_deps) |
c368d904 | 1011 | |
d14a1e28 | 1012 | ext = Extension('_stc', |
3ef86e32 RD |
1013 | swig_sources, |
1014 | ||
1015 | include_dirs = includes, | |
1016 | define_macros = defines, | |
1e7ecb7b RD |
1017 | |
1018 | library_dirs = libdirs, | |
3ef86e32 | 1019 | libraries = libs + makeLibName('stc'), |
c368d904 | 1020 | |
1e7ecb7b RD |
1021 | extra_compile_args = cflags, |
1022 | extra_link_args = lflags, | |
1023 | ) | |
1024 | ||
1025 | wxpExtensions.append(ext) | |
c368d904 RD |
1026 | |
1027 | ||
1028 | ||
926bb76c RD |
1029 | #---------------------------------------------------------------------- |
1030 | # Define the IEWIN extension module (experimental) | |
1031 | #---------------------------------------------------------------------- | |
1032 | ||
1e4a197e | 1033 | if BUILD_IEWIN: |
cfe766c3 | 1034 | msg('Preparing IEWIN...') |
926bb76c RD |
1035 | location = 'contrib/iewin' |
1036 | ||
1037 | swig_files = ['iewin.i', ] | |
1038 | ||
1039 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 1040 | USE_SWIG, swig_force, swig_args, swig_deps) |
926bb76c RD |
1041 | |
1042 | ||
1043 | ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location, | |
c731eb47 | 1044 | '%s/wxactivex.cpp' % location, |
926bb76c RD |
1045 | ] + swig_sources, |
1046 | ||
1047 | include_dirs = includes, | |
1048 | define_macros = defines, | |
1049 | ||
1050 | library_dirs = libdirs, | |
1051 | libraries = libs, | |
1052 | ||
1053 | extra_compile_args = cflags, | |
1054 | extra_link_args = lflags, | |
1055 | ) | |
1056 | ||
1057 | wxpExtensions.append(ext) | |
1058 | ||
1059 | ||
d56cebe7 RD |
1060 | #---------------------------------------------------------------------- |
1061 | # Define the XRC extension module | |
1062 | #---------------------------------------------------------------------- | |
1063 | ||
1e4a197e | 1064 | if BUILD_XRC: |
cfe766c3 | 1065 | msg('Preparing XRC...') |
d56cebe7 | 1066 | location = 'contrib/xrc' |
d56cebe7 | 1067 | |
d14a1e28 RD |
1068 | swig_sources = run_swig(['xrc.i'], location, '', PKGDIR, |
1069 | USE_SWIG, swig_force, swig_args, swig_deps + | |
1070 | [ '%s/_xrc_rename.i' % location, | |
1071 | '%s/_xrc_ex.py' % location, | |
1072 | '%s/_xmlres.i' % location, | |
1073 | '%s/_xmlsub.i' % location, | |
1074 | '%s/_xml.i' % location, | |
1075 | '%s/_xmlhandler.i' % location, | |
1076 | ]) | |
1077 | ||
1078 | ext = Extension('_xrc', | |
3ef86e32 | 1079 | swig_sources, |
1fded56b | 1080 | |
3ef86e32 | 1081 | include_dirs = includes, |
d56cebe7 RD |
1082 | define_macros = defines, |
1083 | ||
1084 | library_dirs = libdirs, | |
3ef86e32 | 1085 | libraries = libs + makeLibName('xrc'), |
d56cebe7 RD |
1086 | |
1087 | extra_compile_args = cflags, | |
1088 | extra_link_args = lflags, | |
1089 | ) | |
1090 | ||
1091 | wxpExtensions.append(ext) | |
1092 | ||
1093 | ||
1094 | ||
ebf4302c RD |
1095 | #---------------------------------------------------------------------- |
1096 | # Define the GIZMOS extension module | |
1097 | #---------------------------------------------------------------------- | |
1098 | ||
1e4a197e | 1099 | if BUILD_GIZMOS: |
ebf4302c RD |
1100 | msg('Preparing GIZMOS...') |
1101 | location = 'contrib/gizmos' | |
ebf4302c | 1102 | |
a32360e0 | 1103 | swig_sources = run_swig(['gizmos.i'], location, GENDIR, PKGDIR, |
10ef30eb | 1104 | USE_SWIG, swig_force, swig_args, swig_deps) |
ebf4302c | 1105 | |
d14a1e28 | 1106 | ext = Extension('_gizmos', |
d84a9306 | 1107 | [ '%s/treelistctrl.cpp' % location ] + swig_sources, |
ebf4302c | 1108 | |
a32360e0 | 1109 | include_dirs = includes + [ location ], |
ebf4302c RD |
1110 | define_macros = defines, |
1111 | ||
1112 | library_dirs = libdirs, | |
3ef86e32 | 1113 | libraries = libs + makeLibName('gizmos'), |
ebf4302c RD |
1114 | |
1115 | extra_compile_args = cflags, | |
1116 | extra_link_args = lflags, | |
1117 | ) | |
1118 | ||
1119 | wxpExtensions.append(ext) | |
1120 | ||
1121 | ||
1122 | ||
4a61305d RD |
1123 | #---------------------------------------------------------------------- |
1124 | # Define the DLLWIDGET extension module | |
1125 | #---------------------------------------------------------------------- | |
1126 | ||
1e4a197e | 1127 | if BUILD_DLLWIDGET: |
4a61305d RD |
1128 | msg('Preparing DLLWIDGET...') |
1129 | location = 'contrib/dllwidget' | |
1130 | swig_files = ['dllwidget_.i'] | |
1131 | ||
1132 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 1133 | USE_SWIG, swig_force, swig_args, swig_deps) |
4a61305d RD |
1134 | |
1135 | # copy a contrib project specific py module to the main package dir | |
1136 | copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0) | |
1137 | ||
1138 | ext = Extension('dllwidget_c', [ | |
1139 | '%s/dllwidget.cpp' % location, | |
1140 | ] + swig_sources, | |
1141 | ||
1142 | include_dirs = includes, | |
1143 | define_macros = defines, | |
1144 | ||
1145 | library_dirs = libdirs, | |
1146 | libraries = libs, | |
1147 | ||
1148 | extra_compile_args = cflags, | |
1149 | extra_link_args = lflags, | |
1150 | ) | |
1151 | ||
1152 | wxpExtensions.append(ext) | |
1153 | ||
1154 | ||
1e4a197e RD |
1155 | |
1156 | ||
1157 | #---------------------------------------------------------------------- | |
1158 | # Tools and scripts | |
1159 | #---------------------------------------------------------------------- | |
8916d007 | 1160 | |
2eb31f8b RD |
1161 | if NO_SCRIPTS: |
1162 | SCRIPTS = None | |
1163 | else: | |
1e4a197e RD |
1164 | SCRIPTS = [opj('scripts/helpviewer'), |
1165 | opj('scripts/img2png'), | |
2eb31f8b RD |
1166 | opj('scripts/img2xpm'), |
1167 | opj('scripts/img2py'), | |
1168 | opj('scripts/xrced'), | |
1169 | opj('scripts/pyshell'), | |
1170 | opj('scripts/pycrust'), | |
1fded56b RD |
1171 | opj('scripts/pywrap'), |
1172 | opj('scripts/pywrap'), | |
1173 | opj('scripts/pyalacarte'), | |
1174 | opj('scripts/pyalamode'), | |
2eb31f8b | 1175 | ] |
4a61305d | 1176 | |
926bb76c | 1177 | |
1fded56b RD |
1178 | DATA_FILES += find_data_files('wxPython/tools/XRCed', '*.txt', '*.xrc') |
1179 | DATA_FILES += find_data_files('wxPython/py', '*.txt', '*.ico', '*.css', '*.html') | |
1180 | DATA_FILES += find_data_files('wx', '*.txt', '*.css', '*.html') | |
1e4a197e RD |
1181 | |
1182 | ||
c368d904 RD |
1183 | #---------------------------------------------------------------------- |
1184 | # Do the Setup/Build/Install/Whatever | |
1185 | #---------------------------------------------------------------------- | |
1186 | ||
1b62f00d | 1187 | if __name__ == "__main__": |
1e4a197e | 1188 | if not PREP_ONLY: |
d14a1e28 | 1189 | setup(name = 'wxPython', |
1b62f00d RD |
1190 | version = VERSION, |
1191 | description = DESCRIPTION, | |
1192 | long_description = LONG_DESCRIPTION, | |
1193 | author = AUTHOR, | |
1194 | author_email = AUTHOR_EMAIL, | |
1195 | url = URL, | |
851d4ac7 | 1196 | download_url = DOWNLOAD_URL, |
e2e02194 | 1197 | license = LICENSE, |
851d4ac7 RD |
1198 | platforms = PLATFORMS, |
1199 | classifiers = filter(None, CLASSIFIERS.split("\n")), | |
1200 | keywords = KEYWORDS, | |
d14a1e28 | 1201 | |
1fded56b RD |
1202 | packages = ['wxPython', |
1203 | 'wxPython.lib', | |
1204 | 'wxPython.lib.colourchooser', | |
1205 | 'wxPython.lib.editor', | |
1206 | 'wxPython.lib.mixins', | |
1fded56b | 1207 | 'wxPython.tools', |
1fded56b RD |
1208 | |
1209 | 'wx', | |
1210 | 'wx.lib', | |
1211 | 'wx.lib.colourchooser', | |
1212 | 'wx.lib.editor', | |
1213 | 'wx.lib.mixins', | |
1214 | 'wx.py', | |
d14a1e28 | 1215 | 'wx.py.wxd', |
1fded56b RD |
1216 | 'wx.tools', |
1217 | 'wx.tools.XRCed', | |
1b62f00d RD |
1218 | ], |
1219 | ||
1220 | ext_package = PKGDIR, | |
1221 | ext_modules = wxpExtensions, | |
8916d007 | 1222 | |
f6f98ecc | 1223 | options = { 'build' : { 'build_base' : BUILD_BASE }}, |
a541c325 | 1224 | |
b817523b | 1225 | scripts = SCRIPTS, |
c368d904 | 1226 | |
1e4a197e RD |
1227 | cmdclass = { 'install_data': smart_install_data}, |
1228 | data_files = DATA_FILES, | |
8916d007 | 1229 | |
1b62f00d | 1230 | ) |
c368d904 | 1231 | |
c368d904 | 1232 | |
c368d904 RD |
1233 | #---------------------------------------------------------------------- |
1234 | #---------------------------------------------------------------------- |