Author: ArcRiley Date: 2008-04-18 20:33:03 -0400 (Fri, 18 Apr 2008) New Revision: 1237
Added: trunk/pysoy/setup-pyrex.py Removed: trunk/pysoy/setup.py Log: Moving the old setup.py out of the way Copied: trunk/pysoy/setup-pyrex.py (from rev 1235, trunk/pysoy/setup.py) =================================================================== --- trunk/pysoy/setup-pyrex.py (rev 0) +++ trunk/pysoy/setup-pyrex.py 2008-04-19 00:33:03 UTC (rev 1237) @@ -0,0 +1,199 @@ +#!/usr/bin/env python +''' PySoy's compile and install script ''' +''' + Copyright (C) 2006,2007,2008 PySoy Group + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see http://www.gnu.org/licenses/ + + $Id$ +''' + +import os +import sys +from stat import * +from distutils.core import setup +from distutils.extension import Extension +from Pyrex.Compiler import Main + +if Main.Version.version < '0.9.6.4': + raise SystemError('Pyrex version 0.9.6.4 or above required, aborting.') + +version = 'Trunk' +modules = { + '_core' : ['GLEW', 'GL', 'ode', 'glib-2.0'], + '_datatypes' : ['GLEW', 'GL', 'ode', 'glib-2.0', 'openal'], + '_internals' : ['glib-2.0', 'gthread-2.0'], + 'actions' : ['ode'], + 'atoms' : [], + 'audio' : ['openal'], + 'bodies' : ['GLEW','GL','ode'], + 'colors' : ['GL'], + 'controllers' : [], + 'fields' : ['GL','ode'], + 'joints' : ['GL','ode'], + 'masses' : [ 'ode'], + 'materials' : ['GL','GLEW'], + 'models' : ['GLEW','GL','GLU','ode'], + 'textures' : ['GLEW','GL', 'theora', 'ogg', 'cairo'], + 'scenes' : ['GL', 'ode'], + 'shapes' : ['ode'], + 'transports' : ['ogg'], + 'widgets' : ['GLEW','GL','GLU'], +} + +extensions =[] +pyrex_sources=[] +scripts =[] +include_path =['include/'] +for m in modules: + pyrex_sources.append('src/%s/soy.%s.pyx'%(m,m)) + include_path.append('src/%s/'%m) + +############################################################################ +# Platform-dependent submodules + +# MS Windows +if sys.platform == 'win32' : + translate = { + 'GLEW' : 'glew32', + 'GL' : 'opengl32', + 'ode' : 'ode', + 'glib-2.0' : 'glib-2.0', + 'gthread-2.0' : 'gthread-2.0', + 'ogg' : 'ogg', + 'GLU' : 'glu32', + 'theora' : 'theora', + 'cairo' : 'cairo', + 'gdi32' : 'gdi32', + 'openal' : 'openal', + } + modules['_core'].append('gdi32') + for m in modules: + extensions.append(Extension(name=m, + sources=['src/%s/soy.%s.c'%(m,m)], + libraries=[translate[i] for i in modules[m]])) + scripts.append('win32_postinstall.py') + +# Apple OSX +elif sys.platform == 'darwin' : + frameworks = ['-framework', 'Carbon', + '-framework', 'OpenGL', + ] + for m in modules: + extensions.append(Extension(name=m, + sources=['src/%s/soy.%s.c'%(m,m)], + libraries=modules[m], + extra_compile_args = frameworks, + extra_link_args = frameworks)) + +# GNU/Linux, BSD, etc +else : + include_dirs = ['-I', '/usr/include/glib-2.0', + '-I', '/usr/lib/glib-2.0/include', + '-I', '/usr/include/cairo', + '-I', '/usr/local/include', + ] + modules['_core'].append('X11') + modules['_core'].append('Xxf86vm') + for m in modules: + extensions.append(Extension(name=m, + sources=['src/%s/soy.%s.c'%(m,m)], + extra_compile_args = include_dirs, + libraries=modules[m])) + +# +############################################################################ + + +# process Pyrex sources to C + +options = Main.CompilationOptions(defaults=Main.default_options, + include_path=include_path) + +newestpxd = 0 +for dir in include_path: + for pxdsource in os.listdir(dir): + pxdsource_path = (os.path.join(dir, pxdsource)) + + if os.path.isfile(pxdsource_path) and \ + os.path.splitext(pxdsource_path)[1] == '.pxd' and \ + os.stat(pxdsource_path)[ST_MTIME] > newestpxd : + newestpxd = os.stat(pxdsource_path)[ST_MTIME] + +error = False +for pyxsource in pyrex_sources: + csource = os.path.splitext(pyxsource)[0] + '.c' + if os.path.isfile(csource) : + ctime = os.stat(csource)[ST_MTIME] + else: + ctime = 0 + + pyxsourcedir = os.path.split(pyxsource)[0] + pxisources = [] + for pfile in os.listdir(pyxsourcedir) : + if (os.path.splitext(pfile)[1] == '.pxi' or + os.path.splitext(pfile)[1] == '.pym' ) : + pxisources.append('%s/%s'%(pyxsourcedir,pfile)) + + newestpxi = 0 + for pxisource in pxisources : + pxitime = os.stat(pxisource)[ST_MTIME] + if pxitime>newestpxi : + newestpxi = pxitime + + pyxtime = os.stat(pyxsource)[ST_MTIME] + if newestpxd > ctime or newestpxi > ctime or pyxtime > ctime : + extname = os.path.splitext(pyxsource)[0].split('/')[-1][4:] + print "processing '%s' extension" % extname + result = Main.compile(pyxsource, options) + if result.num_errors: + error = True + +if error: + raise Exception("Error compiling Pyrex sources: Aborting compilation.") + + +setup( + name = 'PySoy', + version = version, + description = '3D Game Engine for Python', + long_description = ''' ''', + author = 'PySoy Group', + author_email = '[EMAIL PROTECTED]', + maintainer = 'Arc Riley', + maintainer_email = '[EMAIL PROTECTED]', + url = 'http://pysoy.org/', + download_url = 'http://svn.pysoy.org/trunk/pysoy', + packages = ['soy'], + package_dir = {'soy' : 'scripts'}, + ext_package = 'soy', + ext_modules = extensions, + classifiers = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Natural Language :: English', + 'Topic :: Education', + 'Topic :: Games/Entertainment', + 'Topic :: Multimedia :: Graphics', + 'Topic :: Scientific/Engineering :: Artificial Intelligence', + 'Topic :: Scientific/Engineering :: Human Machine Interfaces', + 'Topic :: Scientific/Engineering :: Visualization', + 'License :: OSI Approved :: GNU Affero General Public License (AGPL)' ], + license = 'GNU Affero General Public License version 3 (AGPLv3)', + # This is so we can have code written in C thrown in with our Pyrex code. + # (This is used in particular to access the Windows API without binding + # a huge swath of it to Pyrex, and do some preprocessor trickery.) + include_dirs = [os.path.abspath(p) for p in include_path], + scripts = scripts, +) Deleted: trunk/pysoy/setup.py =================================================================== --- trunk/pysoy/setup.py 2008-04-12 07:18:36 UTC (rev 1236) +++ trunk/pysoy/setup.py 2008-04-19 00:33:03 UTC (rev 1237) @@ -1,199 +0,0 @@ -#!/usr/bin/env python -''' PySoy's compile and install script ''' -''' - Copyright (C) 2006,2007,2008 PySoy Group - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see http://www.gnu.org/licenses/ - - $Id$ -''' - -import os -import sys -from stat import * -from distutils.core import setup -from distutils.extension import Extension -from Pyrex.Compiler import Main - -if Main.Version.version < '0.9.6.4': - raise SystemError('Pyrex version 0.9.6.4 or above required, aborting.') - -version = 'Trunk' -modules = { - '_core' : ['GLEW', 'GL', 'ode', 'glib-2.0'], - '_datatypes' : ['GLEW', 'GL', 'ode', 'glib-2.0', 'openal'], - '_internals' : ['glib-2.0', 'gthread-2.0'], - 'actions' : ['ode'], - 'atoms' : [], - 'audio' : ['openal'], - 'bodies' : ['GLEW','GL','ode'], - 'colors' : ['GL'], - 'controllers' : [], - 'fields' : ['GL','ode'], - 'joints' : ['GL','ode'], - 'masses' : [ 'ode'], - 'materials' : ['GL','GLEW'], - 'models' : ['GLEW','GL','GLU','ode'], - 'textures' : ['GLEW','GL', 'theora', 'ogg', 'cairo'], - 'scenes' : ['GL', 'ode'], - 'shapes' : ['ode'], - 'transports' : ['ogg'], - 'widgets' : ['GLEW','GL','GLU'], -} - -extensions =[] -pyrex_sources=[] -scripts =[] -include_path =['include/'] -for m in modules: - pyrex_sources.append('src/%s/soy.%s.pyx'%(m,m)) - include_path.append('src/%s/'%m) - -############################################################################ -# Platform-dependent submodules - -# MS Windows -if sys.platform == 'win32' : - translate = { - 'GLEW' : 'glew32', - 'GL' : 'opengl32', - 'ode' : 'ode', - 'glib-2.0' : 'glib-2.0', - 'gthread-2.0' : 'gthread-2.0', - 'ogg' : 'ogg', - 'GLU' : 'glu32', - 'theora' : 'theora', - 'cairo' : 'cairo', - 'gdi32' : 'gdi32', - 'openal' : 'openal', - } - modules['_core'].append('gdi32') - for m in modules: - extensions.append(Extension(name=m, - sources=['src/%s/soy.%s.c'%(m,m)], - libraries=[translate[i] for i in modules[m]])) - scripts.append('win32_postinstall.py') - -# Apple OSX -elif sys.platform == 'darwin' : - frameworks = ['-framework', 'Carbon', - '-framework', 'OpenGL', - ] - for m in modules: - extensions.append(Extension(name=m, - sources=['src/%s/soy.%s.c'%(m,m)], - libraries=modules[m], - extra_compile_args = frameworks, - extra_link_args = frameworks)) - -# GNU/Linux, BSD, etc -else : - include_dirs = ['-I', '/usr/include/glib-2.0', - '-I', '/usr/lib/glib-2.0/include', - '-I', '/usr/include/cairo', - '-I', '/usr/local/include', - ] - modules['_core'].append('X11') - modules['_core'].append('Xxf86vm') - for m in modules: - extensions.append(Extension(name=m, - sources=['src/%s/soy.%s.c'%(m,m)], - extra_compile_args = include_dirs, - libraries=modules[m])) - -# -############################################################################ - - -# process Pyrex sources to C - -options = Main.CompilationOptions(defaults=Main.default_options, - include_path=include_path) - -newestpxd = 0 -for dir in include_path: - for pxdsource in os.listdir(dir): - pxdsource_path = (os.path.join(dir, pxdsource)) - - if os.path.isfile(pxdsource_path) and \ - os.path.splitext(pxdsource_path)[1] == '.pxd' and \ - os.stat(pxdsource_path)[ST_MTIME] > newestpxd : - newestpxd = os.stat(pxdsource_path)[ST_MTIME] - -error = False -for pyxsource in pyrex_sources: - csource = os.path.splitext(pyxsource)[0] + '.c' - if os.path.isfile(csource) : - ctime = os.stat(csource)[ST_MTIME] - else: - ctime = 0 - - pyxsourcedir = os.path.split(pyxsource)[0] - pxisources = [] - for pfile in os.listdir(pyxsourcedir) : - if (os.path.splitext(pfile)[1] == '.pxi' or - os.path.splitext(pfile)[1] == '.pym' ) : - pxisources.append('%s/%s'%(pyxsourcedir,pfile)) - - newestpxi = 0 - for pxisource in pxisources : - pxitime = os.stat(pxisource)[ST_MTIME] - if pxitime>newestpxi : - newestpxi = pxitime - - pyxtime = os.stat(pyxsource)[ST_MTIME] - if newestpxd > ctime or newestpxi > ctime or pyxtime > ctime : - extname = os.path.splitext(pyxsource)[0].split('/')[-1][4:] - print "processing '%s' extension" % extname - result = Main.compile(pyxsource, options) - if result.num_errors: - error = True - -if error: - raise Exception("Error compiling Pyrex sources: Aborting compilation.") - - -setup( - name = 'PySoy', - version = version, - description = '3D Game Engine for Python', - long_description = ''' ''', - author = 'PySoy Group', - author_email = '[EMAIL PROTECTED]', - maintainer = 'Arc Riley', - maintainer_email = '[EMAIL PROTECTED]', - url = 'http://pysoy.org/', - download_url = 'http://svn.pysoy.org/trunk/pysoy', - packages = ['soy'], - package_dir = {'soy' : 'scripts'}, - ext_package = 'soy', - ext_modules = extensions, - classifiers = [ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Natural Language :: English', - 'Topic :: Education', - 'Topic :: Games/Entertainment', - 'Topic :: Multimedia :: Graphics', - 'Topic :: Scientific/Engineering :: Artificial Intelligence', - 'Topic :: Scientific/Engineering :: Human Machine Interfaces', - 'Topic :: Scientific/Engineering :: Visualization', - 'License :: OSI Approved :: GNU Affero General Public License (AGPL)' ], - license = 'GNU Affero General Public License version 3 (AGPLv3)', - # This is so we can have code written in C thrown in with our Pyrex code. - # (This is used in particular to access the Windows API without binding - # a huge swath of it to Pyrex, and do some preprocessor trickery.) - include_dirs = [os.path.abspath(p) for p in include_path], - scripts = scripts, -) _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn