mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
protect against python 2.4
This commit is contained in:
parent
a357f6b8cd
commit
a745e451db
@ -262,7 +262,14 @@ def generateNativeWrappers():
|
|||||||
# the library isn't present. This is particularly necessary
|
# the library isn't present. This is particularly necessary
|
||||||
# in the runtime (plugin) environment, where all libraries are
|
# in the runtime (plugin) environment, where all libraries are
|
||||||
# not necessarily downloaded.
|
# not necessarily downloaded.
|
||||||
pandaModules.write('try:\n from %sModules import *\nexcept ImportError as err:\n if "DLL loader cannot find" not in str(err):\n raise\n\n' % (moduleName))
|
if sys.version_info < (2, 5):
|
||||||
|
# In Python 2.4 and earlier, we didn't have the "except
|
||||||
|
# ImportError as err" syntax.
|
||||||
|
pandaModules.write('try:\n from %sModules import *\nexcept ImportError:\n print "Failed to import %s"\n\n' % (moduleName, moduleName))
|
||||||
|
else:
|
||||||
|
# Try to differentiate between missing files and other
|
||||||
|
# kinds of ImportErrors.
|
||||||
|
pandaModules.write('try:\n from %sModules import *\nexcept ImportError as err:\n if "DLL loader cannot find" not in str(err):\n raise\n print "Failed to import %s"\n\n' % (moduleName, moduleName))
|
||||||
|
|
||||||
moduleModulesFilename = os.path.join(outputCodeDir, '%sModules.py' % (moduleName))
|
moduleModulesFilename = os.path.join(outputCodeDir, '%sModules.py' % (moduleName))
|
||||||
moduleModules = open(moduleModulesFilename, 'w')
|
moduleModules = open(moduleModulesFilename, 'w')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user