adjust to Swig 4.1.0

* python/spot/__init__.py: Add flatnested versions of some static
methods.
* spot/twa/acc.hh: Hide && version of & and |, causing trouble
to swig.
* tests/python/_synthesis.ipynb, tests/python/synthesis.ipynb:
Upgrade expected type names.
* tests/python/ipnbdoctest.py: Adjust for difference between 4.0 and
4.1.
This commit is contained in:
Alexandre Duret-Lutz 2022-11-07 16:24:33 +01:00
parent 6dc740184c
commit b36cee06a1
5 changed files with 27 additions and 15 deletions

View file

@ -104,19 +104,22 @@ def setup(**kwargs):
os.environ['SPOT_DOTDEFAULT'] = d
# In version 3.0.2, Swig puts strongly typed enum in the main
# namespace without prefixing them. Latter versions fix this. So we
# can remove for following hack once 3.0.2 is no longer used in our
# build farm.
if 'op_ff' not in globals():
# Swig versions prior to 4.1.0 export formula.X as formula_X as well,
# for all operators. Swig 4.1.0 stops doing this, breaking some
# existing code.
if 'formula_ff' not in globals():
for i in ('ff', 'tt', 'eword', 'ap', 'Not', 'X', 'F', 'G',
'Closure', 'NegClosure', 'NegClosureMarked',
'Xor', 'Implies', 'Equiv', 'U', 'R', 'W', 'M',
'EConcat', 'EConcatMarked', 'UConcat', 'Or',
'OrRat', 'And', 'AndRat', 'AndNLM', 'Concat',
'Fusion', 'Star', 'FStar'):
globals()['op_' + i] = globals()[i]
del globals()[i]
'Fusion', 'Star', 'FStar', 'nested_unop_range',
'sugar_goto', 'sugar_equal', 'sugar_delay', 'unop',
'binop', 'bunop', 'multop', 'first_match', 'unbounded'):
globals()['formula_' + i] = formula.__dict__[i].__func__
if 'trival_maybe' not in globals():
for i in ('maybe',):
globals()['trival_' + i] = trival.__dict__[i].__func__
# Global BDD dict so that we do not have to create one in user code.

View file

@ -1011,6 +1011,7 @@ namespace spot
return res;
}
#ifndef SWIG
/// \brief Conjunct the current condition with \a r.
acc_code operator&(acc_code&& r) const
{
@ -1018,6 +1019,7 @@ namespace spot
res &= r;
return res;
}
#endif // SWIG
/// \brief Disjunct the current condition in place with \a r.
acc_code& operator|=(const acc_code& r)
@ -1106,6 +1108,7 @@ namespace spot
return *this;
}
#ifndef SWIG
/// \brief Disjunct the current condition with \a r.
acc_code operator|(acc_code&& r) const
{
@ -1113,6 +1116,7 @@ namespace spot
res |= r;
return res;
}
#endif // SWIG
/// \brief Disjunct the current condition with \a r.
acc_code operator|(const acc_code& r) const

View file

@ -6346,7 +6346,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7fbccc33adb0> >"
"<spot.aig; proxy of <Swig Object of type 'std::shared_ptr< spot::aig > *' at 0x7fbccc33adb0> >"
]
},
"execution_count": 28,

View file

@ -101,6 +101,11 @@ def canonicalize(s, type, ignores):
# %%file writes `Writing`, or `Overwriting` if the file exists.
s = re.sub(r'^Overwriting ', 'Writing ', s)
# Swig 4.1.0 fixed an ordering issue with how types are printed.
# aig_ptr is expected to be printed as shared_ptr<aig>, but prior
# Swig version did not do that.
s = re.sub(r'spot::aig_ptr ', 'std::shared_ptr< spot::aig > ', s)
# SVG generated by graphviz may put note at different positions
# depending on the graphviz build. Let's just strip anything that
# look like a position.

View file

@ -2601,7 +2601,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f0e584deae0> >"
"<spot.aig; proxy of <Swig Object of type 'std::shared_ptr< spot::aig > *' at 0x7f0e584deae0> >"
]
},
"metadata": {},
@ -3256,7 +3256,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f0e5855c9f0> >"
"<spot.aig; proxy of <Swig Object of type 'std::shared_ptr< spot::aig > *' at 0x7f0e5855c9f0> >"
]
},
"metadata": {},
@ -3385,7 +3385,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f0e5855c900> >"
"<spot.aig; proxy of <Swig Object of type 'std::shared_ptr< spot::aig > *' at 0x7f0e5855c900> >"
]
},
"metadata": {},
@ -3801,7 +3801,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f0e584def00> >"
"<spot.aig; proxy of <Swig Object of type 'std::shared_ptr< spot::aig > *' at 0x7f0e584def00> >"
]
},
"metadata": {},
@ -3979,7 +3979,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f0e5855c930> >"
"<spot.aig; proxy of <Swig Object of type 'std::shared_ptr< spot::aig > *' at 0x7f0e5855c930> >"
]
},
"metadata": {},
@ -4159,7 +4159,7 @@
"</svg>\n"
],
"text/plain": [
"<spot.aig; proxy of <Swig Object of type 'spot::aig_ptr *' at 0x7f0e584def90> >"
"<spot.aig; proxy of <Swig Object of type 'std::shared_ptr< spot::aig > *' at 0x7f0e584def90> >"
]
},
"metadata": {},