pygame /

#!/usr/bin/env python
# This is the distutils setup script for pygame.
# Full instructions are in "docs/fullinstall.txt"
# To configure, compile, install, just run this script.

DESCRIPTION = """Pygame is a Python wrapper module for the
SDL multimedia library. It contains python functions and classes
that will allow you to use SDL's support for playing cdroms,
audio and video output, and keyboard, mouse and joystick input."""

    "name":             "pygame",
    "version":          "1.4.1",
    "license":          "LGPL",
    "url":              "",
    "author":           "Pete Shinners",
    "author_email":     "",
    "description":      "Python Game Development",
    "long_description": DESCRIPTION,

    import distutils
except ImportError:
    raise SystemExit, "Pygame requires distutils to build and install."

#get us to the correct directory
import os, sys
path = os.path.split(os.path.abspath(sys.argv[0]))[0]

import os.path, glob
import distutils.sysconfig 
from distutils.core import setup, Extension
from distutils.extension import read_setup_file
from distutils.ccompiler import new_compiler
from distutils.command.install_data import install_data

#headers to install
headers = glob.glob(os.path.join('src', '*.h'))

#sanity check for any arguments
if len(sys.argv) == 1:
    reply = raw_input('\nNo Arguments Given, Perform Default Install? [Y/n]')
    if not reply or reply[0].lower() != 'n':

#make sure there is a Setup file
if not os.path.isfile('Setup'):
    print '\n\nWARNING, No "Setup" File Exists, Running ""'
    import config
    print '\nContinuing With ""'

#get compile info for all extensions
    extensions = read_setup_file('Setup')
    raise SystemExit, """Error with the "Setup" file,
perhaps make a clean copy from ""."""

#extra files to install
data_path = os.path.join(distutils.sysconfig.get_python_lib(), 'pygame')
data_files = []

#add non .py files in lib directory
for f in glob.glob(os.path.join('lib', '*')):
    if not f[-3:] =='.py' and os.path.isfile(f):

#try to find DLLs and copy them too  (only on windows)
if sys.platform == 'win32':
    tempcompiler = new_compiler()
    for e in extensions:
        paths = []
        ext = tempcompiler.shared_lib_extension
        for d in e.library_dirs:
             for l in e.libraries:
                    name = tempcompiler.shared_lib_format%(l, ext)
                    paths.append(os.path.join(d, name))
        for p in paths:
            if os.path.isfile(p) and p not in data_files:

#clean up the list of extensions
for e in extensions[:]:
    if[:8] == 'COPYLIB_':
        extensions.remove(e) #don't compile the COPYLIBs, just clean them
    else: = 'pygame.' + #prepend package name on modules

#data installer with improved intelligence over distutils
#data files are copied into the project directory instead
#of willy-nilly
class smart_install_data(install_data):   
    def run(self):
        #need to change self.install_dir to the library dir

        install_cmd = self.get_finalized_command('install')
        self.install_dir = getattr(install_cmd, 'install_lib')

#call distutils with all needed info
       "cmdclass":    {'install_data': smart_install_data},
       "packages":    ['pygame'],
       "package_dir": {'pygame': 'lib'},
       "headers":     headers,
       "ext_modules": extensions,
       "data_files":  [['pygame', data_files]],
apply(setup, [], PACKAGEDATA)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.