@@ -2169,42 +2169,50 @@ def SdkLocatePython(prefer_thirdparty_python=False):
2169
2169
2170
2170
# Determine which version it is by checking which dll is in the directory.
2171
2171
if (GetOptimize () <= 2 ):
2172
- py_dlls = glob .glob (SDK ["PYTHON" ] + "/python[0-9][0-9]_d.dll" )
2172
+ py_dlls = glob .glob (SDK ["PYTHON" ] + "/python[0-9][0-9]_d.dll" ) + \
2173
+ glob .glob (SDK ["PYTHON" ] + "/python[0-9][0-9][0-9]_d.dll" )
2173
2174
else :
2174
- py_dlls = glob .glob (SDK ["PYTHON" ] + "/python[0-9][0-9].dll" )
2175
+ py_dlls = glob .glob (SDK ["PYTHON" ] + "/python[0-9][0-9].dll" ) + \
2176
+ glob .glob (SDK ["PYTHON" ] + "/python[0-9][0-9][0-9].dll" )
2175
2177
2176
2178
if len (py_dlls ) == 0 :
2177
2179
exit ("Could not find the Python dll in %s." % (SDK ["PYTHON" ]))
2178
2180
elif len (py_dlls ) > 1 :
2179
2181
exit ("Found multiple Python dlls in %s." % (SDK ["PYTHON" ]))
2180
2182
2181
2183
py_dll = os .path .basename (py_dlls [0 ])
2182
- ver = py_dll [6 ] + "." + py_dll [7 ]
2184
+ py_dllver = py_dll .strip (".DHLNOPTY_dhlnopty" )
2185
+ ver = py_dllver [0 ] + '.' + py_dllver [1 :]
2183
2186
2184
2187
SDK ["PYTHONVERSION" ] = "python" + ver
2185
2188
os .environ ["PYTHONHOME" ] = SDK ["PYTHON" ]
2186
2189
2187
- if sys .version [:3 ] != ver :
2188
- Warn ("running makepanda with Python %s, but building Panda3D with Python %s." % (sys .version [:3 ], ver ))
2190
+ running_ver = '%d.%d' % sys .version_info [:2 ]
2191
+ if ver != running_ver :
2192
+ Warn ("running makepanda with Python %s, but building Panda3D with Python %s." % (running_ver , ver ))
2189
2193
2190
2194
elif CrossCompiling () or (prefer_thirdparty_python and os .path .isdir (os .path .join (GetThirdpartyDir (), "python" ))):
2191
2195
tp_python = os .path .join (GetThirdpartyDir (), "python" )
2192
2196
2193
2197
if GetTarget () == 'darwin' :
2194
- py_libs = glob .glob (tp_python + "/lib/libpython[0-9].[0-9].dylib" )
2198
+ py_libs = glob .glob (tp_python + "/lib/libpython[0-9].[0-9].dylib" ) + \
2199
+ glob .glob (tp_python + "/lib/libpython[0-9].[0-9][0-9].dylib" )
2195
2200
else :
2196
- py_libs = glob .glob (tp_python + "/lib/libpython[0-9].[0-9].so" )
2201
+ py_libs = glob .glob (tp_python + "/lib/libpython[0-9].[0-9].so" ) + \
2202
+ glob .glob (tp_python + "/lib/libpython[0-9].[0-9][0-9].so" )
2197
2203
2198
2204
if len (py_libs ) == 0 :
2199
- py_libs = glob .glob (tp_python + "/lib/libpython[0-9].[0-9].a" )
2205
+ py_libs = glob .glob (tp_python + "/lib/libpython[0-9].[0-9].a" ) + \
2206
+ glob .glob (tp_python + "/lib/libpython[0-9].[0-9][0-9].a" )
2200
2207
2201
2208
if len (py_libs ) == 0 :
2202
2209
exit ("Could not find the Python library in %s." % (tp_python ))
2203
2210
elif len (py_libs ) > 1 :
2204
2211
exit ("Found multiple Python libraries in %s." % (tp_python ))
2205
2212
2206
2213
py_lib = os .path .basename (py_libs [0 ])
2207
- SDK ["PYTHONVERSION" ] = "python" + py_lib [9 ] + "." + py_lib [11 ]
2214
+ py_libver = py_lib .strip ('.abdhilnopsty' )
2215
+ SDK ["PYTHONVERSION" ] = "python" + py_libver
2208
2216
SDK ["PYTHONEXEC" ] = tp_python + "/bin/" + SDK ["PYTHONVERSION" ]
2209
2217
SDK ["PYTHON" ] = tp_python + "/include/" + SDK ["PYTHONVERSION" ]
2210
2218
@@ -2250,9 +2258,9 @@ def SdkLocatePython(prefer_thirdparty_python=False):
2250
2258
exit ("Host Python version (%s) must be the same as target Python version (%s)!" % (host_version , SDK ["PYTHONVERSION" ]))
2251
2259
2252
2260
if GetVerbose ():
2253
- print ("Using Python %s build located at %s" % (SDK ["PYTHONVERSION" ][6 :9 ], SDK ["PYTHON" ]))
2261
+ print ("Using Python %s build located at %s" % (SDK ["PYTHONVERSION" ][6 :], SDK ["PYTHON" ]))
2254
2262
else :
2255
- print ("Using Python %s" % (SDK ["PYTHONVERSION" ][6 :9 ]))
2263
+ print ("Using Python %s" % (SDK ["PYTHONVERSION" ][6 :]))
2256
2264
2257
2265
def SdkLocateVisualStudio (version = (10 ,0 )):
2258
2266
if (GetHost () != "windows" ): return
@@ -3578,7 +3586,7 @@ def GetCurrentPythonVersionInfo():
3578
3586
3579
3587
from distutils .sysconfig import get_python_lib
3580
3588
return {
3581
- "version" : SDK ["PYTHONVERSION" ][6 :9 ],
3589
+ "version" : SDK ["PYTHONVERSION" ][6 :],
3582
3590
"soabi" : GetPythonABI (),
3583
3591
"ext_suffix" : GetExtensionSuffix (),
3584
3592
"executable" : sys .executable ,
0 commit comments