Mercurial > pygame
annotate config_win.py @ 3172:d1b367fc08bc tests-returncode
Use a return code of 1 when the tests fail.
| author | Thomas Kluyver <takowl@gmail.com> |
|---|---|
| date | Wed, 09 Jan 2013 10:13:57 +0000 |
| parents | ecec7d7c1642 |
| children |
| rev | line source |
|---|---|
| 26 | 1 """Config on Windows""" |
| 2 | |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
3 # **** The search part is broken. For instance, the png Visual Studio project |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
4 # places to dll in a directory not checked by this module. |
|
1353
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
5 |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
6 from setup_win_common import get_definitions |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
7 |
| 440 | 8 import os, sys |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
9 import re |
| 26 | 10 from glob import glob |
| 359 | 11 from distutils.sysconfig import get_python_inc |
| 26 | 12 |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
13 try: |
|
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
14 raw_input |
|
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
15 except NameError: |
|
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
16 raw_input = input |
|
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
17 |
| 50 | 18 huntpaths = ['..', '..\\..', '..\\*', '..\\..\\*'] |
| 26 | 19 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
20 |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
21 class Dependency(object): |
| 26 | 22 inc_hunt = ['include'] |
| 1359 | 23 lib_hunt = ['VisualC\\SDL\\Release', 'VisualC\\Release', 'Release', 'lib'] |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
24 def __init__(self, name, wildcards, libs=None, required = 0): |
|
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
25 if libs is None: |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
26 libs = [] |
| 26 | 27 self.name = name |
|
807
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
28 self.wildcards = wildcards |
| 26 | 29 self.required = required |
| 30 self.paths = [] | |
| 31 self.path = None | |
| 32 self.inc_dir = None | |
| 33 self.lib_dir = None | |
|
807
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
34 self.libs = libs |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
35 self.found = False |
| 50 | 36 self.cflags = '' |
| 26 | 37 |
| 38 def hunt(self): | |
| 39 parent = os.path.abspath('..') | |
| 40 for p in huntpaths: | |
|
807
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
41 for w in self.wildcards: |
|
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
42 found = glob(os.path.join(p, w)) |
|
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
43 found.sort() or found.reverse() #reverse sort |
|
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
44 for f in found: |
|
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
45 if f[:5] == '..'+os.sep+'..' and \ |
|
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
46 os.path.abspath(f)[:len(parent)] == parent: |
|
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
47 continue |
|
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
48 if os.path.isdir(f): |
|
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
49 self.paths.append(f) |
| 26 | 50 |
| 51 def choosepath(self): | |
| 52 if not self.paths: | |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
53 print ("Path for %s not found." % self.name) |
|
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
54 if self.required: |
|
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
55 print ('Too bad that is a requirement! Hand-fix the "Setup"') |
| 26 | 56 elif len(self.paths) == 1: |
| 57 self.path = self.paths[0] | |
|
1935
ecec7d7c1642
Merged tylerthemovie branch changes r2168:2614 into the trunk
zeroth
parents:
1553
diff
changeset
|
58 print ("Path for %s:%s" % (self.name, self.path)) |
| 26 | 59 else: |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
60 print ("Select path for %s:" % self.name) |
| 26 | 61 for i in range(len(self.paths)): |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
62 print (" %i=%s" % (i + 1, self.paths[i])) |
|
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
63 print (" %i = <Nothing>" % 0) |
|
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
64 choice = raw_input("Select 0-%i (1=default):" % len(self.paths)) |
| 26 | 65 if not choice: choice = 1 |
| 66 else: choice = int(choice) | |
| 67 if(choice): | |
| 68 self.path = self.paths[choice-1] | |
| 69 | |
| 70 def findhunt(self, base, paths): | |
| 71 for h in paths: | |
| 72 hh = os.path.join(base, h) | |
| 73 if os.path.isdir(hh): | |
| 74 return hh.replace('\\', '/') | |
| 75 return base.replace('\\', '/') | |
| 76 | |
| 77 def configure(self): | |
| 78 self.hunt() | |
| 79 self.choosepath() | |
| 80 if self.path: | |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
81 self.found = True |
| 26 | 82 self.inc_dir = self.findhunt(self.path, Dependency.inc_hunt) |
| 83 self.lib_dir = self.findhunt(self.path, Dependency.lib_hunt) | |
| 84 | |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
85 |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
86 class DependencyPython(object): |
| 356 | 87 def __init__(self, name, module, header): |
| 88 self.name = name | |
| 89 self.lib_dir = '' | |
| 90 self.inc_dir = '' | |
|
807
3b0f4ccf23c4
Patches from Marcus for scrap. This gets windows bitmap support working.
Rene Dudfield <renesd@gmail.com>
parents:
440
diff
changeset
|
91 self.libs = [] |
| 356 | 92 self.cflags = '' |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
93 self.found = False |
| 356 | 94 self.ver = '0' |
| 95 self.module = module | |
| 96 self.header = header | |
| 97 | |
| 359 | 98 def configure(self): |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
99 self.found = True |
| 356 | 100 if self.module: |
| 101 try: | |
| 102 self.ver = __import__(self.module).__version__ | |
| 103 except ImportError: | |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
104 self.found = False |
| 356 | 105 if self.found and self.header: |
| 106 fullpath = os.path.join(get_python_inc(0), self.header) | |
| 107 if not os.path.isfile(fullpath): | |
| 108 found = 0 | |
| 109 else: | |
| 110 self.inc_dir = os.path.split(fullpath)[0] | |
| 111 if self.found: | |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
112 print ("%-8.8s: found %s" % (self.name, self.ver)) |
| 356 | 113 else: |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
114 print ("%-8.8s: not found" % self.name) |
| 356 | 115 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
116 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
117 class DependencyDLL(Dependency): |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
118 def __init__(self, dll_regex, lib=None, wildcards=None, libs=None, link=None): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
119 if lib is None: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
120 lib = link.libs[0] |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
121 Dependency.__init__(self, 'COPYLIB_' + lib, wildcards, libs) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
122 self.lib_name = lib |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
123 self.test = re.compile(dll_regex, re.I).match |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
124 self.lib_dir = '_' |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
125 self.found = True |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
126 self.link = link |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
127 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
128 def configure(self): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
129 if self.link is None and self.wildcards: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
130 self.hunt() |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
131 self.choosepath() |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
132 else: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
133 self.path = self.link.path |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
134 if self.path is not None: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
135 self.hunt_dll() |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
136 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
137 def hunt_dll(self): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
138 for dir in self.lib_hunt: |
| 1359 | 139 path = os.path.join(self.path, dir) |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
140 try: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
141 entries = os.listdir(path) |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
142 except: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
143 pass |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
144 else: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
145 for e in entries: |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
146 if self.test(e) and os.path.isfile(os.path.join(path, e)): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
147 # Found |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
148 self.lib_dir = os.path.join(path, e).replace('\\', '/') |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
149 print ("DLL for %s is %s" % (self.lib_name, self.lib_dir)) |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
150 return |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
151 print ("DLL for %s not found" % self.lib_name) |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
152 |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
153 class DependencyWin(object): |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
154 def __init__(self, name, cflags): |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
155 self.name = name |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
156 self.inc_dir = None |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
157 self.lib_dir = None |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
158 self.libs = [] |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
159 self.found = True |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
160 self.cflags = cflags |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
161 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
162 def configure(self): |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
163 pass |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
164 |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
165 class DependencyGroup(object): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
166 def __init__(self): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
167 self.dependencies =[] |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
168 self.dlls = [] |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
169 |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
170 def add(self, name, lib, wildcards, dll_regex, libs=None, required=0): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
171 if libs is None: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
172 libs = [] |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
173 dep = Dependency(name, wildcards, [lib], required) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
174 self.dependencies.append(dep) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
175 self.dlls.append(DependencyDLL(dll_regex, link=dep, libs=libs)) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
176 |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
177 def add_win(self, name, cflags): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
178 self.dependencies.append(DependencyWin(name, cflags)) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
179 |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
180 def add_dll(self, dll_regex, lib=None, wildcards=None, libs=None, link_lib=None): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
181 link = None |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
182 if link_lib is not None: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
183 name = 'COPYLIB_' + link_lib |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
184 for d in self.dlls: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
185 if d.name == name: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
186 link = d |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
187 break |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
188 else: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
189 raise KeyError("Link lib %s not found" % link_lib) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
190 self.dlls.append(DependencyDLL(dll_regex, lib, wildcards, libs, link)) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
191 |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
192 def configure(self): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
193 for d in self: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
194 d.configure() |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
195 |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
196 def __iter__(self): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
197 for d in self.dependencies: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
198 yield d |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
199 for d in self.dlls: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
200 yield d |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
201 |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
202 DEPS = DependencyGroup() |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
203 DEPS.add('SDL', 'SDL', ['SDL-[1-9].*'], r'(lib){0,1}SDL\.dll$', required=1) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
204 DEPS.add('FONT', 'SDL_ttf', ['SDL_ttf-[2-9].*'], r'(lib){0,1}SDL_ttf\.dll$', ['SDL', 'z']) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
205 DEPS.add('IMAGE', 'SDL_image', ['SDL_image-[1-9].*'], r'(lib){0,1}SDL_image\.dll$', |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
206 ['SDL', 'jpeg', 'png', 'tiff'], 0), |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
207 DEPS.add('MIXER', 'SDL_mixer', ['SDL_mixer-[1-9].*'], r'(lib){0,1}SDL_mixer\.dll$', |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
208 ['SDL', 'vorbisfile', 'smpeg']) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
209 DEPS.add('SMPEG', 'smpeg', ['smpeg-[0-9].*', 'smpeg'], r'smpeg\.dll$', ['SDL']) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
210 DEPS.add('PNG', 'png', ['libpng-[1-9].*'], r'(png|libpng13)\.dll$', ['z']) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
211 DEPS.add('JPEG', 'jpeg', ['jpeg-[6-9]*'], r'(lib){0,1}jpeg\.dll$') |
|
1395
6ac8784bad26
Add portmidi to Windows build
Lenard Lindstrom <len-l@telus.net>
parents:
1359
diff
changeset
|
212 DEPS.add('PORTMIDI', 'portmidi', ['portmidi'], r'portmidi\.dll$') |
|
1935
ecec7d7c1642
Merged tylerthemovie branch changes r2168:2614 into the trunk
zeroth
parents:
1553
diff
changeset
|
213 #DEPS.add('FFMPEG', 'libavformat/avformat.h', 'libavformat.a', ['avformat', 'swscale', 'SDL_mixer'], r'avformat-52\.dll') |
|
ecec7d7c1642
Merged tylerthemovie branch changes r2168:2614 into the trunk
zeroth
parents:
1553
diff
changeset
|
214 dep = Dependency('FFMPEG', [r'avformat\.dll', r'swscale\.dll', r'SDL_mixer-[1-9].*'], ['avformat', 'swscale', 'SDL_mixer'], required=0) |
|
ecec7d7c1642
Merged tylerthemovie branch changes r2168:2614 into the trunk
zeroth
parents:
1553
diff
changeset
|
215 DEPS.dependencies.append(dep) |
|
ecec7d7c1642
Merged tylerthemovie branch changes r2168:2614 into the trunk
zeroth
parents:
1553
diff
changeset
|
216 DEPS.dlls.append(DependencyDLL(r'avformat\.dll', link=dep, libs=['avformat'])) |
|
ecec7d7c1642
Merged tylerthemovie branch changes r2168:2614 into the trunk
zeroth
parents:
1553
diff
changeset
|
217 DEPS.dlls.append(DependencyDLL(r'swscale\.dll', link=dep, libs=['swscale'])) |
|
ecec7d7c1642
Merged tylerthemovie branch changes r2168:2614 into the trunk
zeroth
parents:
1553
diff
changeset
|
218 DEPS.dlls.append(DependencyDLL(r'(lib){0,1}SDL_mixer\.dll$', link=dep, libs=['SDL', 'vorbisfile', 'smpeg'])) |
|
1434
34ad777d3068
Added libporttime dependency, as required by ubuntu.
Rene Dudfield <renesd@gmail.com>
parents:
1395
diff
changeset
|
219 #DEPS.add('PORTTIME', 'porttime', ['porttime'], r'porttime\.dll$') |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
220 DEPS.add_dll(r'(lib){0,1}tiff\.dll$', 'tiff', ['tiff-[3-9].*'], ['jpeg', 'z']) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
221 DEPS.add_dll(r'(z|zlib1)\.dll$', 'z', ['zlib-[1-9].*']) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
222 DEPS.add_dll(r'(libvorbis-0|vorbis)\.dll$', 'vorbis', ['libvorbis-[1-9].*'], |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
223 ['ogg']) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
224 DEPS.add_dll(r'(libvorbisfile-3|vorbisfile)\.dll$', 'vorbisfile', |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
225 link_lib='vorbis', libs=['vorbis']) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
226 DEPS.add_dll(r'(libogg-0|ogg)\.dll$', 'ogg', ['libogg-[1-9].*']) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
227 for d in get_definitions(): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
228 DEPS.add_win(d.name, d.value) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
229 |
| 26 | 230 |
| 128 | 231 def setup_prebuilt(): |
| 232 setup = open('Setup', 'w') | |
|
1346
e02be9d3419f
Windows prebuilt configure uses optional prebuilt/Setup_Wihjkih;uihiuh
Lenard Lindstrom <len-l@telus.net>
parents:
916
diff
changeset
|
233 try: |
|
e02be9d3419f
Windows prebuilt configure uses optional prebuilt/Setup_Wihjkih;uihiuh
Lenard Lindstrom <len-l@telus.net>
parents:
916
diff
changeset
|
234 try: |
|
e02be9d3419f
Windows prebuilt configure uses optional prebuilt/Setup_Wihjkih;uihiuh
Lenard Lindstrom <len-l@telus.net>
parents:
916
diff
changeset
|
235 setup_win_in = open(os.path.join('prebuilt', 'Setup_Win.in')) |
|
e02be9d3419f
Windows prebuilt configure uses optional prebuilt/Setup_Wihjkih;uihiuh
Lenard Lindstrom <len-l@telus.net>
parents:
916
diff
changeset
|
236 except IOError: |
|
1440
78a9db8ceb20
remove old default Windows setup info
Lenard Lindstrom <len-l@telus.net>
parents:
1434
diff
changeset
|
237 raise IOError("prebuilt missing required Setup_Win.in") |
|
1353
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
238 |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
239 # Copy Setup.in to Setup, replacing the BeginConfig/EndConfig |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
240 # block with prebuilt\Setup_Win.in . |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
241 setup_in = open('Setup.in') |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
242 try: |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
243 do_copy = True |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
244 for line in setup_in: |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
245 if line.startswith('#--StartConfig'): |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
246 do_copy = False |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
247 setup.write(setup_win_in.read()) |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
248 try: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
249 setup_win_common_in = open('Setup_Win_Common.in') |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
250 except: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
251 pass |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
252 else: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
253 try: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
254 setup.write(setup_win_common_in.read()) |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
255 finally: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
256 setup_win_common_in.close() |
|
1353
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
257 elif line.startswith('#--EndConfig'): |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
258 do_copy = True |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
259 elif do_copy: |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
260 setup.write(line) |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
261 finally: |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1351
diff
changeset
|
262 setup_in.close() |
|
1346
e02be9d3419f
Windows prebuilt configure uses optional prebuilt/Setup_Wihjkih;uihiuh
Lenard Lindstrom <len-l@telus.net>
parents:
916
diff
changeset
|
263 finally: |
|
e02be9d3419f
Windows prebuilt configure uses optional prebuilt/Setup_Wihjkih;uihiuh
Lenard Lindstrom <len-l@telus.net>
parents:
916
diff
changeset
|
264 setup.close() |
|
e02be9d3419f
Windows prebuilt configure uses optional prebuilt/Setup_Wihjkih;uihiuh
Lenard Lindstrom <len-l@telus.net>
parents:
916
diff
changeset
|
265 |
| 26 | 266 |
| 267 def main(): | |
| 50 | 268 if os.path.isdir('prebuilt'): |
| 1359 | 269 reply = raw_input('\nUse the SDL libraries in "prebuilt"? [Y/n]') |
| 123 | 270 if not reply or reply[0].lower() != 'n': |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
271 setup_prebuilt() |
| 1359 | 272 raise SystemExit() |
| 50 | 273 |
| 123 | 274 global DEPS |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
275 |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
276 DEPS.configure() |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1353
diff
changeset
|
277 return list(DEPS) |
| 26 | 278 |
| 279 if __name__ == '__main__': | |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
280 print ("""This is the configuration subscript for Windows. |
|
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1440
diff
changeset
|
281 Please run "config.py" for full configuration.""") |
| 26 | 282 |
