File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,17 @@ nonstandard type conversions.
6464 }
6565}
6666
67+ // store swig version
68+ %constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16 );
69+ %constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8 ) & 0xff );
70+ %constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff );
71+
72+ %pythoncode %{
73+ # SWIG version used to build the amici extension as `(major, minor, patch)`
74+ _SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH)
75+ %}
76+
77+
6778// Warning 503: Can't wrap 'operator ==' unless renamed to a valid identifier.
6879%rename(" __eq__" ) operator ==;
6980
Original file line number Diff line number Diff line change @@ -37,6 +37,28 @@ if t_imported < t_modified:
3737
3838%module (package=" TPL_MODELNAME" ,moduleimport=MODULEIMPORT) TPL_MODELNAME
3939
40+ // store swig version
41+ %constant int SWIG_VERSION_MAJOR = (SWIG_VERSION >> 16 );
42+ %constant int SWIG_VERSION_MINOR = ((SWIG_VERSION >> 8 ) & 0xff );
43+ %constant int SWIG_VERSION_PATCH = (SWIG_VERSION & 0xff );
44+
45+ %pythoncode %{
46+ # SWIG version used to build the model extension as `(major, minor, patch)`
47+ _SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH)
48+
49+ if (amici_swig := amici.amici ._SWIG_VERSION ) != (model_swig := _SWIG_VERSION):
50+ import warnings
51+ warnings.warn (
52+ f" SWIG version mismatch between amici ({amici_swig}) and model "
53+ f" ({model_swig}). This may lead to unexpected behavior. "
54+ " In that case, please recompile the model with swig=="
55+ f" {amici_swig[0]}.{amici_swig[1]}.{amici_swig[2]} or rebuild amici "
56+ f" with swig=={model_swig[0]}.{model_swig[1]}.{model_swig[2]}." ,
57+ RuntimeWarning,
58+ stacklevel=2 ,
59+ )
60+ %}
61+
4062%pythoncode %{
4163# the model-package __init__.py module (will be set during import )
4264_model_module = None
You can’t perform that action at this time.
0 commit comments