From 9645aaee07528358e91b017bf8ecc43489fec309 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Wed, 18 Sep 2019 01:13:33 -0600 Subject: [PATCH] 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. --- direct/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/direct/CMakeLists.txt b/direct/CMakeLists.txt index 1e4e57c842..686ca23cc5 100644 --- a/direct/CMakeLists.txt +++ b/direct/CMakeLists.txt @@ -56,11 +56,12 @@ if(HAVE_PYTHON) print(\"Warning: pandac.PandaModules is deprecated, import from panda3d.core instead\")\n") foreach(module ${ALL_INTERROGATE_MODULES}) + string(REGEX REPLACE "^.*\\." "" module_name "${module}") file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/pandac/PandaModules.py" " try: from ${module} import * 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 ") endforeach()