annotate setup.py @ 1849:301bc61643a9 math_module

merged changes from trunk
author lorenz
date Mon, 16 Nov 2009 18:31:40 +0000
parents 02c1e8e9c102
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
99d32cc487b7 Initial revision
ahvezda
parents:
diff changeset
1 #!/usr/bin/env python
99d32cc487b7 Initial revision
ahvezda
parents:
diff changeset
2 #
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
3 # This is the distutils setup script for pygame.
359
86649d342371 cleanups, especially for win32
pygame
parents: 358
diff changeset
4 # Full instructions are in "install.txt" or "install.html"
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
5 #
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
6 # To configure, compile, install, just run this script.
26
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents: 25
diff changeset
7
130
7044c4ec15c0 config cleanup
pygame
parents: 129
diff changeset
8 DESCRIPTION = """Pygame is a Python wrapper module for the
7044c4ec15c0 config cleanup
pygame
parents: 129
diff changeset
9 SDL multimedia library. It contains python functions and classes
7044c4ec15c0 config cleanup
pygame
parents: 129
diff changeset
10 that will allow you to use SDL's support for playing cdroms,
286
90088442a01d small quickies to 1.3.1
pygame
parents: 285
diff changeset
11 audio and video output, and keyboard, mouse and joystick input."""
130
7044c4ec15c0 config cleanup
pygame
parents: 129
diff changeset
12
750
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
13 EXTRAS = {}
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
14
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
15 METADATA = {
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
16 "name": "pygame",
1849
301bc61643a9 merged changes from trunk
lorenz
parents: 1839
diff changeset
17 "version": "1.9.2pre",
130
7044c4ec15c0 config cleanup
pygame
parents: 129
diff changeset
18 "license": "LGPL",
178
efa429ee9486 updated url
pygame
parents: 161
diff changeset
19 "url": "http://www.pygame.org",
942
249b34b34fe1 Updated version strings for 1.8.0rc4.
Rene Dudfield <renesd@gmail.com>
parents: 938
diff changeset
20 "author": "Pete Shinners, Rene Dudfield, Marcus von Appen, Bob Pendleton, others...",
302
2137ff888dfd massive update for osx support
pygame
parents: 301
diff changeset
21 "author_email": "pygame@seul.org",
286
90088442a01d small quickies to 1.3.1
pygame
parents: 285
diff changeset
22 "description": "Python Game Development",
130
7044c4ec15c0 config cleanup
pygame
parents: 129
diff changeset
23 "long_description": DESCRIPTION,
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
24 }
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
25
497
b8cded4c6f71 remove old python support
pygame
parents: 495
diff changeset
26 import sys
961
e4f6ffb96c2d making it easy to build with bdist_msi
brian
parents: 945
diff changeset
27
e4f6ffb96c2d making it easy to build with bdist_msi
brian
parents: 945
diff changeset
28 if "bdist_msi" in sys.argv:
1049
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
29 # hack the version name to a format msi doesn't have trouble with
1021
ad24068d6596 fixed msi fix
Lenard Lindstrom <len-l@telus.net>
parents: 1017
diff changeset
30 METADATA["version"] = METADATA["version"].replace("pre", "a0")
ad24068d6596 fixed msi fix
Lenard Lindstrom <len-l@telus.net>
parents: 1017
diff changeset
31 METADATA["version"] = METADATA["version"].replace("rc", "b0")
1253
ff76bfd3769f Bug fix for setup.py for release distribution
Lenard Lindstrom <len-l@telus.net>
parents: 1252
diff changeset
32 METADATA["version"] = METADATA["version"].replace("release", "")
961
e4f6ffb96c2d making it easy to build with bdist_msi
brian
parents: 945
diff changeset
33
1017
efc0a362fb05 test requiring python 2.3 not 2.2. Also try and fix msi setup issue.
Rene Dudfield <renesd@gmail.com>
parents: 999
diff changeset
34
efc0a362fb05 test requiring python 2.3 not 2.2. Also try and fix msi setup issue.
Rene Dudfield <renesd@gmail.com>
parents: 999
diff changeset
35 if not hasattr(sys, 'version_info') or sys.version_info < (2,3):
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
36 raise SystemExit("Pygame requires Python version 2.3 or above.")
26
6c23d683c30f ready for 0.3 (need more testing on new config.py)
pygame
parents: 25
diff changeset
37
161
69af47aa729b setup works from correct directory
pygame
parents: 159
diff changeset
38 #get us to the correct directory
69af47aa729b setup works from correct directory
pygame
parents: 159
diff changeset
39 import os, sys
69af47aa729b setup works from correct directory
pygame
parents: 159
diff changeset
40 path = os.path.split(os.path.abspath(sys.argv[0]))[0]
69af47aa729b setup works from correct directory
pygame
parents: 159
diff changeset
41 os.chdir(path)
813
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
42 #os.environ["CFLAGS"] = "-W -Wall -Wpointer-arith -Wcast-qual -Winline " + \
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
43 # "-Wcast-align -Wconversion -Wstrict-prototypes " + \
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
44 # "-Wmissing-prototypes -Wmissing-declarations " + \
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
45 # "-Wnested-externs -Wshadow -Wredundant-decls"
818
a9bcb71c8b86 from marcus: fixes a scrap pointer issue for X11
Rene Dudfield <renesd@gmail.com>
parents: 813
diff changeset
46 if "-warnings" in sys.argv:
813
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
47 os.environ["CFLAGS"] = "-W -Wimplicit-int " + \
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
48 "-Wimplicit-function-declaration " + \
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
49 "-Wimplicit -Wmain -Wreturn-type -Wunused -Wswitch " + \
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
50 "-Wcomment -Wtrigraphs -Wformat -Wchar-subscripts " + \
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
51 "-Wuninitialized -Wparentheses " +\
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
52 "-Wpointer-arith -Wcast-qual -Winline -Wcast-align " + \
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
53 "-Wconversion -Wstrict-prototypes " + \
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
54 "-Wmissing-prototypes -Wmissing-declarations " + \
fd421ea279ae Thanks Christopher Stone, John Myers, John Poppleweel, and Marcus!
Rene Dudfield <renesd@gmail.com>
parents: 793
diff changeset
55 "-Wnested-externs -Wshadow -Wredundant-decls"
818
a9bcb71c8b86 from marcus: fixes a scrap pointer issue for X11
Rene Dudfield <renesd@gmail.com>
parents: 813
diff changeset
56 sys.argv.remove ("-warnings")
133
12a2f6bf1bff setup scripts error properly pre python2.0
pygame
parents: 130
diff changeset
57
1044
6e1e6f7db6d6 Added a WARNING to tell you if Setup.in is newer than Setup.
Rene Dudfield <renesd@gmail.com>
parents: 1021
diff changeset
58 import os.path, glob, stat
469
482e96823aa7 ready for 1.5.6
pygame
parents: 437
diff changeset
59 import distutils.sysconfig
1411
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
60 from distutils.core import setup, Extension, Command
7
99d32cc487b7 Initial revision
ahvezda
parents:
diff changeset
61 from distutils.extension import read_setup_file
124
edea8c325aeb preparing for 1.0
pygame
parents: 123
diff changeset
62 from distutils.command.install_data import install_data
25
319acdc93c53 new liquid example, prep for 0.3
pygame
parents: 7
diff changeset
63
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
64 # Python 3.0 patch
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
65 if sys.version_info[0:2] == (3, 0):
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
66 import distutils.version
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
67 def _cmp(x, y):
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
68 try:
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
69 if x < y:
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
70 return -1
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
71 elif x == y:
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
72 return 0
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
73 return 1
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
74 except TypeError:
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
75 return NotImplemented
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
76 distutils.version.cmp = _cmp
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
77 del _cmp
1297
1022a539580d Added optional setuputils support with -setuputils option to setup.py
Rene Dudfield <renesd@gmail.com>
parents: 1255
diff changeset
78
1444
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
79 def add_datafiles(data_files, dest_dir, pattern):
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
80 """Add directory structures to data files according to a pattern"""
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
81 src_dir, elements = pattern
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
82 def do_directory(root_dest_path, root_src_path, elements):
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
83 files = []
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
84 for e in elements:
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
85 if isinstance(e, list):
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
86 src_dir, elems = e
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
87 dest_path = '/'.join([root_dest_path, src_dir])
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
88 src_path = os.path.join(root_src_path, src_dir)
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
89 do_directory(dest_path, src_path, elems)
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
90 else:
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
91 files.extend(glob.glob(os.path.join(root_src_path, e)))
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
92 if files:
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
93 data_files.append((root_dest_path, files))
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
94 do_directory(dest_dir, src_dir, elements)
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
95
1297
1022a539580d Added optional setuputils support with -setuputils option to setup.py
Rene Dudfield <renesd@gmail.com>
parents: 1255
diff changeset
96 # allow optionally using setuptools for bdist_egg.
1022a539580d Added optional setuputils support with -setuputils option to setup.py
Rene Dudfield <renesd@gmail.com>
parents: 1255
diff changeset
97 if "-setuptools" in sys.argv:
1022a539580d Added optional setuputils support with -setuputils option to setup.py
Rene Dudfield <renesd@gmail.com>
parents: 1255
diff changeset
98 from setuptools import setup, find_packages
1022a539580d Added optional setuputils support with -setuputils option to setup.py
Rene Dudfield <renesd@gmail.com>
parents: 1255
diff changeset
99 sys.argv.remove ("-setuptools")
1022a539580d Added optional setuputils support with -setuputils option to setup.py
Rene Dudfield <renesd@gmail.com>
parents: 1255
diff changeset
100
1022a539580d Added optional setuputils support with -setuputils option to setup.py
Rene Dudfield <renesd@gmail.com>
parents: 1255
diff changeset
101
1453
401c014117ad Removing PyObjC dependency
brian
parents: 1446
diff changeset
102 # NOTE: the bdist_mpkg_support is for darwin.
750
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
103 try:
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
104 import bdist_mpkg_support
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
105 from setuptools import setup, Extension
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
106 except ImportError:
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
107 pass
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
108 else:
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
109 EXTRAS.update({
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
110 'options': bdist_mpkg_support.options,
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
111 'setup_requires': ['bdist_mpkg>=0.4.2'],
945
c039e7a1e42b a note about what the bdist_mpkg_support is for.
Rene Dudfield <renesd@gmail.com>
parents: 942
diff changeset
112 #'install_requires': ['pyobjc'],
c039e7a1e42b a note about what the bdist_mpkg_support is for.
Rene Dudfield <renesd@gmail.com>
parents: 942
diff changeset
113 #'dependency_links': ['http://rene.f0o.com/~rene/stuff/macosx/']
750
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
114 })
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
115
7
99d32cc487b7 Initial revision
ahvezda
parents:
diff changeset
116 #headers to install
99d32cc487b7 Initial revision
ahvezda
parents:
diff changeset
117 headers = glob.glob(os.path.join('src', '*.h'))
892
859ceb5bb6fb Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents: 871
diff changeset
118 headers.remove(os.path.join('src', 'numeric_arrayobject.h'))
1330
67fd4fb4bf12 Allow the VC build of transform.c use the MMX/SSE enhanced smoothscale code.
Lenard Lindstrom <len-l@telus.net>
parents: 1297
diff changeset
119 headers.remove(os.path.join('src', 'scale.h'))
42
a072db70e063 0.4 release candidate
pygame
parents: 29
diff changeset
120
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
121 #sanity check for any arguments
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
122 if len(sys.argv) == 1:
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
123 reply = raw_input('\nNo Arguments Given, Perform Default Install? [Y/n]')
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
124 if not reply or reply[0].lower() != 'n':
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
125 sys.argv.append('install')
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
126
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
127
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
128 #make sure there is a Setup file
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
129 if not os.path.isfile('Setup'):
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
130 print ('\n\nWARNING, No "Setup" File Exists, Running "config.py"')
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
131 import config
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
132 config.main()
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
133 print ('\nContinuing With "setup.py"')
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
134
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
135
1044
6e1e6f7db6d6 Added a WARNING to tell you if Setup.in is newer than Setup.
Rene Dudfield <renesd@gmail.com>
parents: 1021
diff changeset
136 try:
6e1e6f7db6d6 Added a WARNING to tell you if Setup.in is newer than Setup.
Rene Dudfield <renesd@gmail.com>
parents: 1021
diff changeset
137 s_mtime = os.stat("Setup")[stat.ST_MTIME]
6e1e6f7db6d6 Added a WARNING to tell you if Setup.in is newer than Setup.
Rene Dudfield <renesd@gmail.com>
parents: 1021
diff changeset
138 sin_mtime = os.stat("Setup.in")[stat.ST_MTIME]
6e1e6f7db6d6 Added a WARNING to tell you if Setup.in is newer than Setup.
Rene Dudfield <renesd@gmail.com>
parents: 1021
diff changeset
139 if sin_mtime > s_mtime:
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
140 print ('\n\nWARNING, "Setup.in" newer than "Setup",'
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
141 'you might need to modify "Setup".')
1044
6e1e6f7db6d6 Added a WARNING to tell you if Setup.in is newer than Setup.
Rene Dudfield <renesd@gmail.com>
parents: 1021
diff changeset
142 except:
6e1e6f7db6d6 Added a WARNING to tell you if Setup.in is newer than Setup.
Rene Dudfield <renesd@gmail.com>
parents: 1021
diff changeset
143 pass
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
144
1453
401c014117ad Removing PyObjC dependency
brian
parents: 1446
diff changeset
145 # get compile info for all extensions
401c014117ad Removing PyObjC dependency
brian
parents: 1446
diff changeset
146 try:
401c014117ad Removing PyObjC dependency
brian
parents: 1446
diff changeset
147 extensions = read_setup_file('Setup')
401c014117ad Removing PyObjC dependency
brian
parents: 1446
diff changeset
148 except:
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
149 print ("""Error with the "Setup" file,
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
150 perhaps make a clean copy from "Setup.in".""")
1453
401c014117ad Removing PyObjC dependency
brian
parents: 1446
diff changeset
151 raise
7
99d32cc487b7 Initial revision
ahvezda
parents:
diff changeset
152
1578
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
153 #python 3.x: remove modules not yet ported
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
154 if sys.version_info >= (3, 0, 0):
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
155 python3_skip = ['scrap',
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
156 '_camera',
1849
301bc61643a9 merged changes from trunk
lorenz
parents: 1839
diff changeset
157 '_movie',
1578
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
158 '_numericsurfarray',
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
159 '_numericsndarray',
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
160 ]
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
161 tmp_extensions = extensions
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
162 extensions = []
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
163 for e in tmp_extensions:
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
164 if e.name in python3_skip:
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
165 print ("Skipping module %s for Python %s build." %
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
166 (e.name, sys.version))
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
167 else:
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
168 extensions.append(e)
c0d170c1e636 all standard modules build with Python 3.1. Optional movie module adapted. setup.py skips unsupported files for Python 3
Lenard Lindstrom <len-l@telus.net>
parents: 1553
diff changeset
169 del tmp_extensions
42
a072db70e063 0.4 release candidate
pygame
parents: 29
diff changeset
170
7
99d32cc487b7 Initial revision
ahvezda
parents:
diff changeset
171 #extra files to install
42
a072db70e063 0.4 release candidate
pygame
parents: 29
diff changeset
172 data_path = os.path.join(distutils.sysconfig.get_python_lib(), 'pygame')
1418
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1411
diff changeset
173 pygame_data_files = []
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1411
diff changeset
174 data_files = [('pygame', pygame_data_files)]
7
99d32cc487b7 Initial revision
ahvezda
parents:
diff changeset
175
1424
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
176 #add files in distribution directory
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
177 pygame_data_files.append('LGPL')
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
178 pygame_data_files.append('readme.html')
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
179 pygame_data_files.append('install.html')
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
180
29
ae12316035a9 default font added, all color args changed to RGBA
pygame
parents: 26
diff changeset
181 #add non .py files in lib directory
ae12316035a9 default font added, all color args changed to RGBA
pygame
parents: 26
diff changeset
182 for f in glob.glob(os.path.join('lib', '*')):
936
c0c62d452ea2 Fixed setup for python run_tests.py files.
marcus
parents: 916
diff changeset
183 if not f[-3:] == '.py' and not f[-4:] == '.doc' and os.path.isfile(f):
1418
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1411
diff changeset
184 pygame_data_files.append(f)
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1411
diff changeset
185
1444
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
186 #tests/fixtures
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
187 add_datafiles(data_files, 'pygame/tests',
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
188 ['test',
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
189 [['fixtures',
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
190 [['xbm_cursors',
1849
301bc61643a9 merged changes from trunk
lorenz
parents: 1839
diff changeset
191 ['*.xbm']],
301bc61643a9 merged changes from trunk
lorenz
parents: 1839
diff changeset
192 ['fonts',
301bc61643a9 merged changes from trunk
lorenz
parents: 1839
diff changeset
193 ['*.ttf', '*.otf']]]]]])
1422
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
194
1424
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
195 #examples
1444
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
196 add_datafiles(data_files, 'pygame/examples',
1422
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
197 ['examples',
1430
5b68e04fd7e7 update setup.py to reflect examples becoming a package
Lenard Lindstrom <len-l@telus.net>
parents: 1424
diff changeset
198 ['readme.txt',
1422
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
199 ['data',
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
200 ['*']],
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
201 ['macosx',
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
202 ['*.py',
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
203 ['aliens_app_example',
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
204 ['*.py',
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
205 'README.txt',
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
206 ['English.lproj',
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
207 ['aliens.icns',
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
208 ['MainMenu.nib',
7bed880318b2 pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents: 1418
diff changeset
209 ['*']]]]]]]]]])
29
ae12316035a9 default font added, all color args changed to RGBA
pygame
parents: 26
diff changeset
210
1424
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
211 #docs
1444
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
212 add_datafiles(data_files, 'pygame/docs',
1424
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
213 ['docs',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
214 ['*.html',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
215 '*.gif',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
216 ['ref',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
217 ['*.html']],
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
218 ['tut',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
219 ['*.html',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
220 ['chimp',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
221 ['*.html',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
222 '*.gif']],
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
223 ['intro',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
224 ['*.html',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
225 '*.gif',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
226 '*.jpg']],
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
227 ['surfarray',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
228 ['*.html',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
229 '*.jpg']],
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
230 ['tom',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
231 ['*.html',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
232 '*.png']]]]]])
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
233
1444
72cf09c63459 add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents: 1430
diff changeset
234 #required. This will be filled if doing a Windows build.
916
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
235 cmdclass = {}
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
236
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
237 #try to find DLLs and copy them too (only on windows)
7
99d32cc487b7 Initial revision
ahvezda
parents:
diff changeset
238 if sys.platform == 'win32':
585
d319548e5eed some fixes for building with mingw and msys on windows
Rene Dudfield <renesd@gmail.com>
parents: 578
diff changeset
239
916
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
240 from distutils.command.build_ext import build_ext
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
241 # mingw32distutils is optional. But we need the mingw32 compiler(s).
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
242 try:
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
243 # Allow the choice between Win32 GUI and console DLLs.
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
244 import mingw32distutils
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
245 except ImportError:
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
246 mingw32_compilers = ['ming32']
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
247 else:
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
248 mingw32_compilers = mingw32distutils.compilers
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
249 if sys.version_info < (2, 4):
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
250 try:
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
251 import config
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
252 # a separate method for finding dlls with mingw.
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
253 if config.is_msys_mingw():
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
254
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
255 # fix up the paths for msys compiling.
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
256 import distutils_mods
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
257 distutils.cygwinccompiler.Mingw32 = distutils_mods.mingcomp
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
258 except ImportError:
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
259 pass
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
260
892
859ceb5bb6fb Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents: 871
diff changeset
261 #add dependency DLLs to the project
1353
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
262 lib_dependencies = {}
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
263 for e in extensions:
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
264 if e.name.startswith('COPYLIB_'):
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
265 lib_dependencies[e.name[8:]] = e.libraries
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
266
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
267 def dependencies(roots):
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
268 """Return a set of dependencies for the list of library file roots
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
269
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
270 The return set is a dictionary keyed on library root name with values of 1.
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
271 """
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
272
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
273 root_set = {}
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
274 for root in roots:
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
275 try:
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
276 deps = lib_dependencies[root]
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
277 except KeyError:
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
278 pass
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
279 else:
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
280 root_set[root] = 1
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
281 root_set.update(dependencies(deps))
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
282 return root_set
585
d319548e5eed some fixes for building with mingw and msys on windows
Rene Dudfield <renesd@gmail.com>
parents: 578
diff changeset
283
892
859ceb5bb6fb Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents: 871
diff changeset
284 the_dlls = {}
859ceb5bb6fb Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents: 871
diff changeset
285 required_dlls = {}
859ceb5bb6fb Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents: 871
diff changeset
286 for e in extensions:
907
2d530d8fe54f In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents: 892
diff changeset
287 if e.name.startswith('COPYLIB_'):
1353
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
288 the_dlls[e.name[8:]] = e.library_dirs[0]
892
859ceb5bb6fb Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents: 871
diff changeset
289 else:
1353
98ea1dccb6a9 Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents: 1333
diff changeset
290 required_dlls.update(dependencies(e.libraries))
1388
cf53118ff192 the freetype dll was not being copied into the site-packages/pygame dir on windows
Rene Dudfield <renesd@gmail.com>
parents: 1353
diff changeset
291
cf53118ff192 the freetype dll was not being copied into the site-packages/pygame dir on windows
Rene Dudfield <renesd@gmail.com>
parents: 1353
diff changeset
292 # join the required_dlls and the_dlls keys together.
cf53118ff192 the freetype dll was not being copied into the site-packages/pygame dir on windows
Rene Dudfield <renesd@gmail.com>
parents: 1353
diff changeset
293 lib_names = {}
cf53118ff192 the freetype dll was not being copied into the site-packages/pygame dir on windows
Rene Dudfield <renesd@gmail.com>
parents: 1353
diff changeset
294 for lib in list(required_dlls.keys()) + list(the_dlls.keys()):
cf53118ff192 the freetype dll was not being copied into the site-packages/pygame dir on windows
Rene Dudfield <renesd@gmail.com>
parents: 1353
diff changeset
295 lib_names[lib] = 1
cf53118ff192 the freetype dll was not being copied into the site-packages/pygame dir on windows
Rene Dudfield <renesd@gmail.com>
parents: 1353
diff changeset
296
cf53118ff192 the freetype dll was not being copied into the site-packages/pygame dir on windows
Rene Dudfield <renesd@gmail.com>
parents: 1353
diff changeset
297 for lib in lib_names.keys():
892
859ceb5bb6fb Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents: 871
diff changeset
298 #next DLL; a distutils bug requires the paths to have Windows separators
859ceb5bb6fb Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents: 871
diff changeset
299 f = the_dlls[lib].replace('/', os.sep)
859ceb5bb6fb Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents: 871
diff changeset
300 if f == '_':
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
301 print ("WARNING, DLL for %s library not found." % lib)
892
859ceb5bb6fb Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents: 871
diff changeset
302 else:
1418
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1411
diff changeset
303 pygame_data_files.append(f)
585
d319548e5eed some fixes for building with mingw and msys on windows
Rene Dudfield <renesd@gmail.com>
parents: 578
diff changeset
304
916
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
305 class WinBuildExt(build_ext):
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
306 """This build_ext sets necessary environment variables for MinGW"""
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
307
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
308 # __sdl_lib_dir is possible location of msvcrt replacement import
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
309 # libraries, if they exist. Pygame module base only links to SDL so
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
310 # should have the SDL library directory as its only -L option.
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
311 for e in extensions:
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
312 if e.name == 'base':
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
313 __sdl_lib_dir = e.library_dirs[0].replace('/', os.sep)
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
314 break
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
315
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
316 def run(self):
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
317 """Extended to set MINGW_ROOT_DIRECTORY, PATH and LIBRARY_PATH"""
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
318
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
319 if self.compiler in mingw32_compilers:
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
320 # Add MinGW environment variables.
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
321 if 'MINGW_ROOT_DIRECTORY' not in os.environ:
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
322 # Use MinGW setup conifiguration file if present.
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
323 import mingwcfg
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
324 try:
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
325 mingw_root = mingwcfg.read()
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
326 except IOError:
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
327 raise RuntimeError(
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
328 "mingw32: required environment variable"
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
329 " MINGW_ROOT_DIRECTORY not set")
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
330 os.environ['MINGW_ROOT_DIRECTORY'] = mingw_root
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
331 path = os.environ['PATH']
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
332 os.environ['PATH'] = ';'.join([os.path.join(mingw_root, 'bin'),
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
333 path])
1251
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
334 if sys.version_info >= (2, 6):
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
335 # The Visual Studio 2008 C library is msvcr90.dll.
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
336 c_runtime_path = os.path.join(self.__sdl_lib_dir, 'msvcr90')
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
337 elif sys.version_info >= (2, 4):
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
338 # The Visual Studio 2003 C library is msvcr71.dll.
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
339 c_runtime_path = os.path.join(self.__sdl_lib_dir, 'msvcr71')
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
340 else:
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
341 # The Visual Studio 6.0 C library is msvcrt.dll,
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
342 # the MinGW default.
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
343 c_runtime_path = ''
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
344 if c_runtime_path and os.path.isdir(c_runtime_path):
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
345 # Override the default msvcrt.dll linkage.
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
346 os.environ['LIBRARY_PATH'] = c_runtime_path
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
347 elif not (c_runtime_path or
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
348 glob.glob(os.path.join(self.__sdl_lib_dir,
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
349 'msvcr*'))):
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
350 pass
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
351 else:
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
352 raise RuntimeError("The dependencies are linked to"
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
353 " the wrong C runtime for"
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
354 " Python %i.%i" %
beb37bb62fb0 Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents: 1246
diff changeset
355 sys.version_info[:2])
916
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
356 build_ext.run(self)
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
357 cmdclass['build_ext'] = WinBuildExt
8a7d9b2de067 MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents: 907
diff changeset
358
1330
67fd4fb4bf12 Allow the VC build of transform.c use the MMX/SSE enhanced smoothscale code.
Lenard Lindstrom <len-l@telus.net>
parents: 1297
diff changeset
359 # Add the precompiled smooth scale MMX functions to transform.
1333
1ed215141bdd Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents: 1331
diff changeset
360 def replace_scale_mmx():
1ed215141bdd Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents: 1331
diff changeset
361 for e in extensions:
1ed215141bdd Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents: 1331
diff changeset
362 if e.name == 'transform':
1ed215141bdd Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents: 1331
diff changeset
363 e.extra_objects.append(
1ed215141bdd Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents: 1331
diff changeset
364 os.path.join('obj', 'win32', 'scale_mmx.obj'))
1ed215141bdd Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents: 1331
diff changeset
365 for i in range(len(e.sources)):
1ed215141bdd Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents: 1331
diff changeset
366 if e.sources[i].endswith('scale_mmx.c'):
1ed215141bdd Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents: 1331
diff changeset
367 del e.sources[i]
1ed215141bdd Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents: 1331
diff changeset
368 return
1849
301bc61643a9 merged changes from trunk
lorenz
parents: 1839
diff changeset
369 # linking to 64-bit mingw generated scale_mmx.obj fails
301bc61643a9 merged changes from trunk
lorenz
parents: 1839
diff changeset
370 if not '64 bit' in sys.version:
301bc61643a9 merged changes from trunk
lorenz
parents: 1839
diff changeset
371 replace_scale_mmx()
7
99d32cc487b7 Initial revision
ahvezda
parents:
diff changeset
372
42
a072db70e063 0.4 release candidate
pygame
parents: 29
diff changeset
373
129
3a0255271ede config cleanup
pygame
parents: 127
diff changeset
374 #clean up the list of extensions
3a0255271ede config cleanup
pygame
parents: 127
diff changeset
375 for e in extensions[:]:
907
2d530d8fe54f In build process merged Setup.in and Setup_win.in
Lenard Lindstrom <len-l@telus.net>
parents: 892
diff changeset
376 if e.name.startswith('COPYLIB_'):
129
3a0255271ede config cleanup
pygame
parents: 127
diff changeset
377 extensions.remove(e) #don't compile the COPYLIBs, just clean them
3a0255271ede config cleanup
pygame
parents: 127
diff changeset
378 else:
3a0255271ede config cleanup
pygame
parents: 127
diff changeset
379 e.name = 'pygame.' + e.name #prepend package name on modules
469
482e96823aa7 ready for 1.5.6
pygame
parents: 437
diff changeset
380
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
381
124
edea8c325aeb preparing for 1.0
pygame
parents: 123
diff changeset
382 #data installer with improved intelligence over distutils
edea8c325aeb preparing for 1.0
pygame
parents: 123
diff changeset
383 #data files are copied into the project directory instead
edea8c325aeb preparing for 1.0
pygame
parents: 123
diff changeset
384 #of willy-nilly
469
482e96823aa7 ready for 1.5.6
pygame
parents: 437
diff changeset
385 class smart_install_data(install_data):
124
edea8c325aeb preparing for 1.0
pygame
parents: 123
diff changeset
386 def run(self):
359
86649d342371 cleanups, especially for win32
pygame
parents: 358
diff changeset
387 #need to change self.install_dir to the actual library dir
124
edea8c325aeb preparing for 1.0
pygame
parents: 123
diff changeset
388 install_cmd = self.get_finalized_command('install')
edea8c325aeb preparing for 1.0
pygame
parents: 123
diff changeset
389 self.install_dir = getattr(install_cmd, 'install_lib')
edea8c325aeb preparing for 1.0
pygame
parents: 123
diff changeset
390 return install_data.run(self)
edea8c325aeb preparing for 1.0
pygame
parents: 123
diff changeset
391
938
a787fef11a25 small repairs for MinGW build
Lenard Lindstrom <len-l@telus.net>
parents: 936
diff changeset
392 cmdclass['install_data'] = smart_install_data
a787fef11a25 small repairs for MinGW build
Lenard Lindstrom <len-l@telus.net>
parents: 936
diff changeset
393
1049
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
394
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
395 if "bdist_msi" in sys.argv:
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
396 # if you are making an msi, we want it to overwrite files
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
397 from distutils.command import bdist_msi
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
398 import msilib
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
399
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
400 class bdist_msi_overwrite_on_install(bdist_msi.bdist_msi):
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
401 def run(self):
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
402 bdist_msi.bdist_msi.run(self)
1074
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
403
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
404 # Remove obsolete files.
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
405 comp = "pygame1" # Pygame component
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
406 prop = comp # Directory property
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
407 records = [("surfarray.pyd", comp,
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
408 "SURFAR~1.PYD|surfarray.pyd", prop, 1),
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
409 ("sndarray.pyd", comp,
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
410 "SNDARRAY.PYD|sndarray.pyd", prop, 1),
1839
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
411 ("camera.pyd", comp, "CAMERA.PYD|camera.pyd", prop, 1),
1074
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
412 ("color.py", comp, "COLOR.PY|color.py", prop, 1),
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
413 ("color.pyc", comp, "COLOR.PYC|color.pyc", prop, 1),
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
414 ("color.pyo", comp, "COLOR.PYO|color.pyo", prop, 1)]
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
415 msilib.add_data(self.db, "RemoveFile", records)
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
416
ba6363fd473e msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents: 1049
diff changeset
417 # Overwrite outdated files.
1049
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
418 fullname = self.distribution.get_fullname()
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
419 installer_name = self.get_installer_filename(fullname)
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1453
diff changeset
420 print ("changing %s to overwrite files on install" % installer_name)
1049
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
421 msilib.add_data(self.db, "Property", [("REINSTALLMODE", "amus")])
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
422 self.db.Commit()
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
423
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
424 cmdclass['bdist_msi'] = bdist_msi_overwrite_on_install
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
425
27abb830fa5b making it so that msi installers will overwrite existing files on install
brian
parents: 1044
diff changeset
426
1411
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
427
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
428
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
429
1839
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
430
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
431
1411
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
432 # test command. For doing 'python setup.py test'
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
433
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
434 class TestCommand(Command):
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
435 user_options = [ ]
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
436
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
437 def initialize_options(self):
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
438 self._dir = os.getcwd()
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
439
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
440 def finalize_options(self):
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
441 pass
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
442
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
443 def run(self):
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
444 '''
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
445 runs the tests with default options.
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
446 '''
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
447 import subprocess
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
448 return subprocess.call([sys.executable, "run_tests.py"])
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
449
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
450 cmdclass['test'] = TestCommand
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
451
1418
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1411
diff changeset
452 # Prune empty file lists.
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1411
diff changeset
453 date_files = [(path, files) for path, files in data_files if files]
1411
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
454
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
455
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
456
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
457
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
458
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
459
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
460
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
461
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
462
13b20f9b4624 Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents: 1388
diff changeset
463
469
482e96823aa7 ready for 1.5.6
pygame
parents: 437
diff changeset
464 #finally,
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
465 #call distutils with all needed info
130
7044c4ec15c0 config cleanup
pygame
parents: 129
diff changeset
466 PACKAGEDATA = {
938
a787fef11a25 small repairs for MinGW build
Lenard Lindstrom <len-l@telus.net>
parents: 936
diff changeset
467 "cmdclass": cmdclass,
1418
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1411
diff changeset
468 "packages": ['pygame', 'pygame.gp2x', 'pygame.threads',
1424
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
469 'pygame.tests',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
470 'pygame.tests.test_utils',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
471 'pygame.tests.run_tests__tests',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
472 'pygame.tests.run_tests__tests.all_ok',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
473 'pygame.tests.run_tests__tests.failures1',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
474 'pygame.tests.run_tests__tests.incomplete',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
475 'pygame.tests.run_tests__tests.infinite_loop',
ccaa420e0683 docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents: 1422
diff changeset
476 'pygame.tests.run_tests__tests.print_stderr',
1430
5b68e04fd7e7 update setup.py to reflect examples becoming a package
Lenard Lindstrom <len-l@telus.net>
parents: 1424
diff changeset
477 'pygame.tests.run_tests__tests.print_stdout',
1446
54e0692f9d5d Add addition fake tests to installation
Lenard Lindstrom <len-l@telus.net>
parents: 1444
diff changeset
478 'pygame.tests.run_tests__tests.incomplete_todo',
54e0692f9d5d Add addition fake tests to installation
Lenard Lindstrom <len-l@telus.net>
parents: 1444
diff changeset
479 'pygame.tests.run_tests__tests.exclude',
54e0692f9d5d Add addition fake tests to installation
Lenard Lindstrom <len-l@telus.net>
parents: 1444
diff changeset
480 'pygame.tests.run_tests__tests.timeout',
54e0692f9d5d Add addition fake tests to installation
Lenard Lindstrom <len-l@telus.net>
parents: 1444
diff changeset
481 'pygame.tests.run_tests__tests.everything',
1780
2b939307c49e make python -m pygame.docs bring up the docs in a browser. also fix Python 3 issues with executable packages
Lenard Lindstrom <len-l@telus.net>
parents: 1578
diff changeset
482 'pygame.docs',
1430
5b68e04fd7e7 update setup.py to reflect examples becoming a package
Lenard Lindstrom <len-l@telus.net>
parents: 1424
diff changeset
483 'pygame.examples'],
658
bc56f17b4fbe made the setup file install the gp2x package.
Rene Dudfield <renesd@gmail.com>
parents: 620
diff changeset
484 "package_dir": {'pygame': 'lib',
1167
4bc6d1bf7ceb Moved pygame.threads into it's own package due to Queue needing to import built-in time module, was conflicting with time.pyd in same dir.
akalias
parents: 1074
diff changeset
485 'pygame.threads': 'lib/threads',
1418
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1411
diff changeset
486 'pygame.gp2x': 'lib/gp2x',
1430
5b68e04fd7e7 update setup.py to reflect examples becoming a package
Lenard Lindstrom <len-l@telus.net>
parents: 1424
diff changeset
487 'pygame.tests': 'test',
1780
2b939307c49e make python -m pygame.docs bring up the docs in a browser. also fix Python 3 issues with executable packages
Lenard Lindstrom <len-l@telus.net>
parents: 1578
diff changeset
488 'pygame.docs': 'docs',
1430
5b68e04fd7e7 update setup.py to reflect examples becoming a package
Lenard Lindstrom <len-l@telus.net>
parents: 1424
diff changeset
489 'pygame.examples': 'examples'},
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
490 "headers": headers,
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
491 "ext_modules": extensions,
1418
af8675f5e463 test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents: 1411
diff changeset
492 "data_files": data_files,
123
19d600d70996 preparing for 1.0
pygame
parents: 122
diff changeset
493 }
130
7044c4ec15c0 config cleanup
pygame
parents: 129
diff changeset
494 PACKAGEDATA.update(METADATA)
750
c052828a5d7f refactor for bdist_mpkg 0.4.2
bob
parents: 676
diff changeset
495 PACKAGEDATA.update(EXTRAS)
578
f383f9822028 support for py2app's bgdist_mpkg command
bob
parents: 571
diff changeset
496 setup(**PACKAGEDATA)
1839
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
497
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
498
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
499 def remove_old_files():
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
500
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
501 # try and figure out where we are installed.
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
502
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
503 #pygame could be installed in a weird location because of
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
504 # setuptools or something else. The only sane way seems to be by trying
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
505 # first to import it, and see where the imported one is.
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
506 #
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
507 # Otherwise we might delete some files from another installation.
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
508 try:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
509 import pygame.base
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
510 use_pygame = 1
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
511 except:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
512 use_pygame = 0
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
513
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
514 if use_pygame:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
515 install_path= os.path.split(pygame.base.__file__)[0]
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
516 extension_ext = os.path.splitext(pygame.base.__file__)[1]
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
517 else:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
518 if not os.path.exists(data_path):
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
519 return
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
520
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
521 install_path = data_path
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
522
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
523 base_file = glob.glob(os.path.join(data_path, "base*"))
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
524 if not base_file:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
525 return
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
526
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
527 extension_ext = os.path.splitext(base_file[0])[1]
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
528
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
529
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
530
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
531 # here are the .so/.pyd files we need to ask to remove.
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
532 ext_to_remove = ["camera"]
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
533
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
534 # here are the .py/.pyo/.pyc files we need to ask to remove.
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
535 py_to_remove = ["color"]
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
536
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
537 os.path.join(data_path, 'color.py')
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
538 if os.name == "e32": # Don't warn on Symbian. The color.py is used as a wrapper.
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
539 py_to_remove = []
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
540
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
541
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
542
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
543 # See if any of the files are there.
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
544 extension_files = ["%s%s" % (x, extension_ext) for x in ext_to_remove]
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
545
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
546 py_files = ["%s%s" % (x, py_ext)
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
547 for py_ext in [".py", ".pyc", ".pyo"]
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
548 for x in py_to_remove]
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
549
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
550 files = py_files + extension_files
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
551
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
552 unwanted_files = []
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
553 for f in files:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
554 unwanted_files.append( os.path.join( install_path, f ) )
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
555
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
556
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
557
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
558 ask_remove = []
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
559 for f in unwanted_files:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
560 if os.path.exists(f):
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
561 ask_remove.append(f)
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
562
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
563 for f in ask_remove:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
564 try:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
565 print("trying to remove old file :%s: ..." %f)
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
566 os.remove(f)
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
567 print("Successfully removed :%s:." % f)
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
568 except:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
569 print("FAILED to remove old file :%s:" % f)
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
570
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
571
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
572
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
573 if "install" in sys.argv:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
574 # remove some old files.
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
575 # only call after a successful install. Should only reach here if there is
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
576 # a successful install... otherwise setup() raises an error.
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
577 try:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
578 remove_old_files()
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
579 except:
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
580 pass
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
581
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
582
02c1e8e9c102 merged changes from trunk to math_module branch
lorenz
parents: 1815
diff changeset
583