<commit_before>import distutils.ccompiler as cc
import os, os.path
import sys
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, Command, find_packages

def show_compilers ():
    from distutils.ccompiler import show_compilers
    show_compilers()

class build_chipmunk(Command):
    description = """compile Chipmunk to a shared library"""
    
    user_options = [('compiler=', 'c', 'specify the compiler type')]

    help_options = [
        ('help-compiler', None,
         "list available compilers", show_compilers),
        ]

    compiler = None

    def initialize_options (self):
        self.compiler= None
    def finalize_options (self):
        #self.compiler='mingw32'
        pass
        
    def run(self):
        print "compiling chipmunk..."
        
        compiler = cc.new_compiler(compiler=self.compiler)

        sources = [os.path.join('chipmunk_src',x) for x in os.listdir('chipmunk_src') if x[-1] == 'c']
        preargs = ['-O3', '-std=gnu99', '-ffast-math']
        objs = compiler.compile(sources, extra_preargs=preargs)
        libname = 'chipmunk'
        compiler.link_shared_lib(objs, libname, output_dir='pymunk')

# todo: add/remove/think about this list :)
classifiers = ['Development Status :: 3 - Alpha'
    , 'License :: OSI Approved :: MIT License'
    , 'Operating System :: OS Independent'
    , 'Programming Language :: Python'
    , 'Topic :: Games/Entertainment'
    , 'Topic :: Software Development :: Libraries'   
]

setup(
    name='pymunk'
    , url='http://pymunk.googlecode.com'
    , author='<NAME>'
    , author_email='<EMAIL>'
    , version='0.7.1' # remember to change me for new versions!
    , description='A wrapper for the 2d physics library Chipmunk'
    , long_description='A wrapper for the 2d rigid body physics library Chipmunk'
    , packages=['pymunk'] #find_packages(exclude=['*.tests']),
    , package_data = {'pymunk': ['libchipmunk.dll', 'libchipmunk32.so', 'libchipmunk64.so', 'libchipmunk.so', 'libchipmunk.dylib']}
    , platforms=['any']
    , license='MIT License'
    , classifiers=classifiers
    , include_package_data = True
    , cmdclass={'build_chipmunk':build_chipmunk}
    )
    
    

<commit_msg>hopefully setup.py will work better on osx now<commit_after>import distutils.ccompiler as cc
import os, os.path
import sys, platform
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, Command, find_packages

def show_compilers ():
    from distutils.ccompiler import show_compilers
    show_compilers()

class build_chipmunk(Command):
    description = """compile Chipmunk to a shared library"""
    
    user_options = [('compiler=', 'c', 'specify the compiler type')
        ,('no-osx-hack', None, 'do not use the mac osx hack')]

    help_options = [
        ('help-compiler', None,
         "list available compilers", show_compilers),
        ]

    compiler = None
    no_osx_hack = False
    
    def initialize_options (self):
        self.compiler= None
    def finalize_options (self):
        #self.compiler='mingw32'
        pass
        
    def run(self):
        print "compiling chipmunk..."
        compiler = cc.new_compiler(compiler=self.compiler)

        sources = [os.path.join('chipmunk_src',x) for x in os.listdir('chipmunk_src') if x[-1] == 'c']
        compiler_preargs = ['-O3', '-std=gnu99', '-ffast-math']
        objs = compiler.compile(sources, extra_preargs=compiler_preargs)
        libname = 'chipmunk'
        link_preargs = []
        if platform.system() == 'Darwin' and not self.no_osx_hack:
            link_preargs.append("-dynamiclib")
        compiler.link_shared_lib(objs, libname, output_dir='pymunk', extra_preargs=link_preargs)

# todo: add/remove/think about this list :)
classifiers = ['Development Status :: 3 - Alpha'
    , 'License :: OSI Approved :: MIT License'
    , 'Operating System :: OS Independent'
    , 'Programming Language :: Python'
    , 'Topic :: Games/Entertainment'
    , 'Topic :: Software Development :: Libraries'   
]

setup(
    name='pymunk'
    , url='http://pymunk.googlecode.com'
    , author='<NAME>'
    , author_email='<EMAIL>'
    , version='0.7.1' # remember to change me for new versions!
    , description='A wrapper for the 2d physics library Chipmunk'
    , long_description='A wrapper for the 2d rigid body physics library Chipmunk'
    , packages=['pymunk'] #find_packages(exclude=['*.tests']),
    , package_data = {'pymunk': ['libchipmunk.dll', 'libchipmunk32.so', 'libchipmunk64.so', 'libchipmunk.so', 'libchipmunk.dylib']}
    , platforms=['any']
    , license='MIT License'
    , classifiers=classifiers
    , include_package_data = True
    , cmdclass={'build_chipmunk':build_chipmunk}
    )
    
    


{'fraction_non_alphanumeric': 0.12889637742207244, 'fraction_numerical': 0.006739679865206402, 'mean_word_length': 3.289972899728997, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1575509', 'n_tokens_mistral': 1548, 'n_tokens_neox': 1508, 'n_words': 358}