[Python-ogre-commit] SF.net SVN: python-ogre:[820] trunk/python-ogre
Brought to you by:
andy_miller,
roman_yakovenko
From: <and...@us...> - 2008-11-27 02:09:15
|
Revision: 820 http://python-ogre.svn.sourceforge.net/python-ogre/?rev=820&view=rev Author: andy_miller Date: 2008-11-27 02:09:10 +0000 (Thu, 27 Nov 2008) Log Message: ----------- Fix for bullet libraries - working in both windows and linx Improvements to docstrings -- remove excess white space and wrap long lines Windows bullet now using 2.72 (same as Linux) Modified Paths: -------------- trunk/python-ogre/PythonOgreConfig_nt.py trunk/python-ogre/code_generators/bullet/generate_code.py trunk/python-ogre/code_generators/common_utils/extract_documentation.py trunk/python-ogre/code_generators/ogrebulletd/generate_code.py trunk/python-ogre/code_generators/ogrenewt/generate_code.py trunk/python-ogre/code_generators/physx/generate_code.py trunk/python-ogre/environment.py Modified: trunk/python-ogre/PythonOgreConfig_nt.py =================================================================== --- trunk/python-ogre/PythonOgreConfig_nt.py 2008-11-26 06:01:27 UTC (rev 819) +++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-11-27 02:09:10 UTC (rev 820) @@ -72,7 +72,7 @@ PATH_opensteer = os.path.join(BASE_DIR, 'opensteer', 'trunk') PATH_ogrevideoffmpeg = os.path.join(PATH_THIRDPARTY,'ffmpeg') -PATH_Bullet= os.path.join(BASE_DIR, 'bullet-2.70') +PATH_Bullet= os.path.join(BASE_DIR, 'bullet-2.72') PATH_PhysX= "c:/program files/NVIDIA Corporation/NVIDIA Physx SDK/v2.8.1/SDKs" PATH_Theora= os.path.join(PATH_OgreAddons,'videoplugin','TheoraVideo') PATH_ffmpeg= os.path.join(PATH_THIRDPARTY,'extra') Modified: trunk/python-ogre/code_generators/bullet/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/bullet/generate_code.py 2008-11-26 06:01:27 UTC (rev 819) +++ trunk/python-ogre/code_generators/bullet/generate_code.py 2008-11-27 02:09:10 UTC (rev 820) @@ -81,7 +81,6 @@ ,'::btCompoundShape::createAabbTreeFromChildren' ,'::btCollisionAlgorithm::getDispatcherId' ,'::btCollisionAlgorithmConstructionInfo::getDispatcherId' - ,'::btQuantizedBvh::walkRecursiveQuantizedTreeAgainstQuantizedTree' ,'::btCapsuleShape::calculateLocalInertia' ,'::btCapsuleShape::localGetSupportingVertexWithoutMargin' @@ -99,9 +98,9 @@ ,'::btMultiSapBroadphase::createProxy' ,'::btMultiSapBroadphase::quicksort' ,'::btBvhTriangleMeshShape::setOptimizedBvh' # new in 2.70 + ,'::btQuantizedBvh::walkRecursiveQuantizedTreeAgainstQuantizedTree' # 2.72 + ] - - ] for e in excludes: print "excluding function", e global_ns.member_functions(e).exclude() @@ -126,11 +125,6 @@ # ,'btAlignedAllocator<btDbvt::sStkNPS, 16u>' ,'btAlignedAllocator<btMultiSapBroadphase::btBridgeProxy*, 16u>' ,'btAlignedAllocator<btMultiSapBroadphase::btMultiSapProxy*, 16u>' -# ,'btAlignedAllocator<btOdeContactJoint, 16u>' -# ,'btAlignedAllocator<btOdeJoint*, 16u>' -# ,'btAlignedAllocator<btOdeSolverBody, 16u>' -# ,'btAlignedAllocator<btOdeSolverBody*, 16u>' -# ,'btAlignedAllocator<btOdeTypedJoint, 16u>' ,'btAlignedAllocator<unsigned int, 16u>' ,'btAlignedAllocator<unsigned short, 16u>' # ,'btAlignedObjectArray<btDbvt::Node const*>' @@ -150,10 +144,18 @@ # ,'btAlignedObjectArray<btQuantizedBvhNode>' # ,'btAlignedObjectArray<btOptimizedBvhNode>' # ,'btAlignedObjectArray<btCollisionObject*>' - ,'btDbvtBroadphase' + ,'btDbvtBroadphase' ,'btContinuousDynamicsWorld' # ,'btSorLcpSolver' ] +# # if environment.isWindows(): +# # excludes.extend(['btAlignedAllocator<btOdeContactJoint, 16u>' +# # ,'btAlignedAllocator<btOdeJoint*, 16u>' +# # ,'btAlignedAllocator<btOdeSolverBody, 16u>' +# # ,'btAlignedAllocator<btOdeSolverBody*, 16u>' +# # ,'btAlignedAllocator<btOdeTypedJoint, 16u>' +# # ] ) + for e in excludes: print "excluding class", e global_ns.class_(e).exclude() Modified: trunk/python-ogre/code_generators/common_utils/extract_documentation.py =================================================================== --- trunk/python-ogre/code_generators/common_utils/extract_documentation.py 2008-11-26 06:01:27 UTC (rev 819) +++ trunk/python-ogre/code_generators/common_utils/extract_documentation.py 2008-11-27 02:09:10 UTC (rev 820) @@ -96,7 +96,9 @@ return "" ret ="" if doc_lines: - doc_lines = remove_leading_blanks ( doc_lines ) + doc_lines = removeBlankLines ( doc_lines ) + doc_lines = removeLeadingSpace ( doc_lines ) + doc_lines = wrapLines ( doc_lines ) #print "Extracted Doc String for:", declaration, "[", len(doc_lines),"]" ## we need to cope with strings longer than 2048 for MSVC ret = "\\\n".join(doc_lines) @@ -123,42 +125,89 @@ # # self.outfile.write("***============================*****\n" + declaration.decl_string + "\n") # # self.outfile.write( str(len(basedoc)) + " " + str(len(newret)) + "\n" ) # # self.outfile.write( newret ) + return '"' + basedoc + newret.lstrip() + '"' else: return "" -def remove_leading_blanks ( docin ): +#=============================================================== +def removeBlankLines ( docin ): """ - remove any initial lines that are '\n\' - """ - returnlist=[] - - if docin[0].strip() != "\\n": -# # print "** ", docin[0] - return docin # nothing to fix so return the original list.. + remove leading and trailing blank lines + """ + # first remove leading blank lines + x = 0 + while x < len ( docin ) - 1 : + if docin[x].strip() == "\\n" or docin[x].strip() == '': + del docin[x] + x = x - 1 + else: + break + x += 1 - fixed = False - for line in docin: - if not fixed: - if line.strip() != "\\n": - fixed = True - if fixed: - returnlist.append(line) - return returnlist - - -def get_generic_doc(declaration): + # now from the bottom up + x = len ( docin ) -1 + while x >= 0: + if docin[x].strip() == "\\n": + del docin[x] + else: + break + x = len ( docin )- 1 + + return docin + +#=============================================================== +def removeLeadingSpace ( docin ): """ - generate call information about function or method + remove leading spaces/tabs to bring minimize space usage """ - try: - return '"' + "Help on %s\n" % str(declaration) + '"' - except: - pass + import string as string + c = 0 + for x in range ( len (docin) ): + docin[x] = docin[x].expandtabs(3) # replace tab characters with 3 spaces - return '' - - - + remove = -1 # use to track number of leading spaces to remove. -1 indicates first time through + for x in range ( len (docin) ): + c = 0 + for y in range ( len ( docin[x]) ): # now lets count any leading spaces + if docin[x][y] in string.whitespace: + c +=1 + else: + break + if c > 0: # Ok so we found leading space + if remove < 0: # must be first time through + remove = c + else: + if c < remove: # ensure we get the lowest common value + remove = c + else: # Ok we found a line without any leading spaces so it's all off + remove = -1 + break + if remove > 0: # lets do it again and remove a set of leading spaces + for x in range ( len (docin) ): + docin[x] = docin[x][remove:] + return docin + +#=============================================================== +def wrapLines ( docin, maxlen = 100 ): + """ + Break line length to a max while retaining the leading spaces... + """ + import textwrap as textwrap + import string + docout = [] + for line in docin: + prefix=0 + for c in line: + if c in string.whitespace: + prefix += 1 + else: + break + for l in textwrap.wrap( line, maxlen ): + line = ' '*prefix + l.lstrip() + docout.append ( line ) + return docout + + def code(str): """ detect str is code? Modified: trunk/python-ogre/code_generators/ogrebulletd/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogrebulletd/generate_code.py 2008-11-26 06:01:27 UTC (rev 819) +++ trunk/python-ogre/code_generators/ogrebulletd/generate_code.py 2008-11-27 02:09:10 UTC (rev 820) @@ -57,16 +57,16 @@ if MAIN_NAMESPACE: main_ns = global_ns.namespace( MAIN_NAMESPACE ) else: - main_ns = global_ns - excludes=['::btSimulationIslandManager' - ] + main_ns = global_ns + excludes=[] + if environment.isLinux(): + excludes.append('::btSimulationIslandManager') for e in excludes: print "excluding class", e - global_ns.class_(e).exclude() - for c in global_ns.classes(): - #if not c.ignore: - print c - sys.exit(-1) + global_ns.class_(e).exclude() +# for c in global_ns.classes(): +# #if not c.ignore: +# print c ############################################################ ## Modified: trunk/python-ogre/code_generators/ogrenewt/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/ogrenewt/generate_code.py 2008-11-26 06:01:27 UTC (rev 819) +++ trunk/python-ogre/code_generators/ogrenewt/generate_code.py 2008-11-27 02:09:10 UTC (rev 820) @@ -6,7 +6,12 @@ # # -import os, sys, time +import os, sys, time, shutil +try: + import psyco + psyco.full() +except ImportError: + pass #add environment to the path sys.path.append( os.path.join( '..', '..' ) ) Modified: trunk/python-ogre/code_generators/physx/generate_code.py =================================================================== --- trunk/python-ogre/code_generators/physx/generate_code.py 2008-11-26 06:01:27 UTC (rev 819) +++ trunk/python-ogre/code_generators/physx/generate_code.py 2008-11-27 02:09:10 UTC (rev 820) @@ -384,6 +384,7 @@ else: defined_symbols = ['LINUX','NX_DISABLE_FLUIDS'] defined_symbols.append( 'VERSION_' + environment.physx.version ) + defined_symbols.append ( '__PYTHONOGRE_BUILD_CODE' ) # # build the core Py++ system from the GCCXML created source Modified: trunk/python-ogre/environment.py =================================================================== --- trunk/python-ogre/environment.py 2008-11-26 06:01:27 UTC (rev 819) +++ trunk/python-ogre/environment.py 2008-11-27 02:09:10 UTC (rev 820) @@ -1327,6 +1327,14 @@ CheckIncludes=[] if isWindows(): libs=[ boost.lib, 'NxCharacter', 'NxCooking', 'PhysXLoader' ] + source = [ + [wget, "http://developer.download.nvidia.com/PhysX/2.8.1/PhysX_2.8.1_SDK_Core.msi", downloadPath] + ] + buildCmds = [ + [0, os.path.join(downloadPath, "PhysX_2.8.1_SDK_Core.msi"),'' ], + [0, 'sed -i s/"#ifdef WIN32"/"#if (defined WIN32) \&\& !(defined __PYTHONOGRE_BUILD_CODE)"/ NxMath.h', + 'c:\\program files\\NVIDIA Corporation\\NVIDIA PhysX SDK\\v2.8.1\\SDKs\\Foundation\\include'] + ] elif isLinux(): libs=[ boost.lib, 'NxCharacter', 'NxCooking', 'PhysXCore', 'PhysXLoader' ] libs.append ( boost_python_index.lib ) @@ -1542,15 +1550,14 @@ base = "bullet-" + version baseDir = os.path.join(os.getcwd(), base) parent = "ogre/physics" - libs=[boost.lib, 'LibBulletCollision', 'LibBulletDynamics','LibLinearMath'] + libs=[boost.lib, 'LibBulletCollision', 'LibBulletDynamics','LibBulletSoftBody','LibBulletMultiThreaded'] if isWindows(): - pass - #libs.append('libbulletMath') + libs.append('libbulletMath') else: - #libs.append('libbulletmath') - libs.append('LibBulletSoftBody') + libs.append('LibLinearMath') +# libs.append('LibBulletSoftBody') #libs.append('libbulletcolladaconverter') - libs.append('LibBulletMultiThreaded') +# libs.append('LibBulletMultiThreaded') libs.append ( boost_python_index.lib ) lib_dirs = [ Config.PATH_LIB_Boost @@ -1595,12 +1602,12 @@ cflags = "" parent = "ogre/physics" libs = [boost.lib, 'OgreMain', - 'LibBulletCollision', 'LibBulletDynamics','LibBulletMultiThreaded','LibBulletSoftBody','LibLinearMath' + 'LibBulletCollision', 'LibBulletDynamics','LibBulletMultiThreaded','LibBulletSoftBody' ] -# if isWindows(): -# libs.append('libbulletmath') -# else: -# libs.append('liblinearmath') + if isLinux(): + libs.append('LibLinearMath') + else: + libs.append('libbulletmath') include_dirs = [Config.PATH_Boost , Config.PATH_INCLUDE_Bullet , os.path.join(Config.PATH_OgreBullet, 'Collisions' ) @@ -1627,9 +1634,13 @@ name='ogrebulletd' cflags = "" parent = "ogre/physics" - libs = [boost.lib, 'OgreMain', - 'LibBulletCollision', 'LibBulletDynamics','LibBulletMultiThreaded','LibBulletSoftBody','LibLinearMath' - ] + + libs=[boost.lib, 'OgreMain', 'LibBulletCollision', 'LibBulletDynamics','LibBulletSoftBody','LibBulletMultiThreaded'] + if isWindows(): + libs.append('libbulletMath') + else: + libs.append('LibLinearMath') + # if isWindows(): # libs.append('libbulletmath') # else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |