|
|
@@ -3,14 +3,24 @@ __all__ = ["Dtool_ObjectToDict", "Dtool_funcToMethod", "Dtool_PreloadDLL"]
|
|
|
|
|
|
import imp,sys,os
|
|
|
|
|
|
+is_python_d = False
|
|
|
+dll_suffix = ''
|
|
|
+
|
|
|
if (sys.platform == "win32"):
|
|
|
+ # If we launched from python_d.exe, we need to load libpanda_d.dll, etc.
|
|
|
+ is_python_d = (sys.executable.endswith('_d.exe'))
|
|
|
+ if is_python_d:
|
|
|
+ dll_suffix = '_d'
|
|
|
+
|
|
|
target = None
|
|
|
+ filename = "libpandaexpress%s.dll" % (dll_suffix)
|
|
|
for dir in sys.path + [sys.prefix]:
|
|
|
- lib = os.path.join(dir, "libpandaexpress.dll")
|
|
|
+ lib = os.path.join(dir, filename)
|
|
|
if (os.path.exists(lib)):
|
|
|
target = dir
|
|
|
if (target == None):
|
|
|
- raise "Cannot find libpandaexpress.dll"
|
|
|
+ message = "Cannot find %s" % (filename)
|
|
|
+ raise message
|
|
|
path=os.environ["PATH"]
|
|
|
if (path.startswith(target+";")==0):
|
|
|
os.environ["PATH"] = target+";"+path
|
|
|
@@ -26,13 +36,13 @@ def Dtool_PreloadDLL(module):
|
|
|
return
|
|
|
target = None
|
|
|
for dir in sys.path + [sys.prefix]:
|
|
|
- lib = os.path.join(dir, module + ".dll")
|
|
|
+ lib = os.path.join(dir, module + dll_suffix + ".dll")
|
|
|
if (os.path.exists(lib)):
|
|
|
target = dir
|
|
|
break
|
|
|
if (target == None):
|
|
|
raise "DLL loader cannot find "+module+"."
|
|
|
- imp.load_dynamic(module, os.path.join(target, module + ".dll"))
|
|
|
+ imp.load_dynamic(module, os.path.join(target, module + dll_suffix + ".dll"))
|
|
|
|
|
|
Dtool_PreloadDLL("libpandaexpress")
|
|
|
from libpandaexpress import *
|