Changes for python 2.5

This commit is contained in:
Josh Yelon 2007-12-08 21:49:14 +00:00
parent 1d9814f00c
commit e6cca5ec86
23 changed files with 59 additions and 23 deletions

View File

@ -235,7 +235,7 @@ Section -post
Push "$INSTDIR\bin"
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 "" RegPath 0
@ -245,10 +245,10 @@ Section -post
RegPath:
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:
!endif
@ -273,9 +273,9 @@ Section Uninstall
Push "$INSTDIR\bin"
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
DeleteRegKey HKLM "Software\Python\PythonCore\2.4"
DeleteRegKey HKLM "Software\Python\PythonCore\2.5"
SkipUnReg:
!endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,22 +1,39 @@
### 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"):
target = None
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)):
target = dir
if (target == None):
print "Cannot find libpandaexpress. Exiting."
sys.exit(1)
raise "Cannot find libpandaexpress.dll"
path=os.environ["PATH"]
if (path.startswith(target+";")==0):
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 *
def Dtool_ObjectToDict(clas, name, obj):

View File

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

View File

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

View File

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

View File

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

View File

@ -1041,7 +1041,7 @@ if (COMPILER=="MSVC"):
CopyAllFiles("built/bin/", THIRDPARTYLIBS+"extras"+"/bin/")
if (sys.platform == "win32"):
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')
ConditionalWriteFile('built/python/panda.pth',"..\n../bin\n")

View File

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