mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
CMake: Fix generated pandac.PandaModules on Py2
Python 2 doesn't use the fully qualified module name in its ImportError output; only the local name. Test for that.
This commit is contained in:
parent
fe7fdc0976
commit
9645aaee07
@ -56,11 +56,12 @@ if(HAVE_PYTHON)
|
|||||||
print(\"Warning: pandac.PandaModules is deprecated, import from panda3d.core instead\")\n")
|
print(\"Warning: pandac.PandaModules is deprecated, import from panda3d.core instead\")\n")
|
||||||
|
|
||||||
foreach(module ${ALL_INTERROGATE_MODULES})
|
foreach(module ${ALL_INTERROGATE_MODULES})
|
||||||
|
string(REGEX REPLACE "^.*\\." "" module_name "${module}")
|
||||||
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/pandac/PandaModules.py" "
|
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/pandac/PandaModules.py" "
|
||||||
try:
|
try:
|
||||||
from ${module} import *
|
from ${module} import *
|
||||||
except ImportError as err:
|
except ImportError as err:
|
||||||
if not (\"No module named\" in str(err) and \"${module}\" in str(err)):
|
if not (\"No module named\" in str(err) and \"${module_name}\" in str(err)):
|
||||||
raise
|
raise
|
||||||
")
|
")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user