Browse Source

Changes for python 2.5

Josh Yelon 18 years ago
parent
commit
e6cca5ec86

+ 7 - 7
direct/src/directscripts/packpanda.nsi

@@ -235,7 +235,7 @@ Section -post
         Push "$INSTDIR\bin"
         Push "$INSTDIR\bin"
         Call AddToPath
         Call AddToPath
 
 
-        ReadRegStr $0 HKLM "Software\Python\PythonCore\2.4\InstallPath" ""
+        ReadRegStr $0 HKLM "Software\Python\PythonCore\2.5\InstallPath" ""
         StrCmp $0 "$INSTDIR\python" RegPath 0
         StrCmp $0 "$INSTDIR\python" RegPath 0
         StrCmp $0 "" RegPath 0
         StrCmp $0 "" RegPath 0
 
 
@@ -245,10 +245,10 @@ Section -post
 
 
         RegPath:
         RegPath:
         DetailPrint "Adding registry keys for python..."
         DetailPrint "Adding registry keys for python..."
-        WriteRegStr HKLM "Software\Python\PythonCore\2.4\InstallPath" "" "$INSTDIR\python"
-        WriteRegStr HKLM "Software\Python\PythonCore\2.4\Help" "" ""
-        WriteRegStr HKLM "Software\Python\PythonCore\2.4\Help\Main Python Documentation" "" "$INSTDIR\python\Doc\Python24.chm"
-        WriteRegStr HKLM "Software\Python\PythonCore\2.4\Help\Pythonwin Reference" "" "$INSTDIR\python\Lib\site-packages\PyWin32.chm"
+        WriteRegStr HKLM "Software\Python\PythonCore\2.5\InstallPath" "" "$INSTDIR\python"
+        WriteRegStr HKLM "Software\Python\PythonCore\2.5\Help" "" ""
+        WriteRegStr HKLM "Software\Python\PythonCore\2.5\Help\Main Python Documentation" "" "$INSTDIR\python\Doc\Python24.chm"
+        WriteRegStr HKLM "Software\Python\PythonCore\2.5\Help\Pythonwin Reference" "" "$INSTDIR\python\Lib\site-packages\PyWin32.chm"
         SkipRegPath:
         SkipRegPath:
         !endif
         !endif
 
 
@@ -273,9 +273,9 @@ Section Uninstall
         Push "$INSTDIR\bin"
         Push "$INSTDIR\bin"
         Call un.RemoveFromPath
         Call un.RemoveFromPath
 
 
-        ReadRegStr $0 HKLM "Software\Python\PythonCore\2.4\InstallPath" ""
+        ReadRegStr $0 HKLM "Software\Python\PythonCore\2.5\InstallPath" ""
         StrCmp $0 "$INSTDIR\python" 0 SkipUnReg
         StrCmp $0 "$INSTDIR\python" 0 SkipUnReg
-        DeleteRegKey HKLM "Software\Python\PythonCore\2.4"
+        DeleteRegKey HKLM "Software\Python\PythonCore\2.5"
         SkipUnReg:
         SkipUnReg:
         !endif
         !endif
 
 

+ 2 - 0
direct/src/extensions_native/CInterval_extensions.py

@@ -1,7 +1,9 @@
 from extension_native_helpers import *
 from extension_native_helpers import *
 try:
 try:
+  Dtool_PreloadDLL("libp3direct")
   from libp3direct import *
   from libp3direct import *
 except:
 except:
+  Dtool_PreloadDLL("libdirect")
   from libdirect import *
   from libdirect import *
 
 
 #####################################################################
 #####################################################################

+ 2 - 0
direct/src/extensions_native/EggGroupNode_extensions.py

@@ -1,5 +1,7 @@
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpandaegg")
 from libpandaegg import *
 from libpandaegg import *
+
 ####################################################################
 ####################################################################
 #Dtool_funcToMethod(func, class)        
 #Dtool_funcToMethod(func, class)        
 #del func
 #del func

+ 2 - 0
direct/src/extensions_native/EggPrimitive_extensions.py

@@ -1,5 +1,7 @@
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpandaegg")
 from libpandaegg import *
 from libpandaegg import *
+
 ####################################################################
 ####################################################################
 #Dtool_funcToMethod(func, class)        
 #Dtool_funcToMethod(func, class)        
 #del func
 #del func

+ 1 - 0
direct/src/extensions_native/HTTPChannel_extensions.py

@@ -1,4 +1,5 @@
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpandaexpress")
 from libpandaexpress import *
 from libpandaexpress import *
 
 
 ####################################################################
 ####################################################################

+ 2 - 0
direct/src/extensions_native/Mat3_extensions.py

@@ -1,5 +1,7 @@
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpanda")
 from libpanda import *
 from libpanda import *
+
 ####################################################################
 ####################################################################
 #Dtool_funcToMethod(func, class)        
 #Dtool_funcToMethod(func, class)        
 #del func
 #del func

+ 1 - 1
direct/src/extensions_native/NodePathCollection_extensions.py

