]>
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 |
d14a1e28 | 20 | VER_FLAGS = "p3" # 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 | ||
249 | sources = [] | |
250 | ||
251 | for file in files: | |
252 | basefile = os.path.splitext(file)[0] | |
253 | i_file = os.path.join(dir, file) | |
254 | py_file = os.path.join(dir, gendir, basefile+'.py') | |
d14a1e28 | 255 | cpp_file = os.path.join(dir, gendir, basefile+'_wrap.cpp') |
1e4a197e RD |
256 | |
257 | sources.append(cpp_file) | |
258 | ||
ce8f00f3 | 259 | if not cleaning and USE_SWIG: |
1e4a197e RD |
260 | for dep in swig_deps: |
261 | if newer(dep, py_file) or newer(dep, cpp_file): | |
262 | force = 1 | |
263 | break | |
264 | ||
265 | if force or newer(i_file, py_file) or newer(i_file, cpp_file): | |
d14a1e28 RD |
266 | ## we need forward slashes here even on win32 |
267 | #cpp_file = opj(cpp_file) #'/'.join(cpp_file.split('\\')) | |
268 | #i_file = opj(i_file) #'/'.join(i_file.split('\\')) | |
269 | ||
270 | if BUILD_RENAMERS: | |
271 | # first run build_renamers | |
272 | cmd = [ sys.executable, '-u', | |
273 | './distrib/build_renamers.py', | |
274 | i_file, '-D'+WXPLAT, ] + \ | |
275 | [x for x in swig_args if x.startswith('-I')] | |
276 | msg(' '.join(cmd)) | |
277 | spawn(cmd) | |
278 | ||
279 | # Then run swig for real | |
280 | cmd = [ swig_cmd ] + swig_args + ['-I'+dir, '-o', cpp_file, i_file] | |
1e4a197e RD |
281 | msg(' '.join(cmd)) |
282 | spawn(cmd) | |
283 | ||
d14a1e28 | 284 | |
1e4a197e RD |
285 | # copy the generated python file to the package directory |
286 | copy_file(py_file, package, update=not force, verbose=0) | |
287 | ||
288 | return sources | |
289 | ||
290 | ||
291 | ||
292 | def contrib_copy_tree(src, dest, verbose=0): | |
293 | """Update local copies of wxWindows contrib files""" | |
294 | from distutils.dir_util import mkpath, copy_tree | |
295 | ||
296 | mkpath(dest, verbose=verbose) | |
297 | copy_tree(src, dest, update=1, verbose=verbose) | |
298 | ||
299 | ||
300 | ||
301 | class smart_install_data(install_data): | |
302 | def run(self): | |
303 | #need to change self.install_dir to the actual library dir | |
304 | install_cmd = self.get_finalized_command('install') | |
305 | self.install_dir = getattr(install_cmd, 'install_lib') | |
306 | return install_data.run(self) | |
307 | ||
308 | ||
309 | def build_locale_dir(destdir, verbose=1): | |
310 | """Build a locale dir under the wxPython package for MSW""" | |
311 | moFiles = glob.glob(opj(WXDIR, 'locale', '*.mo')) | |
312 | for src in moFiles: | |
313 | lang = os.path.splitext(os.path.basename(src))[0] | |
314 | dest = opj(destdir, lang, 'LC_MESSAGES') | |
315 | mkpath(dest, verbose=verbose) | |
316 | copy_file(src, opj(dest, 'wxstd.mo'), update=1, verbose=verbose) | |
317 | ||
318 | ||
319 | def build_locale_list(srcdir): | |
320 | # get a list of all files under the srcdir, to be used for install_data | |
321 | def walk_helper(lst, dirname, files): | |
322 | for f in files: | |
323 | filename = opj(dirname, f) | |
324 | if not os.path.isdir(filename): | |
325 | lst.append( (dirname, [filename]) ) | |
326 | file_list = [] | |
327 | os.path.walk(srcdir, walk_helper, file_list) | |
328 | return file_list | |
329 | ||
330 | ||
1fded56b RD |
331 | def find_data_files(srcdir, *wildcards): |
332 | # get a list of all files under the srcdir matching wildcards, | |
333 | # returned in a format to be used for install_data | |
334 | ||
335 | def walk_helper(arg, dirname, files): | |
336 | names = [] | |
337 | lst, wildcards = arg | |
338 | for wc in wildcards: | |
339 | for f in files: | |
340 | filename = opj(dirname, f) | |
341 | if fnmatch.fnmatch(filename, wc) and not os.path.isdir(filename): | |
342 | names.append(filename) | |
343 | if names: | |
344 | lst.append( (dirname, names ) ) | |
345 | ||
346 | file_list = [] | |
347 | os.path.walk(srcdir, walk_helper, (file_list, wildcards)) | |
348 | return file_list | |
1e4a197e RD |
349 | |
350 | ||
3ef86e32 RD |
351 | def makeLibName(name): |
352 | if os.name == 'posix': | |
353 | libname = '%s_%s-%s' % (WXBASENAME, name, WXRELEASE) | |
354 | else: | |
3e46a8e6 | 355 | libname = 'wxmsw%s%s_%s' % (WXDLLVER, libFlag(), name) |
3ef86e32 RD |
356 | |
357 | return [libname] | |
358 | ||
359 | ||
360 | ||
361 | def adjustCFLAGS(cflags, defines, includes): | |
d14a1e28 | 362 | '''Extrace the raw -I, -D, and -U flags and put them into |
3ef86e32 RD |
363 | defines and includes as needed.''' |
364 | newCFLAGS = [] | |
365 | for flag in cflags: | |
366 | if flag[:2] == '-I': | |
367 | includes.append(flag[2:]) | |
368 | elif flag[:2] == '-D': | |
369 | flag = flag[2:] | |
370 | if flag.find('=') == -1: | |
371 | defines.append( (flag, None) ) | |
372 | else: | |
373 | defines.append( tuple(flag.split('=')) ) | |
374 | elif flag[:2] == '-U': | |
375 | defines.append( (flag[2:], ) ) | |
376 | else: | |
377 | newCFLAGS.append(flag) | |
378 | return newCFLAGS | |
379 | ||
380 | ||
381 | ||
382 | def adjustLFLAGS(lfags, libdirs, libs): | |
d14a1e28 | 383 | '''Extrace the -L and -l flags and put them in libdirs and libs as needed''' |
3ef86e32 RD |
384 | newLFLAGS = [] |
385 | for flag in lflags: | |
386 | if flag[:2] == '-L': | |
387 | libdirs.append(flag[2:]) | |
388 | elif flag[:2] == '-l': | |
389 | libs.append(flag[2:]) | |
390 | else: | |
391 | newLFLAGS.append(flag) | |
392 | ||
393 | return newLFLAGS | |
c8bc7bb8 RD |
394 | |
395 | #---------------------------------------------------------------------- | |
396 | # sanity checks | |
397 | ||
c368d904 | 398 | if CORE_ONLY: |
f221f8eb | 399 | BUILD_GLCANVAS = 0 |
c368d904 RD |
400 | BUILD_OGL = 0 |
401 | BUILD_STC = 0 | |
b166c703 | 402 | BUILD_XRC = 0 |
ff5f1aba RD |
403 | BUILD_GIZMOS = 0 |
404 | BUILD_DLLWIDGET = 0 | |
c731eb47 | 405 | BUILD_IEWIN = 0 |
ff5f1aba | 406 | |
1e4a197e RD |
407 | if debug: |
408 | FINAL = 0 | |
409 | HYBRID = 0 | |
c368d904 | 410 | |
1e4a197e RD |
411 | if FINAL: |
412 | HYBRID = 0 | |
c8bc7bb8 | 413 | |
1e4a197e RD |
414 | if UNICODE and WXPORT not in ['msw', 'gtk2']: |
415 | raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT | |
a541c325 RD |
416 | |
417 | ||
c368d904 RD |
418 | #---------------------------------------------------------------------- |
419 | # Setup some platform specific stuff | |
420 | #---------------------------------------------------------------------- | |
421 | ||
422 | if os.name == 'nt': | |
423 | # Set compile flags and such for MSVC. These values are derived | |
a541c325 RD |
424 | # from the wxWindows makefiles for MSVC, other compilers settings |
425 | # will probably vary... | |
426 | if os.environ.has_key('WXWIN'): | |
427 | WXDIR = os.environ['WXWIN'] | |
428 | else: | |
429 | msg("WARNING: WXWIN not set in environment.") | |
430 | WXDIR = '..' # assumes in CVS tree | |
c368d904 RD |
431 | WXPLAT = '__WXMSW__' |
432 | GENDIR = 'msw' | |
433 | ||
d14a1e28 RD |
434 | includes = ['include', 'src', |
435 | opj(WXDIR, 'lib', 'vc_dll', 'msw' + libFlag()), | |
55c020cf | 436 | opj(WXDIR, 'include'), |
5a2a9da2 | 437 | opj(WXDIR, 'contrib', 'include'), |
c368d904 RD |
438 | ] |
439 | ||
1e4a197e | 440 | defines = [ ('WIN32', None), |
c368d904 | 441 | ('_WINDOWS', None), |
c368d904 RD |
442 | |
443 | (WXPLAT, None), | |
444 | ('WXUSINGDLL', '1'), | |
445 | ||
446 | ('SWIG_GLOBAL', None), | |
c368d904 RD |
447 | ('WXP_USE_THREAD', '1'), |
448 | ] | |
449 | ||
1e4a197e RD |
450 | if UNDEF_NDEBUG: |
451 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
22d08289 RD |
452 | |
453 | ||
c368d904 RD |
454 | if not FINAL or HYBRID: |
455 | defines.append( ('__WXDEBUG__', None) ) | |
456 | ||
1e521887 | 457 | libdirs = [ opj(WXDIR, 'lib', 'vc_dll') ] |
0a67b751 RD |
458 | libs = [ 'wxbase' + WXDLLVER + libFlag(), # TODO: trim this down to what is really needed for the core |
459 | 'wxbase' + WXDLLVER + libFlag() + '_net', | |
460 | 'wxbase' + WXDLLVER + libFlag() + '_xml', | |
461 | makeLibName('core')[0], | |
462 | makeLibName('adv')[0], | |
463 | makeLibName('html')[0], | |
464 | ] | |
a4fbdd76 | 465 | |
22d08289 | 466 | libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32', |
c368d904 | 467 | 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32', |
1e4a197e | 468 | 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4', |
c368d904 RD |
469 | 'advapi32', 'wsock32'] |
470 | ||
22d08289 | 471 | |
d440a0e7 | 472 | cflags = [ '/Gy', |
ad07d019 RD |
473 | # '/GX-' # workaround for internal compiler error in MSVC on some machines |
474 | ] | |
c368d904 RD |
475 | lflags = None |
476 | ||
1e4a197e | 477 | # Other MSVC flags... |
1fded56b | 478 | # Too bad I don't remember why I was playing with these, can they be removed? |
1e4a197e RD |
479 | if FINAL: |
480 | pass #cflags = cflags + ['/O1'] | |
481 | elif HYBRID : | |
482 | pass #cflags = cflags + ['/Ox'] | |
483 | else: | |
484 | pass # cflags = cflags + ['/Od', '/Z7'] | |
485 | # lflags = ['/DEBUG', ] | |
22d08289 RD |
486 | |
487 | ||
22d08289 | 488 | |
1e4a197e | 489 | #---------------------------------------------------------------------- |
c368d904 | 490 | |
3ef86e32 | 491 | elif os.name == 'posix': |
d14a1e28 RD |
492 | WXDIR = '..' |
493 | includes = ['include', 'src'] | |
e6056257 RD |
494 | defines = [('SWIG_GLOBAL', None), |
495 | ('HAVE_CONFIG_H', None), | |
496 | ('WXP_USE_THREAD', '1'), | |
497 | ] | |
1e4a197e RD |
498 | if UNDEF_NDEBUG: |
499 | defines.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef | |
1e4a197e RD |
500 | |
501 | Verify_WX_CONFIG() | |
e6056257 | 502 | |
3ef86e32 RD |
503 | libdirs = [] |
504 | libs = [] | |
505 | ||
e6056257 | 506 | cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] |
1e4a197e | 507 | cflags = cflags.split() |
ba201fa4 RD |
508 | if debug: |
509 | cflags.append('-g') | |
510 | cflags.append('-O0') | |
8b9a4190 RD |
511 | else: |
512 | cflags.append('-O3') | |
e6056257 RD |
513 | |
514 | lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1] | |
1e4a197e | 515 | lflags = lflags.split() |
e6056257 | 516 | |
3ef86e32 RD |
517 | WXBASENAME = os.popen(WX_CONFIG + ' --basename').read()[:-1] |
518 | WXRELEASE = os.popen(WX_CONFIG + ' --release').read()[:-1] | |
519 | WXPREFIX = os.popen(WX_CONFIG + ' --prefix').read()[:-1] | |
e6056257 RD |
520 | |
521 | ||
3ef86e32 RD |
522 | if sys.platform[:6] == "darwin": |
523 | # Flags and such for a Darwin (Max OS X) build of Python | |
524 | WXPLAT = '__WXMAC__' | |
525 | GENDIR = 'mac' | |
526 | libs = ['stdc++'] | |
527 | NO_SCRIPTS = 1 | |
c368d904 | 528 | |
1e4a197e | 529 | |
3ef86e32 RD |
530 | else: |
531 | # Set flags for other Unix type platforms | |
532 | GENDIR = WXPORT | |
533 | ||
534 | if WXPORT == 'gtk': | |
535 | WXPLAT = '__WXGTK__' | |
536 | portcfg = os.popen('gtk-config --cflags', 'r').read()[:-1] | |
537 | elif WXPORT == 'gtk2': | |
538 | WXPLAT = '__WXGTK__' | |
539 | GENDIR = 'gtk' # no code differences so use the same generated sources | |
540 | portcfg = os.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1] | |
541 | BUILD_BASE = BUILD_BASE + '-' + WXPORT | |
542 | elif WXPORT == 'x11': | |
543 | WXPLAT = '__WXX11__' | |
544 | portcfg = '' | |
545 | BUILD_BASE = BUILD_BASE + '-' + WXPORT | |
546 | else: | |
547 | raise SystemExit, "Unknown WXPORT value: " + WXPORT | |
1e4a197e | 548 | |
3ef86e32 | 549 | cflags += portcfg.split() |
1e4a197e | 550 | |
d14a1e28 RD |
551 | # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but |
552 | # wx-config doesn't output that for some reason. For now, just | |
553 | # add it unconditionally but we should really check if the lib is | |
554 | # really found there or wx-config should be fixed. | |
555 | libdirs.append("/usr/X11R6/lib") | |
c368d904 | 556 | |
1e4a197e | 557 | |
3ef86e32 RD |
558 | # Move the various -I, -D, etc. flags we got from the *config scripts |
559 | # into the distutils lists. | |
560 | cflags = adjustCFLAGS(cflags, defines, includes) | |
561 | lflags = adjustLFLAGS(lflags, libdirs, libs) | |
c368d904 RD |
562 | |
563 | ||
1e4a197e | 564 | #---------------------------------------------------------------------- |
c368d904 | 565 | else: |
1e4a197e RD |
566 | raise 'Sorry Charlie, platform not supported...' |
567 | ||
568 | ||
569 | #---------------------------------------------------------------------- | |
1fded56b | 570 | # post platform setup checks and tweaks, create the full version string |
1e4a197e RD |
571 | #---------------------------------------------------------------------- |
572 | ||
573 | if UNICODE: | |
574 | BUILD_BASE = BUILD_BASE + '.unicode' | |
1fded56b | 575 | VER_FLAGS += 'u' |
c368d904 RD |
576 | |
577 | ||
1fded56b RD |
578 | VERSION = "%s.%s.%s.%s%s" % (VER_MAJOR, VER_MINOR, VER_RELEASE, |
579 | VER_SUBREL, VER_FLAGS) | |
580 | ||
c368d904 | 581 | #---------------------------------------------------------------------- |
1fded56b | 582 | # Update the version file |
c368d904 RD |
583 | #---------------------------------------------------------------------- |
584 | ||
1fded56b RD |
585 | # Unconditionally updated since the version string can change based |
586 | # on the UNICODE flag | |
587 | open('src/__version__.py', 'w').write("""\ | |
588 | # This file was generated by setup.py... | |
589 | ||
d14a1e28 RD |
590 | VERSION_STRING = '%(VERSION)s' |
591 | MAJOR_VERSION = %(VER_MAJOR)s | |
592 | MINOR_VERSION = %(VER_MINOR)s | |
593 | RELEASE_VERSION = %(VER_RELEASE)s | |
594 | SUBREL_VERSION = %(VER_SUBREL)s | |
1fded56b | 595 | |
d14a1e28 RD |
596 | VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION, |
597 | SUBREL_VERSION, '%(VER_FLAGS)s') | |
1fded56b | 598 | |
d14a1e28 | 599 | RELEASE_NUMBER = RELEASE_VERSION # for compatibility |
1fded56b | 600 | """ % globals()) |
1e4a197e | 601 | |
c368d904 | 602 | |
1b62f00d RD |
603 | |
604 | ||
c368d904 | 605 | #---------------------------------------------------------------------- |
1b62f00d | 606 | # SWIG defaults |
c368d904 RD |
607 | #---------------------------------------------------------------------- |
608 | ||
d14a1e28 | 609 | swig_cmd = SWIG |
c368d904 | 610 | swig_force = force |
d14a1e28 RD |
611 | swig_args = ['-c++', |
612 | '-Wall', | |
613 | '-nodefault', | |
614 | ||
615 | ## '-xml', | |
616 | ||
617 | '-python', | |
618 | '-keyword', | |
619 | '-new_repr', | |
620 | '-modern', | |
621 | ||
622 | '-I./src', | |
623 | '-D'+WXPLAT, | |
624 | '-c' | |
e6056257 | 625 | ] |
a541c325 | 626 | if UNICODE: |
c8bc7bb8 RD |
627 | swig_args.append('-DwxUSE_UNICODE') |
628 | ||
d14a1e28 RD |
629 | swig_deps = [ 'src/my_typemaps.i', |
630 | 'src/common.swg', | |
631 | 'src/pyrun.swg', | |
632 | ] | |
633 | ||
634 | depends = [ #'include/wx/wxPython/wxPython.h', | |
635 | #'include/wx/wxPython/wxPython_int.h', | |
636 | #'src/pyclasses.h', | |
637 | ] | |
c368d904 | 638 | |
c368d904 | 639 | |
1b62f00d RD |
640 | #---------------------------------------------------------------------- |
641 | # Define the CORE extension module | |
642 | #---------------------------------------------------------------------- | |
643 | ||
1e4a197e | 644 | msg('Preparing CORE...') |
d14a1e28 RD |
645 | swig_sources = run_swig(['core.i'], 'src', GENDIR, PKGDIR, |
646 | USE_SWIG, swig_force, swig_args, swig_deps + | |
647 | [ 'src/_app.i', | |
648 | 'src/_app_ex.py', | |
649 | 'src/_constraints.i', | |
650 | 'src/_core_api.i', | |
651 | 'src/_core_ex.py', | |
652 | 'src/_core_rename.i', | |
653 | 'src/_core_reverse.txt', | |
654 | 'src/_defs.i', | |
655 | 'src/_event.i', | |
656 | 'src/_event_ex.py', | |
657 | 'src/_evthandler.i', | |
658 | 'src/_filesys.i', | |
659 | 'src/_gdicmn.i', | |
660 | 'src/_image.i', | |
661 | 'src/_menu.i', | |
662 | 'src/_obj.i', | |
663 | 'src/_sizers.i', | |
664 | 'src/_gbsizer.i', | |
665 | 'src/_streams.i', | |
666 | 'src/_validator.i', | |
667 | 'src/_window.i', | |
668 | ]) | |
1b62f00d | 669 | |
1e4a197e RD |
670 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) |
671 | copy_file('src/__version__.py', PKGDIR, update=1, verbose=0) | |
1b62f00d RD |
672 | |
673 | ||
d14a1e28 RD |
674 | # update the license files |
675 | mkpath('licence') | |
676 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
677 | copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0) | |
c368d904 | 678 | |
c368d904 | 679 | |
1e4a197e RD |
680 | if os.name == 'nt': |
681 | build_locale_dir(opj(PKGDIR, 'locale')) | |
682 | DATA_FILES += build_locale_list(opj(PKGDIR, 'locale')) | |
4f3449b4 RD |
683 | |
684 | ||
1e4a197e RD |
685 | if os.name == 'nt': |
686 | rc_file = ['src/wxc.rc'] | |
687 | else: | |
688 | rc_file = [] | |
689 | ||
690 | ||
d14a1e28 RD |
691 | ext = Extension('_core', ['src/helpers.cpp', |
692 | 'src/libpy.c', | |
1e4a197e RD |
693 | ] + rc_file + swig_sources, |
694 | ||
695 | include_dirs = includes, | |
696 | define_macros = defines, | |
697 | ||
698 | library_dirs = libdirs, | |
699 | libraries = libs, | |
700 | ||
701 | extra_compile_args = cflags, | |
702 | extra_link_args = lflags, | |
d14a1e28 RD |
703 | |
704 | depends = depends | |
1e4a197e RD |
705 | ) |
706 | wxpExtensions.append(ext) | |
707 | ||
708 | ||
d14a1e28 RD |
709 | |
710 | ||
711 | ||
712 | # Extension for the GDI module | |
713 | swig_sources = run_swig(['gdi.i'], 'src', GENDIR, PKGDIR, | |
714 | USE_SWIG, swig_force, swig_args, swig_deps + | |
715 | ['src/_gdi_rename.i', | |
716 | 'src/_bitmap.i', 'src/_brush.i', | |
717 | 'src/_colour.i', 'src/_cursor.i', | |
718 | 'src/_dc.i', 'src/_font.i', | |
719 | 'src/_gdiobj.i', 'src/_icon.i', | |
720 | 'src/_imaglist.i', 'src/_pen.i', | |
721 | 'src/_region.i', 'src/_palette.i', | |
dd9f7fea | 722 | 'src/_stockobjs.i', |
d14a1e28 RD |
723 | 'src/_effects.i', |
724 | 'src/_intl.i', | |
725 | 'src/_intl_ex.py', | |
726 | ]) | |
727 | ext = Extension('_gdi', ['src/drawlist.cpp'] + swig_sources, | |
1e4a197e RD |
728 | include_dirs = includes, |
729 | define_macros = defines, | |
730 | library_dirs = libdirs, | |
731 | libraries = libs, | |
732 | extra_compile_args = cflags, | |
733 | extra_link_args = lflags, | |
d14a1e28 | 734 | depends = depends |
1e4a197e RD |
735 | ) |
736 | wxpExtensions.append(ext) | |
737 | ||
738 | ||
d14a1e28 RD |
739 | |
740 | ||
741 | ||
742 | ||
743 | # Extension for the windows module | |
744 | swig_sources = run_swig(['windows.i'], 'src', GENDIR, PKGDIR, | |
745 | USE_SWIG, swig_force, swig_args, swig_deps + | |
746 | ['src/_windows_rename.i', 'src/_windows_reverse.txt', | |
747 | 'src/_panel.i', | |
748 | 'src/_accel.i', | |
749 | 'src/_toplvl.i', 'src/_statusbar.i', | |
750 | 'src/_splitter.i', 'src/_sashwin.i', | |
751 | 'src/_popupwin.i', 'src/_tipwin.i', | |
752 | 'src/_vscroll.i', 'src/_taskbar.i', | |
753 | 'src/_cmndlgs.i', 'src/_mdi.i', | |
754 | 'src/_pywindows.i', 'src/_printfw.i', | |
755 | ]) | |
756 | ext = Extension('_windows', swig_sources, | |
1e4a197e RD |
757 | include_dirs = includes, |
758 | define_macros = defines, | |
759 | library_dirs = libdirs, | |
760 | libraries = libs, | |
761 | extra_compile_args = cflags, | |
762 | extra_link_args = lflags, | |
d14a1e28 | 763 | depends = depends |
1e4a197e RD |
764 | ) |
765 | wxpExtensions.append(ext) | |
766 | ||
767 | ||
d14a1e28 RD |
768 | |
769 | ||
770 | # Extension for the controls module | |
771 | swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR, | |
772 | USE_SWIG, swig_force, swig_args, swig_deps + | |
773 | [ 'src/_controls_rename.i', 'src/_controls_reverse.txt', | |
774 | 'src/_control.i', 'src/_toolbar.i', | |
775 | 'src/_button.i', 'src/_checkbox.i', | |
776 | 'src/_choice.i', 'src/_combobox.i', | |
777 | 'src/_gauge.i', 'src/_statctrls.i', | |
778 | 'src/_listbox.i', 'src/_textctrl.i', | |
779 | 'src/_scrolbar.i', 'src/_spin.i', | |
780 | 'src/_radio.i', 'src/_slider.i', | |
781 | 'src/_tglbtn.i', 'src/_notebook.i', | |
782 | 'src/_listctrl.i', 'src/_treectrl.i', | |
783 | 'src/_dirctrl.i', 'src/_pycontrol.i', | |
dd9f7fea | 784 | 'src/_cshelp.i', 'src/_dragimg.i', |
d14a1e28 RD |
785 | ]) |
786 | ext = Extension('_controls', swig_sources, | |
787 | include_dirs = includes, | |
788 | define_macros = defines, | |
789 | library_dirs = libdirs, | |
790 | libraries = libs, | |
791 | extra_compile_args = cflags, | |
792 | extra_link_args = lflags, | |
793 | depends = depends | |
794 | ) | |
795 | wxpExtensions.append(ext) | |
796 | ||
797 | ||
798 | ||
799 | ||
800 | # Extension for the misc module | |
801 | swig_sources = run_swig(['misc.i'], 'src', GENDIR, PKGDIR, | |
802 | USE_SWIG, swig_force, swig_args, swig_deps + | |
803 | [ 'src/_settings.i', 'src/_functions.i', | |
804 | 'src/_misc.i', 'src/_tipdlg.i', | |
805 | 'src/_timer.i', 'src/_log.i', | |
806 | 'src/_process.i', 'src/_joystick.i', | |
807 | 'src/_wave.i', 'src/_mimetype.i', | |
808 | 'src/_artprov.i', 'src/_config.i', | |
809 | 'src/_datetime.i', 'src/_dataobj.i', | |
810 | 'src/_dnd.i', | |
811 | 'src/_clipbrd.i', | |
812 | ]) | |
813 | ext = Extension('_misc', swig_sources, | |
814 | include_dirs = includes, | |
815 | define_macros = defines, | |
816 | library_dirs = libdirs, | |
817 | libraries = libs, | |
818 | extra_compile_args = cflags, | |
819 | extra_link_args = lflags, | |
820 | depends = depends | |
821 | ) | |
822 | wxpExtensions.append(ext) | |
823 | ||
824 | ||
825 | ||
826 | ## | |
827 | ## Core modules that are not in the "core" namespace start here | |
828 | ## | |
829 | ||
1e4a197e RD |
830 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, |
831 | USE_SWIG, swig_force, swig_args, swig_deps) | |
d14a1e28 RD |
832 | ext = Extension('_calendar', swig_sources, |
833 | include_dirs = includes, | |
834 | define_macros = defines, | |
835 | library_dirs = libdirs, | |
836 | libraries = libs, | |
837 | extra_compile_args = cflags, | |
838 | extra_link_args = lflags, | |
839 | depends = depends | |
840 | ) | |
841 | wxpExtensions.append(ext) | |
842 | ||
843 | ||
844 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
845 | USE_SWIG, swig_force, swig_args, swig_deps) | |
846 | ext = Extension('_grid', swig_sources, | |
1e4a197e RD |
847 | include_dirs = includes, |
848 | define_macros = defines, | |
849 | library_dirs = libdirs, | |
850 | libraries = libs, | |
851 | extra_compile_args = cflags, | |
852 | extra_link_args = lflags, | |
d14a1e28 | 853 | depends = depends |
1e4a197e RD |
854 | ) |
855 | wxpExtensions.append(ext) | |
856 | ||
857 | ||
d14a1e28 RD |
858 | |
859 | swig_sources = run_swig(['html.i'], 'src', GENDIR, PKGDIR, | |
1e4a197e | 860 | USE_SWIG, swig_force, swig_args, swig_deps) |
d14a1e28 | 861 | ext = Extension('_html', swig_sources, |
1e4a197e RD |
862 | include_dirs = includes, |
863 | define_macros = defines, | |
864 | library_dirs = libdirs, | |
865 | libraries = libs, | |
866 | extra_compile_args = cflags, | |
867 | extra_link_args = lflags, | |
d14a1e28 | 868 | depends = depends |
1e4a197e RD |
869 | ) |
870 | wxpExtensions.append(ext) | |
871 | ||
872 | ||
d14a1e28 | 873 | |
1e4a197e RD |
874 | swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR, |
875 | USE_SWIG, swig_force, swig_args, swig_deps) | |
d14a1e28 | 876 | ext = Extension('_wizard', swig_sources, |
1e4a197e RD |
877 | include_dirs = includes, |
878 | define_macros = defines, | |
879 | library_dirs = libdirs, | |
880 | libraries = libs, | |
881 | extra_compile_args = cflags, | |
882 | extra_link_args = lflags, | |
d14a1e28 | 883 | depends = depends |
1e4a197e RD |
884 | ) |
885 | wxpExtensions.append(ext) | |
af83019e RD |
886 | |
887 | ||
d14a1e28 RD |
888 | |
889 | ||
890 | ||
c368d904 RD |
891 | #---------------------------------------------------------------------- |
892 | # Define the GLCanvas extension module | |
893 | #---------------------------------------------------------------------- | |
894 | ||
1e4a197e | 895 | if BUILD_GLCANVAS: |
cfe766c3 | 896 | msg('Preparing GLCANVAS...') |
c368d904 | 897 | location = 'contrib/glcanvas' |
c368d904 | 898 | |
d14a1e28 | 899 | swig_sources = run_swig(['glcanvas.i'], location, GENDIR, PKGDIR, |
10ef30eb | 900 | USE_SWIG, swig_force, swig_args, swig_deps) |
c368d904 RD |
901 | |
902 | gl_libs = [] | |
903 | if os.name == 'posix': | |
f32afe1c | 904 | gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] |
1e4a197e | 905 | gl_lflags = gl_config.split() + lflags |
f32afe1c | 906 | gl_libs = libs |
19cf4f80 | 907 | else: |
3e46a8e6 | 908 | gl_libs = libs + ['opengl32', 'glu32'] + makeLibName('gl') |
f32afe1c | 909 | gl_lflags = lflags |
c368d904 | 910 | |
d14a1e28 | 911 | ext = Extension('_glcanvas', |
3e46a8e6 | 912 | swig_sources, |
1e7ecb7b RD |
913 | |
914 | include_dirs = includes, | |
915 | define_macros = defines, | |
916 | ||
917 | library_dirs = libdirs, | |
f32afe1c | 918 | libraries = gl_libs, |
1e7ecb7b RD |
919 | |
920 | extra_compile_args = cflags, | |
f32afe1c | 921 | extra_link_args = gl_lflags, |
1e7ecb7b RD |
922 | ) |
923 | ||
924 | wxpExtensions.append(ext) | |
c368d904 RD |
925 | |
926 | ||
927 | #---------------------------------------------------------------------- | |
928 | # Define the OGL extension module | |
929 | #---------------------------------------------------------------------- | |
930 | ||
1e4a197e | 931 | if BUILD_OGL: |
cfe766c3 | 932 | msg('Preparing OGL...') |
c368d904 | 933 | location = 'contrib/ogl' |
c368d904 | 934 | |
d14a1e28 RD |
935 | swig_sources = run_swig(['ogl.i'], location, '', PKGDIR, |
936 | USE_SWIG, swig_force, swig_args, swig_deps + | |
937 | [ '%s/_oglbasic.i' % location, | |
938 | '%s/_oglshapes.i' % location, | |
939 | '%s/_oglshapes2.i' % location, | |
940 | '%s/_oglcanvas.i' % location, | |
941 | '%s/_ogldefs.i' % location, | |
942 | ]) | |
c368d904 | 943 | |
d14a1e28 | 944 | ext = Extension('_ogl', |
3ef86e32 | 945 | swig_sources, |
1e7ecb7b | 946 | |
3ef86e32 | 947 | include_dirs = includes, |
dd116e73 | 948 | define_macros = defines + [('wxUSE_DEPRECATED', '0')], |
1e7ecb7b RD |
949 | |
950 | library_dirs = libdirs, | |
3ef86e32 | 951 | libraries = libs + makeLibName('ogl'), |
1e7ecb7b RD |
952 | |
953 | extra_compile_args = cflags, | |
954 | extra_link_args = lflags, | |
955 | ) | |
956 | ||
957 | wxpExtensions.append(ext) | |
958 | ||
959 | ||
c368d904 RD |
960 | |
961 | #---------------------------------------------------------------------- | |
962 | # Define the STC extension module | |
963 | #---------------------------------------------------------------------- | |
964 | ||
1e4a197e | 965 | if BUILD_STC: |
cfe766c3 | 966 | msg('Preparing STC...') |
c368d904 | 967 | location = 'contrib/stc' |
5a2a9da2 RD |
968 | if os.name == 'nt': |
969 | STC_H = opj(WXDIR, 'contrib', 'include/wx/stc') | |
970 | else: | |
971 | STC_H = opj(WXPREFIX, 'include/wx/stc') | |
55c020cf | 972 | |
3ef86e32 | 973 | ## NOTE: need to add this to the stc.bkl... |
55c020cf | 974 | |
3ef86e32 RD |
975 | ## # Check if gen_iface needs to be run for the wxSTC sources |
976 | ## if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or | |
977 | ## newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or | |
978 | ## newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))): | |
55c020cf | 979 | |
3ef86e32 RD |
980 | ## msg('Running gen_iface.py, regenerating stc.h and stc.cpp...') |
981 | ## cwd = os.getcwd() | |
982 | ## os.chdir(opj(CTRB_SRC, 'stc')) | |
983 | ## sys.path.insert(0, os.curdir) | |
984 | ## import gen_iface | |
985 | ## gen_iface.main([]) | |
986 | ## os.chdir(cwd) | |
c368d904 RD |
987 | |
988 | ||
d14a1e28 | 989 | swig_sources = run_swig(['stc.i'], location, '', PKGDIR, |
c368d904 RD |
990 | USE_SWIG, swig_force, |
991 | swig_args + ['-I'+STC_H, '-I'+location], | |
10ef30eb | 992 | [opj(STC_H, 'stc.h')] + swig_deps) |
c368d904 | 993 | |
d14a1e28 | 994 | ext = Extension('_stc', |
3ef86e32 RD |
995 | swig_sources, |
996 | ||
997 | include_dirs = includes, | |
998 | define_macros = defines, | |
1e7ecb7b RD |
999 | |
1000 | library_dirs = libdirs, | |
3ef86e32 | 1001 | libraries = libs + makeLibName('stc'), |
c368d904 | 1002 | |
1e7ecb7b RD |
1003 | extra_compile_args = cflags, |
1004 | extra_link_args = lflags, | |
1005 | ) | |
1006 | ||
1007 | wxpExtensions.append(ext) | |
c368d904 RD |
1008 | |
1009 | ||
1010 | ||
926bb76c RD |
1011 | #---------------------------------------------------------------------- |
1012 | # Define the IEWIN extension module (experimental) | |
1013 | #---------------------------------------------------------------------- | |
1014 | ||
1e4a197e | 1015 | if BUILD_IEWIN: |
cfe766c3 | 1016 | msg('Preparing IEWIN...') |
926bb76c RD |
1017 | location = 'contrib/iewin' |
1018 | ||
1019 | swig_files = ['iewin.i', ] | |
1020 | ||
1021 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 1022 | USE_SWIG, swig_force, swig_args, swig_deps) |
926bb76c RD |
1023 | |
1024 | ||
1025 | ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location, | |
c731eb47 | 1026 | '%s/wxactivex.cpp' % location, |
926bb76c RD |
1027 | ] + swig_sources, |
1028 | ||
1029 | include_dirs = includes, | |
1030 | define_macros = defines, | |
1031 | ||
1032 | library_dirs = libdirs, | |
1033 | libraries = libs, | |
1034 | ||
1035 | extra_compile_args = cflags, | |
1036 | extra_link_args = lflags, | |
1037 | ) | |
1038 | ||
1039 | wxpExtensions.append(ext) | |
1040 | ||
1041 | ||
d56cebe7 RD |
1042 | #---------------------------------------------------------------------- |
1043 | # Define the XRC extension module | |
1044 | #---------------------------------------------------------------------- | |
1045 | ||
1e4a197e | 1046 | if BUILD_XRC: |
cfe766c3 | 1047 | msg('Preparing XRC...') |
d56cebe7 | 1048 | location = 'contrib/xrc' |
d56cebe7 | 1049 | |
d14a1e28 RD |
1050 | swig_sources = run_swig(['xrc.i'], location, '', PKGDIR, |
1051 | USE_SWIG, swig_force, swig_args, swig_deps + | |
1052 | [ '%s/_xrc_rename.i' % location, | |
1053 | '%s/_xrc_ex.py' % location, | |
1054 | '%s/_xmlres.i' % location, | |
1055 | '%s/_xmlsub.i' % location, | |
1056 | '%s/_xml.i' % location, | |
1057 | '%s/_xmlhandler.i' % location, | |
1058 | ]) | |
1059 | ||
1060 | ext = Extension('_xrc', | |
3ef86e32 | 1061 | swig_sources, |
1fded56b | 1062 | |
3ef86e32 | 1063 | include_dirs = includes, |
d56cebe7 RD |
1064 | define_macros = defines, |
1065 | ||
1066 | library_dirs = libdirs, | |
3ef86e32 | 1067 | libraries = libs + makeLibName('xrc'), |
d56cebe7 RD |
1068 | |
1069 | extra_compile_args = cflags, | |
1070 | extra_link_args = lflags, | |
1071 | ) | |
1072 | ||
1073 | wxpExtensions.append(ext) | |
1074 | ||
1075 | ||
1076 | ||
ebf4302c RD |
1077 | #---------------------------------------------------------------------- |
1078 | # Define the GIZMOS extension module | |
1079 | #---------------------------------------------------------------------- | |
1080 | ||
1e4a197e | 1081 | if BUILD_GIZMOS: |
ebf4302c RD |
1082 | msg('Preparing GIZMOS...') |
1083 | location = 'contrib/gizmos' | |
ebf4302c | 1084 | |
d14a1e28 | 1085 | swig_sources = run_swig(['gizmos.i'], location, '', PKGDIR, |
10ef30eb | 1086 | USE_SWIG, swig_force, swig_args, swig_deps) |
ebf4302c | 1087 | |
d14a1e28 | 1088 | ext = Extension('_gizmos', |
d84a9306 | 1089 | [ '%s/treelistctrl.cpp' % location ] + swig_sources, |
ebf4302c | 1090 | |
3ef86e32 | 1091 | include_dirs = includes, |
ebf4302c RD |
1092 | define_macros = defines, |
1093 | ||
1094 | library_dirs = libdirs, | |
3ef86e32 | 1095 | libraries = libs + makeLibName('gizmos'), |
ebf4302c RD |
1096 | |
1097 | extra_compile_args = cflags, | |
1098 | extra_link_args = lflags, | |
1099 | ) | |
1100 | ||
1101 | wxpExtensions.append(ext) | |
1102 | ||
1103 | ||
1104 | ||
4a61305d RD |
1105 | #---------------------------------------------------------------------- |
1106 | # Define the DLLWIDGET extension module | |
1107 | #---------------------------------------------------------------------- | |
1108 | ||
1e4a197e | 1109 | if BUILD_DLLWIDGET: |
4a61305d RD |
1110 | msg('Preparing DLLWIDGET...') |
1111 | location = 'contrib/dllwidget' | |
1112 | swig_files = ['dllwidget_.i'] | |
1113 | ||
1114 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 1115 | USE_SWIG, swig_force, swig_args, swig_deps) |
4a61305d RD |
1116 | |
1117 | # copy a contrib project specific py module to the main package dir | |
1118 | copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0) | |
1119 | ||
1120 | ext = Extension('dllwidget_c', [ | |
1121 | '%s/dllwidget.cpp' % location, | |
1122 | ] + swig_sources, | |
1123 | ||
1124 | include_dirs = includes, | |
1125 | define_macros = defines, | |
1126 | ||
1127 | library_dirs = libdirs, | |
1128 | libraries = libs, | |
1129 | ||
1130 | extra_compile_args = cflags, | |
1131 | extra_link_args = lflags, | |
1132 | ) | |
1133 | ||
1134 | wxpExtensions.append(ext) | |
1135 | ||
1136 | ||
1e4a197e RD |
1137 | |
1138 | ||
1139 | #---------------------------------------------------------------------- | |
1140 | # Tools and scripts | |
1141 | #---------------------------------------------------------------------- | |
8916d007 | 1142 | |
2eb31f8b RD |
1143 | if NO_SCRIPTS: |
1144 | SCRIPTS = None | |
1145 | else: | |
1e4a197e RD |
1146 | SCRIPTS = [opj('scripts/helpviewer'), |
1147 | opj('scripts/img2png'), | |
2eb31f8b RD |
1148 | opj('scripts/img2xpm'), |
1149 | opj('scripts/img2py'), | |
1150 | opj('scripts/xrced'), | |
1151 | opj('scripts/pyshell'), | |
1152 | opj('scripts/pycrust'), | |
1fded56b RD |
1153 | opj('scripts/pywrap'), |
1154 | opj('scripts/pywrap'), | |
1155 | opj('scripts/pyalacarte'), | |
1156 | opj('scripts/pyalamode'), | |
2eb31f8b | 1157 | ] |
4a61305d | 1158 | |
926bb76c | 1159 | |
1fded56b RD |
1160 | DATA_FILES += find_data_files('wxPython/tools/XRCed', '*.txt', '*.xrc') |
1161 | DATA_FILES += find_data_files('wxPython/py', '*.txt', '*.ico', '*.css', '*.html') | |
1162 | DATA_FILES += find_data_files('wx', '*.txt', '*.css', '*.html') | |
1e4a197e RD |
1163 | |
1164 | ||
c368d904 RD |
1165 | #---------------------------------------------------------------------- |
1166 | # Do the Setup/Build/Install/Whatever | |
1167 | #---------------------------------------------------------------------- | |
1168 | ||
1b62f00d | 1169 | if __name__ == "__main__": |
1e4a197e | 1170 | if not PREP_ONLY: |
d14a1e28 | 1171 | setup(name = 'wxPython', |
1b62f00d RD |
1172 | version = VERSION, |
1173 | description = DESCRIPTION, | |
1174 | long_description = LONG_DESCRIPTION, | |
1175 | author = AUTHOR, | |
1176 | author_email = AUTHOR_EMAIL, | |
1177 | url = URL, | |
851d4ac7 | 1178 | download_url = DOWNLOAD_URL, |
e2e02194 | 1179 | license = LICENSE, |
851d4ac7 RD |
1180 | platforms = PLATFORMS, |
1181 | classifiers = filter(None, CLASSIFIERS.split("\n")), | |
1182 | keywords = KEYWORDS, | |
d14a1e28 | 1183 | |
1fded56b RD |
1184 | packages = ['wxPython', |
1185 | 'wxPython.lib', | |
1186 | 'wxPython.lib.colourchooser', | |
1187 | 'wxPython.lib.editor', | |
1188 | 'wxPython.lib.mixins', | |
1fded56b | 1189 | 'wxPython.tools', |
1fded56b RD |
1190 | |
1191 | 'wx', | |
1192 | 'wx.lib', | |
1193 | 'wx.lib.colourchooser', | |
1194 | 'wx.lib.editor', | |
1195 | 'wx.lib.mixins', | |
1196 | 'wx.py', | |
d14a1e28 | 1197 | 'wx.py.wxd', |
1fded56b RD |
1198 | 'wx.tools', |
1199 | 'wx.tools.XRCed', | |
1b62f00d RD |
1200 | ], |
1201 | ||
1202 | ext_package = PKGDIR, | |
1203 | ext_modules = wxpExtensions, | |
8916d007 | 1204 | |
f6f98ecc | 1205 | options = { 'build' : { 'build_base' : BUILD_BASE }}, |
a541c325 | 1206 | |
b817523b | 1207 | scripts = SCRIPTS, |
c368d904 | 1208 | |
1e4a197e RD |
1209 | cmdclass = { 'install_data': smart_install_data}, |
1210 | data_files = DATA_FILES, | |
8916d007 | 1211 | |
1b62f00d | 1212 | ) |
c368d904 | 1213 | |
c368d904 | 1214 | |
c368d904 RD |
1215 | #---------------------------------------------------------------------- |
1216 | #---------------------------------------------------------------------- |