"""Setup PyUI using distutils""" from distutils.core import setup if __name__ == "__main__": import os, sys ############## ## Following is from Pete Shinners, ## apparently it will work around the reported bug on ## some unix machines where the data files are copied ## to weird locations if the user's configuration options ## were entered during the wrong phase of the moon :) . from distutils.command.install_data import install_data 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') # should create the directory if it doesn't exist!!! return install_data.run(self) ############## def isPackage( filename ): return os.path.isdir(filename) and os.path.isfile( os.path.join(filename,'__init__.py')) def packagesFor( filename, basePackage="" ): """Find all packages in filename""" set = {} for item in os.listdir(filename): dir = os.path.join(filename, item) if isPackage( dir ): if basePackage: moduleName = basePackage+'.'+item else: moduleName = item set[ moduleName] = dir set.update( packagesFor( dir, moduleName)) return set def npFilesFor( dirname ): """Return all non-python-file filenames in dir""" result = [] allResults = [] for name in os.listdir(dirname): path = os.path.join( dirname, name ) if os.path.isfile( path) and os.path.splitext( name )[1] not in ('.py','.pyc','.pyo'): result.append( path ) elif os.path.isdir( path ) and name.lower() !='cvs': allResults.extend( npFilesFor(path)) if result: allResults.append( (dirname, result)) return allResults packages = packagesFor( "." ) dataFiles = npFilesFor( 'pyui') from sys import hexversion if hexversion >= 0x2030000: # work around distutils complaints under Python 2.2.x extraArguments = { 'classifiers': [ """License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)""", """Programming Language :: Python""", """Topic :: Software Development :: Libraries :: Python Modules""", """Intended Audience :: Developers""", """Operating System :: OS Independent""", """Topic :: Desktop Environment""", """Topic :: Games/Entertainment""", ], 'download_url': "http://sourceforge.net/project/showfiles.php?group_id=27499", 'keywords': 'GUI,OpenGL,GLUT,PyGame', 'long_description' : """PyUI is a user interface library written entirely in Python. It has a modular implementation that allows drawing and event input to be performed by pluggable "renderers". This makes PyUI very portable and scalable. It can run in environments from hardware accelerated 3D surfaces to regular desktop windows. PyUI was originally targeted as a User Interface for games, but it has evolved into a more general UI toolkit with applicability outside of games. """, 'platforms': ['Any'], } else: extraArguments = { } setup( name="PyUI", version="0.96", description="Python User Interface Library", author="Sean Riley", author_email="sean@twistedmatrix.com", url="http://pyui.sf.net", packages= packages, data_files= dataFiles, cmdclass = {'install_data':smart_install_data}, **extraArguments )