@@ -1,7 +1,7 @@
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpanda")
 from libpanda import *
 from libpanda import *
 
 
-
 #####################################################################
 #####################################################################
 
 
 # For iterating over children
 # For iterating over children

+ 1 - 1
direct/src/extensions_native/NodePath_extensions.py

@@ -1,5 +1,5 @@
-
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpanda")
 from libpanda import *
 from libpanda import *
 
 
 ####################################################################
 ####################################################################

+ 1 - 1
direct/src/extensions_native/OdeBody_extensions.py

@@ -1,5 +1,5 @@
-
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpanda")
 from libpanda import *
 from libpanda import *
 
 
 ####################################################################
 ####################################################################

+ 1 - 1
direct/src/extensions_native/OdeGeom_extensions.py

@@ -1,5 +1,5 @@
-
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpanda")
 from libpanda import *
 from libpanda import *
 
 
 ####################################################################
 ####################################################################

+ 1 - 1
direct/src/extensions_native/OdeJoint_extensions.py

@@ -1,5 +1,5 @@
-
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpanda")
 from libpanda import *
 from libpanda import *
 
 
 ####################################################################
 ####################################################################

+ 1 - 1
direct/src/extensions_native/OdeSpace_extensions.py

@@ -1,5 +1,5 @@
-
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpanda")
 from libpanda import *
 from libpanda import *
 
 
 ####################################################################
 ####################################################################

+ 1 - 0
direct/src/extensions_native/Ramfile_extensions.py

@@ -1,4 +1,5 @@
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpandaexpress")
 from libpandaexpress import *
 from libpandaexpress import *
 
 
 """
 """

+ 1 - 0
direct/src/extensions_native/StreamReader_extensions.py

@@ -1,4 +1,5 @@
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpandaexpress")
 from libpandaexpress import *
 from libpandaexpress import *
 
 
 """
 """

+ 1 - 0
direct/src/extensions_native/VBase3_extensions.py

@@ -3,6 +3,7 @@ Methods to extend functionality of the VBase3 class
 """
 """
 
 
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpanda")
 from libpanda import *
 from libpanda import *
 
 
 
 

+ 1 - 0
direct/src/extensions_native/VBase4_extensions.py

@@ -3,6 +3,7 @@ Methods to extend functionality of the VBase4 class
 """
 """
 
 
 from extension_native_helpers import *
 from extension_native_helpers import *
+Dtool_PreloadDLL("libpanda")
 from libpanda import *
 from libpanda import *
 
 
 
 

+ 23 - 6
direct/src/extensions_native/extension_native_helpers.py

@@ -1,22 +1,39 @@
 ###  Tools
 ###  Tools
-__all__ = ["Dtool_ObjectToDict", "Dtool_funcToMethod"]
+__all__ = ["Dtool_ObjectToDict", "Dtool_funcToMethod", "Dtool_PreloadDLL"]
 
 
-import sys,os
+import imp,sys,os
 
 
-# Make sure the panda DLL directory is first on the path.
 if (sys.platform == "win32"):
 if (sys.platform == "win32"):
     target = None
     target = None
     for dir in sys.path + [sys.prefix]:
     for dir in sys.path + [sys.prefix]:
-        lib = os.path.join(dir,"libpandaexpress.dll")
+        lib = os.path.join(dir, "libpandaexpress.dll")
         if (os.path.exists(lib)):
         if (os.path.exists(lib)):
             target = dir
             target = dir
     if (target == None):
     if (target == None):
-        print "Cannot find libpandaexpress. Exiting."
-        sys.exit(1)
+        raise "Cannot find libpandaexpress.dll"
     path=os.environ["PATH"]
     path=os.environ["PATH"]
     if (path.startswith(target+";")==0):
     if (path.startswith(target+";")==0):
         os.environ["PATH"] = target+";"+path
         os.environ["PATH"] = target+";"+path
 
 
+def Dtool_PreloadDLL(module):
+    """ Preloading solves the problem that python 2.5 on
+    windows can't find DLLs - it can only find PYDs.  The
+    preloader is able to find DLLs."""
+
+    if (sys.platform != "win32"):
+        return
+    if (sys.modules.has_key(module)):
+        return
+    target = None
+    for dir in sys.path + [sys.prefix]:
+        lib = os.path.join(dir, module + ".dll")
+        if (os.path.exists(lib)):
+            target = dir
+    if (target == None):
+        raise "DLL loader cannot find "+module+"."
+    imp.load_dynamic(module, os.path.join(target, module + ".dll"))
+
+Dtool_PreloadDLL("libpandaexpress")
 from libpandaexpress import *
 from libpandaexpress import *
 
 
 def Dtool_ObjectToDict(clas, name, obj):
 def Dtool_ObjectToDict(clas, name, obj):

+ 4 - 0
direct/src/ffi/DoGenPyCode.py

@@ -224,6 +224,8 @@ def doErrorCheck():
         FFIConstants.CodeModuleNameList = codeLibs
         FFIConstants.CodeModuleNameList = codeLibs
 
 
 def generateNativeWrappers():
 def generateNativeWrappers():
