Mercurial > pygame
annotate dll.py @ 3182:0c07af110477 docs-changes
Ignore Sphinx-generated files
| author | Thomas Kluyver <takowl@gmail.com> |
|---|---|
| date | Wed, 09 Jan 2013 22:35:43 +0000 |
| parents | db7447dd124d |
| children |
| rev | line source |
|---|---|
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
1 # dll.py module |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
2 |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
3 """DLL specifics |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
4 |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
5 Configured for the Pygame 1.9.0 dependencies as built by msys_build_deps.py. |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
6 """ |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
7 |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
8 # Some definitions: |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
9 # Library name (name): An internal identifier, a string, for a library. |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
10 # e.g. FONT |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
11 # Library file root (root): The library root used in linker -l options. |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
12 # e.g. SDL_mixer |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
13 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
14 import re |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
15 |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
16 # Table of dependencies. |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
17 # name, root, File regex, Dependency list of names |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
18 libraries = [ |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
19 ('MIXER', 'SDL_mixer', r'SDL_mixer\.dll$', |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
20 ['SDL', 'VORBISFILE', 'SMPEG']), |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
21 ('VORBISFILE', 'vorbisfile', r'libvorbisfile-3\.dll$', |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
22 ['VORBIS']), |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
23 ('VORBIS', 'vorbis', r'libvorbis-0\.dll$', ['OGG']), |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
24 ('OGG', 'ogg', r'libogg-0\.dll$', []), |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
25 ('SMPEG', 'smpeg', r'smpeg\.dll$', ['SDL']), |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
26 ('IMAGE', 'SDL_image', r'SDL_image\.dll$', |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
27 ['SDL', 'JPEG', 'PNG', 'TIFF']), |
|
2047
db7447dd124d
update Windows dependencies to the latest libraries
Lenard Lindstrom <len-l@telus.net>
parents:
2043
diff
changeset
|
28 ('TIFF', 'tiff', r'libtiff-3\.dll$', ['JPEG', 'Z']), |
|
db7447dd124d
update Windows dependencies to the latest libraries
Lenard Lindstrom <len-l@telus.net>
parents:
2043
diff
changeset
|
29 ('JPEG', 'jpeg', r'libjpeg-8\.dll$', []), |
|
db7447dd124d
update Windows dependencies to the latest libraries
Lenard Lindstrom <len-l@telus.net>
parents:
2043
diff
changeset
|
30 ('PNG', 'png', r'libpng14\.dll$', ['Z']), |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
31 ('FONT', 'SDL_ttf', r'SDL_ttf\.dll$', ['SDL']), |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
32 ('FREETYPE', 'freetype', r'libfreetype-6\.dll$', ['Z']), |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
33 ('Z', 'z', r'zlib1\.dll$', []), |
|
1395
6ac8784bad26
Add portmidi to Windows build
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
34 ('SDL', 'SDL', r'SDL\.dll$', []), |
|
6ac8784bad26
Add portmidi to Windows build
Lenard Lindstrom <len-l@telus.net>
parents:
1357
diff
changeset
|
35 ('PORTMIDI', 'portmidi', r'portmidi\.dll', []), |
|
1481
3749a39d2780
Updated msys config to use a fake PORTTIME variable... so it builds again with mingw.
Rene Dudfield <renesd@gmail.com>
parents:
1395
diff
changeset
|
36 ('PORTTIME', 'portmidi', r'portmidi\.dll', []), |
|
2043
eee637420432
Update Windows dependencies build for MinGW GCC 4.5.0.
Lenard Lindstrom <len-l@telus.net>
parents:
1935
diff
changeset
|
37 ('AVCODEC', 'avcodec', r'avcodec-52\.dll', ['AVUTIL', 'Z']), |
|
eee637420432
Update Windows dependencies build for MinGW GCC 4.5.0.
Lenard Lindstrom <len-l@telus.net>
parents:
1935
diff
changeset
|
38 ('AVFORMAT', 'avformat', r'avformat-52\.dll', ['AVCODEC', 'AVUTIL', 'Z']), |
|
eee637420432
Update Windows dependencies build for MinGW GCC 4.5.0.
Lenard Lindstrom <len-l@telus.net>
parents:
1935
diff
changeset
|
39 ('AVUTIL', 'avutil', r'avutil-50\.dll', []), |
|
eee637420432
Update Windows dependencies build for MinGW GCC 4.5.0.
Lenard Lindstrom <len-l@telus.net>
parents:
1935
diff
changeset
|
40 ('SWSCALE', 'swscale', r'swscale-0\.dll', ['AVUTIL']), |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
41 ] |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
42 |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
43 # regexs: Maps name to DLL file name regex. |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
44 # lib_dependencies: Maps name to list of dependencies. |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
45 # file_root_names: Maps name to root. |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
46 |
|
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
47 regexs = {} |
|
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
48 lib_dependencies = {} |
|
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
49 file_root_names = {} |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
50 for name, root, ignore1, ignore2 in libraries: |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
51 file_root_names[name] = root |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
52 for name, root, regex, deps in libraries: |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
53 regexs[name] = regex |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
54 lib_dependencies[root] = [file_root_names[d] for d in deps] |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
55 del name, root, regex, deps, ignore1, ignore2 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
56 |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
57 def tester(name): |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
58 """For a library name return a function which tests dll file names""" |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
59 |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
60 def test(file_name): |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
61 """Return true if file name f is a valid DLL name""" |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
62 |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
63 return match(file_name) is not None |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
64 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
65 match = re.compile(regexs[name], re.I).match |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
66 test.library_name = name # Available for debugging. |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
67 return test |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
diff
changeset
|
68 |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
69 def name_to_root(name): |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
70 """Return the library file root for the library name""" |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
71 |
|
907
2d530d8fe54f
In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents:
892
diff
changeset
|
72 return file_root_names[name] |
|
1357
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
73 |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
74 def libraries(name): |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
75 """Return the library file roots this library links too""" |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
76 |
|
49fce47e4d56
Updated Windows config modules
Lenard Lindstrom <len-l@telus.net>
parents:
1352
diff
changeset
|
77 return lib_dependencies[name_to_root(name)] |
