~ubuntu-branches/ubuntu/warty/pygame/warty

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2004-09-17 17:09:53 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040917170953-caomeukd8awvvpwv
Tags: 1.6-0.2ubuntu1
Add missing build-depends: python

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
2
#
3
3
# This is the distutils setup script for pygame.
4
 
# Full instructions are in "docs/fullinstall.txt"
 
4
# Full instructions are in "install.txt" or "install.html"
5
5
#
6
6
# To configure, compile, install, just run this script.
7
7
 
12
12
 
13
13
METADATA = {
14
14
    "name":             "pygame",
15
 
    "version":          "1.4",
 
15
    "version":          "1.6",
16
16
    "license":          "LGPL",
17
17
    "url":              "http://www.pygame.org",
18
18
    "author":           "Pete Shinners",
35
35
 
36
36
 
37
37
import os.path, glob
38
 
import distutils.sysconfig 
 
38
import distutils.sysconfig
39
39
from distutils.core import setup, Extension
40
40
from distutils.extension import read_setup_file
41
41
from distutils.ccompiler import new_compiler
63
63
 
64
64
 
65
65
#get compile info for all extensions
66
 
try:
67
 
    extensions = read_setup_file('Setup')
68
 
except:
69
 
    raise SystemExit, """Error with the "Setup" file,
 
66
try: extensions = read_setup_file('Setup')
 
67
except: raise SystemExit, """Error with the "Setup" file,
70
68
perhaps make a clean copy from "Setup.in"."""
71
69
 
72
70
 
84
82
#try to find DLLs and copy them too  (only on windows)
85
83
if sys.platform == 'win32':
86
84
    tempcompiler = new_compiler()
 
85
    ext = tempcompiler.shared_lib_extension
87
86
    for e in extensions:
88
87
        paths = []
89
 
        ext = tempcompiler.shared_lib_extension
90
88
        for d in e.library_dirs:
91
89
             for l in e.libraries:
92
90
                    name = tempcompiler.shared_lib_format%(l, ext)
96
94
                data_files.append(p)
97
95
 
98
96
 
99
 
#we can detect the presence of python dependencies, remove any unfound
100
 
pythondeps = {'surfarray': ['Numeric']}
101
 
for e in extensions[:]:
102
 
    modules = pythondeps.get(e.name, [])
103
 
    if modules:
104
 
        try:
105
 
            for module in modules:
106
 
                x = __import__(module)
107
 
                del x
108
 
        except ImportError:
109
 
            print 'NOTE: Not compiling:', e.name, ' (module not found='+module+')'
110
 
            extensions.remove(e)
111
 
 
112
 
 
113
97
#clean up the list of extensions
114
98
for e in extensions[:]:
115
99
    if e.name[:8] == 'COPYLIB_':
118
102
        e.name = 'pygame.' + e.name #prepend package name on modules
119
103
 
120
104
 
121
 
 
122
105
#data installer with improved intelligence over distutils
123
106
#data files are copied into the project directory instead
124
107
#of willy-nilly
125
 
class smart_install_data(install_data):   
 
108
class smart_install_data(install_data):
126
109
    def run(self):
127
 
        #need to change self.install_dir to the library dir
128
 
 
 
110
        #need to change self.install_dir to the actual library dir
129
111
        install_cmd = self.get_finalized_command('install')
130
112
        self.install_dir = getattr(install_cmd, 'install_lib')
131
113
        return install_data.run(self)
135
117
 
136
118
 
137
119
 
138
 
#finally, 
 
120
#finally,
139
121
#call distutils with all needed info
140
122
PACKAGEDATA = {
141
123
       "cmdclass":    {'install_data': smart_install_data},