work around new import statements generated by swig-4.0

Those statements are not compatible with the fact that
libtool-generated modules are in .libs/ until they get installed.

* python/spot/__init__.py: Add sys.path to __path__ if SPOT_BUILD is
  set.
* tests/run.in: Set SPOT_BUILD.
This commit is contained in:
Alexandre Duret-Lutz 2019-05-29 15:48:50 +02:00
parent 377285b1d6
commit 72d6527b6c
2 changed files with 15 additions and 7 deletions

View file

@ -20,21 +20,27 @@
import sys
if sys.hexversion < 0x03030000:
sys.exit("This module requires Python 3.3 or newer")
import subprocess
import os
import signal
import tempfile
from contextlib import suppress as _supress
if 'SPOT_UNINSTALLED' in os.environ:
# When Spot is installed, _impl.so will be in the same directory as
# spot/impl.py, however when we run Spot's test suite, Spot is not yet
# installed and we want "from . import _impl" (generated by Swig4) to look
# into .libs/
__path__.extend(sys.path)
from spot.impl import *
from spot.aux import \
extend as _extend, \
str_to_svg as _str_to_svg, \
ostream_to_svg as _ostream_to_svg
import subprocess
import os
import signal
import tempfile
from contextlib import suppress as _supress
# The parrameters used by default when show() is called on an automaton.