Mercurial > pygame
annotate setup.py @ 3194:9fcb7abf3185 default tip
Remove some gcc 4.7.2 compiler warnings
| author | Lenard Lindstrom <len-l@telus.net> |
|---|---|
| date | Tue, 23 Apr 2013 19:53:36 -0700 |
| parents | f52af9cc89ad |
| children |
| rev | line source |
|---|---|
| 7 | 1 #!/usr/bin/env python |
| 2 # | |
| 123 | 3 # This is the distutils setup script for pygame. |
| 359 | 4 # Full instructions are in "install.txt" or "install.html" |
| 123 | 5 # |
| 6 # To configure, compile, install, just run this script. | |
| 26 | 7 |
| 130 | 8 DESCRIPTION = """Pygame is a Python wrapper module for the |
| 9 SDL multimedia library. It contains python functions and classes | |
| 10 that will allow you to use SDL's support for playing cdroms, | |
| 286 | 11 audio and video output, and keyboard, mouse and joystick input.""" |
| 130 | 12 |
| 750 | 13 EXTRAS = {} |
| 14 | |
| 123 | 15 METADATA = { |
| 16 "name": "pygame", | |
|
1926
e24c706da460
updated version to 1.9.2pre
Rene Dudfield <renesd@gmail.com>
parents:
1925
diff
changeset
|
17 "version": "1.9.2pre", |
| 130 | 18 "license": "LGPL", |
| 178 | 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 | 21 "author_email": "pygame@seul.org", |
| 286 | 22 "description": "Python Game Development", |
| 130 | 23 "long_description": DESCRIPTION, |
| 123 | 24 } |
| 25 | |
| 497 | 26 import sys |
| 961 | 27 |
| 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 | 30 METADATA["version"] = METADATA["version"].replace("pre", "a0") |
| 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 | 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 | 37 |
| 161 | 38 #get us to the correct directory |
| 39 import os, sys | |
| 40 path = os.path.split(os.path.abspath(sys.argv[0]))[0] | |
| 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 | 57 |
|
3036
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
58 import os.path, glob, stat, shutil |
| 469 | 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 | 61 from distutils.extension import read_setup_file |
| 124 | 62 from distutils.command.install_data import install_data |
| 25 | 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 | 102 # NOTE: the bdist_mpkg_support is for darwin. |
| 750 | 103 try: |
| 104 import bdist_mpkg_support | |
| 105 from setuptools import setup, Extension | |
| 106 except ImportError: | |
| 107 pass | |
| 108 else: | |
| 109 EXTRAS.update({ | |
| 110 'options': bdist_mpkg_support.options, | |
| 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 | 114 }) |
| 115 | |
| 7 | 116 #headers to install |
| 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 | 120 |
|
3139
a3a156b68504
updating install step for ci build
Rene Dudfield <renesd@gmail.com>
parents:
3090
diff
changeset
|
121 # option for not installing the headers. |
|
a3a156b68504
updating install step for ci build
Rene Dudfield <renesd@gmail.com>
parents:
3090
diff
changeset
|
122 if "-noheaders" in sys.argv: |
|
a3a156b68504
updating install step for ci build
Rene Dudfield <renesd@gmail.com>
parents:
3090
diff
changeset
|
123 headers = [] |
|
a3a156b68504
updating install step for ci build
Rene Dudfield <renesd@gmail.com>
parents:
3090
diff
changeset
|
124 sys.argv.remove ("-noheaders") |
|
a3a156b68504
updating install step for ci build
Rene Dudfield <renesd@gmail.com>
parents:
3090
diff
changeset
|
125 |
|
a3a156b68504
updating install step for ci build
Rene Dudfield <renesd@gmail.com>
parents:
3090
diff
changeset
|
126 |
| 123 | 127 #sanity check for any arguments |
| 128 if len(sys.argv) == 1: | |
|
3185
f52af9cc89ad
Fix setup file to properly call input() or raw_input() depending on the python version.
Paul Craven <paul.craven@simpson.edu>
parents:
3139
diff
changeset
|
129 if sys.version_info[0] >= 3: |
|
f52af9cc89ad
Fix setup file to properly call input() or raw_input() depending on the python version.
Paul Craven <paul.craven@simpson.edu>
parents:
3139
diff
changeset
|
130 reply = input('\nNo Arguments Given, Perform Default Install? [Y/n]') |
|
f52af9cc89ad
Fix setup file to properly call input() or raw_input() depending on the python version.
Paul Craven <paul.craven@simpson.edu>
parents:
3139
diff
changeset
|
131 else: |
|
f52af9cc89ad
Fix setup file to properly call input() or raw_input() depending on the python version.
Paul Craven <paul.craven@simpson.edu>
parents:
3139
diff
changeset
|
132 reply = raw_input('\nNo Arguments Given, Perform Default Install? [Y/n]') |
| 123 | 133 if not reply or reply[0].lower() != 'n': |
| 134 sys.argv.append('install') | |
| 135 | |
| 136 | |
| 137 #make sure there is a Setup file | |
| 138 if not os.path.isfile('Setup'): | |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1453
diff
changeset
|
139 print ('\n\nWARNING, No "Setup" File Exists, Running "config.py"') |
| 123 | 140 import config |
| 141 config.main() | |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1453
diff
changeset
|
142 print ('\nContinuing With "setup.py"') |
| 123 | 143 |
| 144 | |
|
1044
6e1e6f7db6d6
Added a WARNING to tell you if Setup.in is newer than Setup.
Rene Dudfield <renesd@gmail.com>
parents:
1021
diff
changeset
|
145 try: |
|
6e1e6f7db6d6
Added a WARNING to tell you if Setup.in is newer than Setup.
Rene Dudfield <renesd@gmail.com>
parents:
1021
diff
changeset
|
146 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
|
147 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
|
148 if sin_mtime > s_mtime: |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1453
diff
changeset
|
149 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
|
150 '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
|
151 except: |
|
6e1e6f7db6d6
Added a WARNING to tell you if Setup.in is newer than Setup.
Rene Dudfield <renesd@gmail.com>
parents:
1021
diff
changeset
|
152 pass |
| 123 | 153 |
| 1453 | 154 # get compile info for all extensions |
| 155 try: | |
| 156 extensions = read_setup_file('Setup') | |
| 157 except: | |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1453
diff
changeset
|
158 print ("""Error with the "Setup" file, |
|
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1453
diff
changeset
|
159 perhaps make a clean copy from "Setup.in".""") |
| 1453 | 160 raise |
| 7 | 161 |
|
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
|
162 #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
|
163 if sys.version_info >= (3, 0, 0): |
|
2167
949ac8c51629
Correct Event readonly attributes test for Python 3.x: the exception raised on assignment differs from 2.x.
Lenard Lindstrom <len-l@telus.net>
parents:
2143
diff
changeset
|
164 python3_skip = ['_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
|
165 '_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
|
166 '_numericsndarray', |
|
2167
949ac8c51629
Correct Event readonly attributes test for Python 3.x: the exception raised on assignment differs from 2.x.
Lenard Lindstrom <len-l@telus.net>
parents:
2143
diff
changeset
|
167 ] |
|
3090
d811a6f742d8
Enable scrap on Windows for Python 3.x
Lenard Lindstrom <len-l@telus.net>
parents:
3038
diff
changeset
|
168 # if (sys.platform != 'linux2'): |
|
d811a6f742d8
Enable scrap on Windows for Python 3.x
Lenard Lindstrom <len-l@telus.net>
parents:
3038
diff
changeset
|
169 # python3_skip.append('scrap') |
|
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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 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
|
175 (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
|
176 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
|
177 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
|
178 del tmp_extensions |
| 42 | 179 |
|
3036
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
180 # if not building font, try replacing with ftfont |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
181 alternate_font = os.path.join('lib', 'font.py') |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
182 if os.path.exists(alternate_font): |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
183 os.remove(alternate_font) |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
184 have_font = False |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
185 have_freetype = False |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
186 for e in extensions: |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
187 if e.name == 'font': |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
188 have_font = True |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
189 if e.name == '_freetype': |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
190 have_freetype = True |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
191 if not have_font and have_freetype: |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
192 shutil.copyfile(os.path.join('lib', 'ftfont.py'), alternate_font) |
|
f2c2fd4786f1
Install a freetype replacement for pygame.font if font is not built
Lenard Lindstrom <len-l@telus.net>
parents:
3002
diff
changeset
|
193 |
| 7 | 194 #extra files to install |
| 42 | 195 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
|
196 pygame_data_files = [] |
|
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1411
diff
changeset
|
197 data_files = [('pygame', pygame_data_files)] |
| 7 | 198 |
|
1424
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
199 #add files in distribution directory |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
200 pygame_data_files.append('LGPL') |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
201 pygame_data_files.append('readme.html') |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
202 pygame_data_files.append('install.html') |
| 123 | 203 |
| 29 | 204 #add non .py files in lib directory |
| 205 for f in glob.glob(os.path.join('lib', '*')): | |
| 936 | 206 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
|
207 pygame_data_files.append(f) |
|
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1411
diff
changeset
|
208 |
|
1444
72cf09c63459
add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents:
1430
diff
changeset
|
209 #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
|
210 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
|
211 ['test', |
|
72cf09c63459
add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents:
1430
diff
changeset
|
212 [['fixtures', |
|
72cf09c63459
add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents:
1430
diff
changeset
|
213 [['xbm_cursors', |
|
1959
ce0489d3e33f
move freetype module test fonts to fixture subdirectory and make sure they install
Lenard Lindstrom <len-l@telus.net>
parents:
1956
diff
changeset
|
214 ['*.xbm']], |
|
ce0489d3e33f
move freetype module test fonts to fixture subdirectory and make sure they install
Lenard Lindstrom <len-l@telus.net>
parents:
1956
diff
changeset
|
215 ['fonts', |
|
ce0489d3e33f
move freetype module test fonts to fixture subdirectory and make sure they install
Lenard Lindstrom <len-l@telus.net>
parents:
1956
diff
changeset
|
216 ['*.ttf', '*.otf']]]]]]) |
|
1422
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
217 |
|
1424
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
218 #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
|
219 add_datafiles(data_files, 'pygame/examples', |
|
1422
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
220 ['examples', |
|
3027
9c88c478be0d
Moving the readme.txt into readme.rst which generates the html version.
Rene Dudfield <renesd@gmail.com>
parents:
3002
diff
changeset
|
221 ['readme.rst', |
|
1422
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
222 ['data', |
|
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
223 ['*']], |
|
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
224 ['macosx', |
|
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
225 ['*.py', |
|
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
226 ['aliens_app_example', |
|
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
227 ['*.py', |
|
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
228 'README.txt', |
|
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
229 ['English.lproj', |
|
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
230 ['aliens.icns', |
|
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
231 ['MainMenu.nib', |
|
7bed880318b2
pygame.examples: completely installs
Lenard Lindstrom <len-l@telus.net>
parents:
1418
diff
changeset
|
232 ['*']]]]]]]]]]) |
| 29 | 233 |
|
1424
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
234 #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
|
235 add_datafiles(data_files, 'pygame/docs', |
|
1424
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
236 ['docs', |
|
2246
e5fd80553a82
have setup.py install document comment code
Lenard Lindstrom <len-l@telus.net>
parents:
2185
diff
changeset
|
237 ['*.html', # Navigation and help pages |
|
e5fd80553a82
have setup.py install document comment code
Lenard Lindstrom <len-l@telus.net>
parents:
2185
diff
changeset
|
238 '*.gif', # Pygame logos |
|
e5fd80553a82
have setup.py install document comment code
Lenard Lindstrom <len-l@telus.net>
parents:
2185
diff
changeset
|
239 '*.js', # For doc search |
|
e5fd80553a82
have setup.py install document comment code
Lenard Lindstrom <len-l@telus.net>
parents:
2185
diff
changeset
|
240 ['ref', # Pygame reference |
|
e5fd80553a82
have setup.py install document comment code
Lenard Lindstrom <len-l@telus.net>
parents:
2185
diff
changeset
|
241 ['*.html', # Reference pages |
|
e5fd80553a82
have setup.py install document comment code
Lenard Lindstrom <len-l@telus.net>
parents:
2185
diff
changeset
|
242 '*.js', # Comments script |
|
e5fd80553a82
have setup.py install document comment code
Lenard Lindstrom <len-l@telus.net>
parents:
2185
diff
changeset
|
243 '*.json']], # Comment data |
|
e5fd80553a82
have setup.py install document comment code
Lenard Lindstrom <len-l@telus.net>
parents:
2185
diff
changeset
|
244 ['tut', # Tutorials |
|
1424
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
245 ['*.html', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
246 ['chimp', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
247 ['*.html', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
248 '*.gif']], |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
249 ['intro', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
250 ['*.html', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
251 '*.gif', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
252 '*.jpg']], |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
253 ['surfarray', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
254 ['*.html', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
255 '*.jpg']], |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
256 ['tom', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
257 ['*.html', |
|
2185
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
258 '*.png']], |
|
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
259 ['camera', |
|
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
260 ['*.html', |
|
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
261 '*.jpg']]]], |
|
2246
e5fd80553a82
have setup.py install document comment code
Lenard Lindstrom <len-l@telus.net>
parents:
2185
diff
changeset
|
262 ['_static', # Sphinx added support files |
|
2185
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
263 ['*.css', |
|
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
264 '*.png', |
|
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
265 '*.ico', |
|
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
266 '*.js']], |
|
2246
e5fd80553a82
have setup.py install document comment code
Lenard Lindstrom <len-l@telus.net>
parents:
2185
diff
changeset
|
267 ['_sources', # Used for ref search |
|
2185
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
268 ['*.txt', |
|
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
269 ['ref', |
|
850cb5754b95
setup.py now installs reST generated docs (the makeref.py generated docs still install)
Lenard Lindstrom <len-l@telus.net>
parents:
2167
diff
changeset
|
270 ['*.txt']]]]]]) |
|
1424
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
271 |
|
1444
72cf09c63459
add pygame/tests/fixtures to installation (broken in previous setup.py changes)
Lenard Lindstrom <len-l@telus.net>
parents:
1430
diff
changeset
|
272 #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
|
273 cmdclass = {} |
| 123 | 274 |
| 275 #try to find DLLs and copy them too (only on windows) | |
| 7 | 276 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
|
277 |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
278 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
|
279 # 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
|
280 try: |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
281 # 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
|
282 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
|
283 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
|
284 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
|
285 else: |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
286 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
|
287 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
|
288 try: |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
289 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
|
290 # 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
|
291 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
|
292 |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
293 # 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
|
294 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
|
295 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
|
296 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
|
297 pass |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
298 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
299 #add dependency DLLs to the project |
|
1353
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
300 lib_dependencies = {} |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
301 for e in extensions: |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
302 if e.name.startswith('COPYLIB_'): |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
303 lib_dependencies[e.name[8:]] = e.libraries |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
304 |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
305 def dependencies(roots): |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
306 """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
|
307 |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
308 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
|
309 """ |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
310 |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
311 root_set = {} |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
312 for root in roots: |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
313 try: |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
314 deps = lib_dependencies[root] |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
315 except KeyError: |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
316 pass |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
317 else: |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
318 root_set[root] = 1 |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
319 root_set.update(dependencies(deps)) |
|
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
320 return root_set |
|
585
d319548e5eed
some fixes for building with mingw and msys on windows
Rene Dudfield <renesd@gmail.com>
parents:
578
diff
changeset
|
321 |
|
892
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
322 the_dlls = {} |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
323 required_dlls = {} |
|
859ceb5bb6fb
Updated Windows build process so works better with MSYS.
Lenard Lindstrom <len-l@telus.net>
parents:
871
diff
changeset
|
324 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
|
325 if e.name.startswith('COPYLIB_'): |
|
1353
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
326 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
|
327 else: |
|
1353
98ea1dccb6a9
Furthur changes supporting Windows dependency transition
Lenard Lindstrom <len-l@telus.net>
parents:
1333
diff
changeset
|
328 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
|
329 |
|
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
|
330 # 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
|
331 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
|
332 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
|
333 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
|
334 |
|
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
|
335 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
|
336 #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
|
337 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
|
338 if f == '_': |
|
1553
ebd545641c8b
merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents:
1453
diff
changeset
|
339 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
|
340 else: |
|
1418
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1411
diff
changeset
|
341 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
|
342 |
|
916
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
343 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
|
344 """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
|
345 |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
346 # __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
|
347 # 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
|
348 # 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
|
349 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
|
350 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
|
351 __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
|
352 break |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
353 |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
354 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
|
355 """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
|
356 |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
357 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
|
358 # 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
|
359 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
|
360 # 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
|
361 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
|
362 try: |
|
8a7d9b2de067
MinGW/MSYS build process more automated and DLLs Win32 GUI by default
Lenard Lindstrom <len-l@telus.net>
parents:
907
diff
changeset
|
363 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
|
364 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
|
365 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
|
366 "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
|
367 " 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
|
368 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
|
369 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
|
370 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
|
371 path]) |
|
1251
beb37bb62fb0
Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents:
1246
diff
changeset
|
372 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
|
373 # 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
|
374 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
|
375 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
|
376 # 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
|
377 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
|
378 else: |
|
beb37bb62fb0
Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents:
1246
diff
changeset
|
379 # 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
|
380 # the MinGW default. |
|
beb37bb62fb0
Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents:
1246
diff
changeset
|
381 c_runtime_path = '' |
|
beb37bb62fb0
Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents:
1246
diff
changeset
|
382 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
|
383 # 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
|
384 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
|
385 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
|
386 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
|
387 'msvcr*'))): |
|
beb37bb62fb0
Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents:
1246
diff
changeset
|
388 pass |
|
beb37bb62fb0
Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents:
1246
diff
changeset
|
389 else: |
|
beb37bb62fb0
Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents:
1246
diff
changeset
|
390 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
|
391 " 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
|
392 " Python %i.%i" % |
|
beb37bb62fb0
Updated setup.py for Python 2.6 on Windows
Lenard Lindstrom <len-l@telus.net>
parents:
1246
diff
changeset
|
393 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
|
394 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
|
395 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
|
396 |
|
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
|
397 # 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
|
398 def replace_scale_mmx(): |
|
1ed215141bdd
Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents:
1331
diff
changeset
|
399 for e in extensions: |
|
1ed215141bdd
Fixed transform build and test problems
Lenard Lindstrom <len-l@telus.net>
parents:
1331
diff
changeset
|
400 if e.name == 'transform': |
|
2312
950c92b6a42a
apply Cristoph Gohlke's patch to allow to linking with 64 bit msvcr90.dll
Lenard Lindstrom <len-l@telus.net>
parents:
2246
diff
changeset
|
401 if '64 bit' in sys.version: |
|
950c92b6a42a
apply Cristoph Gohlke's patch to allow to linking with 64 bit msvcr90.dll
Lenard Lindstrom <len-l@telus.net>
parents:
2246
diff
changeset
|
402 e.extra_objects.append( |
|
3002
4f24972f010b
Enable building on win-amd64 #2
Christoph Gohlke <cgohlke@uci.edu>
parents:
2998
diff
changeset
|
403 os.path.join('obj', 'win64', 'scale_mmx.obj')) |
|
2312
950c92b6a42a
apply Cristoph Gohlke's patch to allow to linking with 64 bit msvcr90.dll
Lenard Lindstrom <len-l@telus.net>
parents:
2246
diff
changeset
|
404 else: |
|
950c92b6a42a
apply Cristoph Gohlke's patch to allow to linking with 64 bit msvcr90.dll
Lenard Lindstrom <len-l@telus.net>
parents:
2246
diff
changeset
|
405 e.extra_objects.append( |
|
950c92b6a42a
apply Cristoph Gohlke's patch to allow to linking with 64 bit msvcr90.dll
Lenard Lindstrom <len-l@telus.net>
parents:
2246
diff
changeset
|
406 os.path.join('obj', 'win32', 'scale_mmx.obj')) |
|
2998
7ba57b538660
Enable buiding on win-amd64
Christoph Gohlke <cgohlke@uci.edu>
parents:
2312
diff
changeset
|
407 for i in range(len(e.sources)): |
|
7ba57b538660
Enable buiding on win-amd64
Christoph Gohlke <cgohlke@uci.edu>
parents:
2312
diff
changeset
|
408 if e.sources[i].endswith('scale_mmx.c'): |
|
7ba57b538660
Enable buiding on win-amd64
Christoph Gohlke <cgohlke@uci.edu>
parents:
2312
diff
changeset
|
409 del e.sources[i] |
|
7ba57b538660
Enable buiding on win-amd64
Christoph Gohlke <cgohlke@uci.edu>
parents:
2312
diff
changeset
|
410 return |
|
2312
950c92b6a42a
apply Cristoph Gohlke's patch to allow to linking with 64 bit msvcr90.dll
Lenard Lindstrom <len-l@telus.net>
parents:
2246
diff
changeset
|
411 replace_scale_mmx() |
| 7 | 412 |
| 42 | 413 |
| 129 | 414 #clean up the list of extensions |
| 415 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
|
416 if e.name.startswith('COPYLIB_'): |
| 129 | 417 extensions.remove(e) #don't compile the COPYLIBs, just clean them |
| 418 else: | |
| 419 e.name = 'pygame.' + e.name #prepend package name on modules | |
| 469 | 420 |
| 123 | 421 |
| 124 | 422 #data installer with improved intelligence over distutils |
| 423 #data files are copied into the project directory instead | |
| 424 #of willy-nilly | |
| 469 | 425 class smart_install_data(install_data): |
| 124 | 426 def run(self): |
| 359 | 427 #need to change self.install_dir to the actual library dir |
| 124 | 428 install_cmd = self.get_finalized_command('install') |
| 429 self.install_dir = getattr(install_cmd, 'install_lib') | |
| 430 return install_data.run(self) | |
| 431 | |
|
938
a787fef11a25
small repairs for MinGW build
Lenard Lindstrom <len-l@telus.net>
parents:
936
diff
changeset
|
432 cmdclass['install_data'] = smart_install_data |
|
a787fef11a25
small repairs for MinGW build
Lenard Lindstrom <len-l@telus.net>
parents:
936
diff
changeset
|
433 |
|
1049
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
434 |
|
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
435 if "bdist_msi" in sys.argv: |
|
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
436 # 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
|
437 from distutils.command import bdist_msi |
|
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
438 import msilib |
|
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
439 |
|
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
440 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
|
441 def run(self): |
|
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
442 bdist_msi.bdist_msi.run(self) |
|
1074
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
443 |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
444 # Remove obsolete files. |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
445 comp = "pygame1" # Pygame component |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
446 prop = comp # Directory property |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
447 records = [("surfarray.pyd", comp, |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
448 "SURFAR~1.PYD|surfarray.pyd", prop, 1), |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
449 ("sndarray.pyd", comp, |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
450 "SNDARRAY.PYD|sndarray.pyd", prop, 1), |
|
1886
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
451 ("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
|
452 ("color.py", comp, "COLOR.PY|color.py", prop, 1), |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
453 ("color.pyc", comp, "COLOR.PYC|color.pyc", prop, 1), |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
454 ("color.pyo", comp, "COLOR.PYO|color.pyo", prop, 1)] |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
455 msilib.add_data(self.db, "RemoveFile", records) |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
456 |
|
ba6363fd473e
msi removes obsolete files
Lenard Lindstrom <len-l@telus.net>
parents:
1049
diff
changeset
|
457 # Overwrite outdated files. |
|
1049
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
458 fullname = self.distribution.get_fullname() |
|
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
459 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
|
460 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
|
461 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
|
462 self.db.Commit() |
|
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
463 |
|
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
464 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
|
465 |
|
27abb830fa5b
making it so that msi installers will overwrite existing files on install
brian
parents:
1044
diff
changeset
|
466 |
|
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
|
467 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
468 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
469 |
|
1886
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
470 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
471 |
|
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
|
472 # 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
|
473 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
474 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
|
475 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
|
476 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
477 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
|
478 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
|
479 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
480 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
|
481 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
|
482 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
483 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
|
484 ''' |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
485 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
|
486 ''' |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
487 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
|
488 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
|
489 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
490 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
|
491 |
|
1418
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1411
diff
changeset
|
492 # Prune empty file lists. |
|
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1411
diff
changeset
|
493 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
|
494 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
495 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
496 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
497 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
498 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
499 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
500 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
501 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
502 |
|
13b20f9b4624
Added test command to setup.py. so you can do 'python setup.py test'
Rene Dudfield <renesd@gmail.com>
parents:
1388
diff
changeset
|
503 |
| 469 | 504 #finally, |
| 123 | 505 #call distutils with all needed info |
| 130 | 506 PACKAGEDATA = { |
|
938
a787fef11a25
small repairs for MinGW build
Lenard Lindstrom <len-l@telus.net>
parents:
936
diff
changeset
|
507 "cmdclass": cmdclass, |
|
1418
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1411
diff
changeset
|
508 "packages": ['pygame', 'pygame.gp2x', 'pygame.threads', |
|
1424
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
509 'pygame.tests', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
510 'pygame.tests.test_utils', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
511 'pygame.tests.run_tests__tests', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
512 'pygame.tests.run_tests__tests.all_ok', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
513 'pygame.tests.run_tests__tests.failures1', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
514 'pygame.tests.run_tests__tests.incomplete', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
515 'pygame.tests.run_tests__tests.infinite_loop', |
|
ccaa420e0683
docs added to Pygame package
Lenard Lindstrom <len-l@telus.net>
parents:
1422
diff
changeset
|
516 '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
|
517 '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
|
518 'pygame.tests.run_tests__tests.incomplete_todo', |
|
54e0692f9d5d
Add addition fake tests to installation
Lenard Lindstrom <len-l@telus.net>
parents:
1444
diff
changeset
|
519 'pygame.tests.run_tests__tests.exclude', |
|
54e0692f9d5d
Add addition fake tests to installation
Lenard Lindstrom <len-l@telus.net>
parents:
1444
diff
changeset
|
520 'pygame.tests.run_tests__tests.timeout', |
|
54e0692f9d5d
Add addition fake tests to installation
Lenard Lindstrom <len-l@telus.net>
parents:
1444
diff
changeset
|
521 '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
|
522 'pygame.docs', |
|
1430
5b68e04fd7e7
update setup.py to reflect examples becoming a package
Lenard Lindstrom <len-l@telus.net>
parents:
1424
diff
changeset
|
523 'pygame.examples'], |
|
658
bc56f17b4fbe
made the setup file install the gp2x package.
Rene Dudfield <renesd@gmail.com>
parents:
620
diff
changeset
|
524 "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
|
525 'pygame.threads': 'lib/threads', |
|
1418
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1411
diff
changeset
|
526 '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
|
527 '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
|
528 'pygame.docs': 'docs', |
|
1430
5b68e04fd7e7
update setup.py to reflect examples becoming a package
Lenard Lindstrom <len-l@telus.net>
parents:
1424
diff
changeset
|
529 'pygame.examples': 'examples'}, |
| 123 | 530 "headers": headers, |
| 531 "ext_modules": extensions, | |
|
1418
af8675f5e463
test suite now pygame.tests subpackage as well
Lenard Lindstrom <len-l@telus.net>
parents:
1411
diff
changeset
|
532 "data_files": data_files, |
| 123 | 533 } |
| 130 | 534 PACKAGEDATA.update(METADATA) |
| 750 | 535 PACKAGEDATA.update(EXTRAS) |
| 578 | 536 setup(**PACKAGEDATA) |
|
1886
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
537 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
538 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
539 def remove_old_files(): |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
540 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
541 # try and figure out where we are installed. |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
542 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
543 #pygame could be installed in a weird location because of |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
544 # setuptools or something else. The only sane way seems to be by trying |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
545 # first to import it, and see where the imported one is. |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
546 # |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
547 # Otherwise we might delete some files from another installation. |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
548 try: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
549 import pygame.base |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
550 use_pygame = 1 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
551 except: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
552 use_pygame = 0 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
553 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
554 if use_pygame: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
555 install_path= os.path.split(pygame.base.__file__)[0] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
556 extension_ext = os.path.splitext(pygame.base.__file__)[1] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
557 else: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
558 if not os.path.exists(data_path): |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
559 return |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
560 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
561 install_path = data_path |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
562 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
563 base_file = glob.glob(os.path.join(data_path, "base*")) |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
564 if not base_file: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
565 return |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
566 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
567 extension_ext = os.path.splitext(base_file[0])[1] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
568 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
569 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
570 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
571 # here are the .so/.pyd files we need to ask to remove. |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
572 ext_to_remove = ["camera"] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
573 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
574 # here are the .py/.pyo/.pyc files we need to ask to remove. |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
575 py_to_remove = ["color"] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
576 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
577 os.path.join(data_path, 'color.py') |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
578 if os.name == "e32": # Don't warn on Symbian. The color.py is used as a wrapper. |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
579 py_to_remove = [] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
580 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
581 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
582 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
583 # See if any of the files are there. |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
584 extension_files = ["%s%s" % (x, extension_ext) for x in ext_to_remove] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
585 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
586 py_files = ["%s%s" % (x, py_ext) |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
587 for py_ext in [".py", ".pyc", ".pyo"] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
588 for x in py_to_remove] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
589 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
590 files = py_files + extension_files |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
591 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
592 unwanted_files = [] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
593 for f in files: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
594 unwanted_files.append( os.path.join( install_path, f ) ) |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
595 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
596 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
597 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
598 ask_remove = [] |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
599 for f in unwanted_files: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
600 if os.path.exists(f): |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
601 ask_remove.append(f) |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
602 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
603 for f in ask_remove: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
604 try: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
605 print("trying to remove old file :%s: ..." %f) |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
606 os.remove(f) |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
607 print("Successfully removed :%s:." % f) |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
608 except: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
609 print("FAILED to remove old file :%s:" % f) |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
610 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
611 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
612 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
613 if "install" in sys.argv: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
614 # remove some old files. |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
615 # only call after a successful install. Should only reach here if there is |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
616 # a successful install... otherwise setup() raises an error. |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
617 try: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
618 remove_old_files() |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
619 except: |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
620 pass |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
621 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
622 |
|
e1fbe720d23f
Disabled old file detection/warning. Added old file remove method to end of setup.py
Rene Dudfield <renesd@gmail.com>
parents:
1883
diff
changeset
|
623 |
