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