+    from direct.extensions_native.extension_native_helpers import Dtool_PreloadDLL
+
     # Empty out the output directories of unnecessary crud from
     # Empty out the output directories of unnecessary crud from
     # previous runs before we begin.
     # previous runs before we begin.
     for file in os.listdir(outputCodeDir):
     for file in os.listdir(outputCodeDir):
@@ -253,6 +255,7 @@ def generateNativeWrappers():
     # each named module.
     # each named module.
     for moduleName in FFIConstants.CodeModuleNameList:
     for moduleName in FFIConstants.CodeModuleNameList:
         print 'Importing code library: ' + moduleName
         print 'Importing code library: ' + moduleName
+        Dtool_PreloadDLL(moduleName)
         exec('import %s as module' % moduleName)
         exec('import %s as module' % moduleName)
 
 
         pandaModules.write('from %sModules import *\n' % (moduleName))
         pandaModules.write('from %sModules import *\n' % (moduleName))
@@ -261,6 +264,7 @@ def generateNativeWrappers():
         moduleModules = open(moduleModulesFilename, 'w')
         moduleModules = open(moduleModulesFilename, 'w')
 
 
         moduleModules.write('from extension_native_helpers import *\n')
         moduleModules.write('from extension_native_helpers import *\n')
+        moduleModules.write('Dtool_PreloadDLL("%s")\n' % (moduleName))
         moduleModules.write('from %s import *\n\n' % (moduleName))
         moduleModules.write('from %s import *\n\n' % (moduleName))
 
 
         # Now look for extensions
         # Now look for extensions

+ 1 - 1
direct/src/http/WebRequest.py

@@ -1,5 +1,5 @@
 import direct
 import direct
-from libdirect import HttpRequest
+from pandac.PandaModules import HttpRequest
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.task.TaskManagerGlobal import taskMgr
 from direct.task.TaskManagerGlobal import taskMgr
 
 

+ 1 - 1
direct/src/showbase/PythonUtil.py

@@ -45,9 +45,9 @@ import gc
 import traceback
 import traceback
 
 
 from direct.directutil import Verify
 from direct.directutil import Verify
-
 # Don't import libpandaexpressModules, which doesn't get built until
 # Don't import libpandaexpressModules, which doesn't get built until
 # genPyCode.
 # genPyCode.
+import direct.extensions_native.extension_native_helpers
 from libpandaexpress import ConfigVariableBool
 from libpandaexpress import ConfigVariableBool
 
 
 ScalarTypes = (types.FloatType, types.IntType, types.LongType)
 ScalarTypes = (types.FloatType, types.IntType, types.LongType)

+ 2 - 0
direct/src/task/Task.py

@@ -19,8 +19,10 @@ import fnmatch
 import string
 import string
 import signal
 import signal
 try:
 try:
+    Dtool_PreloadDLL("libp3heapq")
     from libp3heapq import heappush, heappop, heapify
     from libp3heapq import heappush, heappop, heapify
 except:
 except:
+    Dtool_PreloadDLL("libheapq")
     from libheapq import heappush, heappop, heapify
     from libheapq import heappush, heappop, heapify
 import types
 import types
 
 

+ 1 - 1
doc/makepanda/makepanda.py

@@ -1041,7 +1041,7 @@ if (COMPILER=="MSVC"):
     CopyAllFiles("built/bin/", THIRDPARTYLIBS+"extras"+"/bin/")
     CopyAllFiles("built/bin/", THIRDPARTYLIBS+"extras"+"/bin/")
 if (sys.platform == "win32"):
 if (sys.platform == "win32"):
     if (PkgSkip("PYTHON")==0):
     if (PkgSkip("PYTHON")==0):
-        CopyFile('built/bin/python24.dll', 'thirdparty/win-python/python24.dll')
+        CopyFile('built/bin/python25.dll', 'thirdparty/win-python/python25.dll')
         CopyTree('built/python', 'thirdparty/win-python')
         CopyTree('built/python', 'thirdparty/win-python')
         ConditionalWriteFile('built/python/panda.pth',"..\n../bin\n")
         ConditionalWriteFile('built/python/panda.pth',"..\n../bin\n")
 
 

+ 1 - 1
doc/makepanda/makepandacore.py

@@ -694,7 +694,7 @@ def SdkLocatePython():
     if (PkgSkip("PYTHON")==0):
     if (PkgSkip("PYTHON")==0):
         if (sys.platform == "win32"):
         if (sys.platform == "win32"):
             SDK["PYTHON"]="thirdparty/win-python"
             SDK["PYTHON"]="thirdparty/win-python"
-	    SDK["PYTHONVERSION"]="python2.4"
+	    SDK["PYTHONVERSION"]="python2.5"
         else:
         else:
             os.system("python -V > built/tmp/pythonversion 2>&1")
             os.system("python -V > built/tmp/pythonversion 2>&1")
             pv=ReadFile("built/tmp/pythonversion")
             pv=ReadFile("built/tmp/pythonversion")