Merge branch 'rupertnash-master'

* rupertnash-master:
  Make python shadow sub-modules runable
This commit is contained in:
William S Fulton 2018-11-22 08:18:57 +00:00
commit c8bb566822

View file

@ -713,7 +713,7 @@ public:
*/
Printv(default_import_code, "def swig_import_helper():\n", NULL);
Printv(default_import_code, tab4, "import importlib\n", NULL);
Printv(default_import_code, tab4, "pkg = __name__.rpartition('.')[0]\n", NULL);
Printv(default_import_code, tab4, "pkg = __package__ if __package__ else __name__.rpartition('.')[0]\n", NULL);
Printf(default_import_code, tab4 "mname = '.'.join((pkg, '%s')).lstrip('.')\n", module);
Printv(default_import_code, tab4, "try:\n", NULL);
Printv(default_import_code, tab8, "return importlib.import_module(mname)\n", NULL);