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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
1 """Config on Windows"""
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
2d06a1067faf config cleanups
pygame
parents: 359
diff changeset
8 import os, sys
1357
49fce47e4d56 Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents: 1353
diff changeset
9 import re
26
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
10 from glob import glob
359
86649d342371 cleanups, especially for win32
pygame
parents: 356
diff changeset
11 from distutils.sysconfig import get_python_inc
26
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
fb807c52437f surfarray cleanups
pygame
parents: 40
diff changeset
18 huntpaths = ['..', '..\\..', '..\\*', '..\\..\\*']
26
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
22 inc_hunt = ['include']
1359
4dced9107770 Undo revision 1703
Lenard Lindstrom <len-l@telus.net>
parents: 1358
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
29 self.required = required
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
30 self.paths = []
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
31 self.path = None
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
32 self.inc_dir = None
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
fb807c52437f surfarray cleanups
pygame
parents: 40
diff changeset
36 self.cflags = ''
26
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
37
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
38 def hunt(self):
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
39 parent = os.path.abspath('..')
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
50
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
51 def choosepath(self):
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
56 elif len(self.paths) == 1:
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
65 if not choice: choice = 1
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
66 else: choice = int(choice)
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
67 if(choice):
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
68 self.path = self.paths[choice-1]
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
69
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
70 def findhunt(self, base, paths):
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
71 for h in paths:
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
72 hh = os.path.join(base, h)
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
73 if os.path.isdir(hh):
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
74 return hh.replace('\\', '/')
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
75 return base.replace('\\', '/')
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
76
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
77 def configure(self):
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
78 self.hunt()
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
79 self.choosepath()
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
82 self.inc_dir = self.findhunt(self.path, Dependency.inc_hunt)
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
83 self.lib_dir = self.findhunt(self.path, Dependency.lib_hunt)
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
87 def __init__(self, name, module, header):
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
88 self.name = name
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
89 self.lib_dir = ''
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
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
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
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
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
94 self.ver = '0'
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
95 self.module = module
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
96 self.header = header
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
97
359
86649d342371 cleanups, especially for win32
pygame
parents: 356
diff changeset
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
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
100 if self.module:
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
101 try:
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
102 self.ver = __import__(self.module).__version__
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
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
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
105 if self.found and self.header:
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
106 fullpath = os.path.join(get_python_inc(0), self.header)
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
107 if not os.path.isfile(fullpath):
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
108 found = 0
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
109 else:
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
110 self.inc_dir = os.path.split(fullpath)[0]
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
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
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
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
e881b3e4f886 big config.py update
pygame
parents: 238
diff changeset
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
4dced9107770 Undo revision 1703
Lenard Lindstrom <len-l@telus.net>
parents: 1358
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
230
128
44cc5545bd15 setup maintenance
pygame
parents: 123
diff changeset
231 def setup_prebuilt():
44cc5545bd15 setup maintenance
pygame
parents: 123
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
266
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
267 def main():
50
fb807c52437f surfarray cleanups
pygame
parents: 40
diff changeset
268 if os.path.isdir('prebuilt'):
1359
4dced9107770 Undo revision 1703
Lenard Lindstrom <len-l@telus.net>
parents: 1358
diff changeset
269 reply = raw_input('\nUse the SDL libraries in "prebuilt"? [Y/n]')
123
19d600d70996 preparing for 1.0
pygame
parents: 50
diff changeset
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
4dced9107770 Undo revision 1703
Lenard Lindstrom <len-l@telus.net>
parents: 1358
diff changeset
272 raise SystemExit()
50
fb807c52437f surfarray cleanups
pygame
parents: 40
diff changeset
273
123
19d600d70996 preparing for 1.0
pygame
parents: 50
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
278
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
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
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents:
diff changeset
282