Python init code does not work when using SWIG 4.0 #760

Looks like the way modules are loaded changed a little with SWIG 4.0. So I
changed the order we include everything in __init__.py.  We include all
of the c++ python modules first now instead of having them read in from
the python code itself.  Basically we include the files like this in this order

import _m<hash>
from m<hash> import *
This commit is contained in:
Alex Lin 2019-05-02 08:20:06 -05:00
parent 41f151f2ee
commit a29564bd9c

View File

@ -383,11 +383,16 @@ LINK_LISTS += \$(LD_FILELIST)build/py_link_list
foreach $f ( @files_to_process, @ext_lib_files ) { foreach $f ( @files_to_process, @ext_lib_files ) {
print INITFILE "# $f\n" ; print INITFILE "# $f\n" ;
print INITFILE "from m$md5s{$f} import *\n" ; print INITFILE "import _m$md5s{$f}\n" ;
print INITFILE "combine_cvars(all_cvars, cvar)\n" ; print INITFILE "combine_cvars(all_cvars, cvar)\n" ;
print INITFILE "cvar = None\n\n" ; print INITFILE "cvar = None\n\n" ;
} }
foreach $f ( @files_to_process, @ext_lib_files ) {
print INITFILE "# $f\n" ;
print INITFILE "from m$md5s{$f} import *\n" ;
}
foreach my $mod ( keys %python_modules ) { foreach my $mod ( keys %python_modules ) {
print INITFILE "import trick.$mod\n" ; print INITFILE "import trick.$mod\n" ;
} }