Commit Graph

1 Commits

Author SHA1 Message Date
Petr Lautrbach 5d8ec18db0 Use Python distutils to install SELinux python bindings
SWIG-4.0 changed its behavior so that it uses: from . import _selinux  which
looks for _selinux module in the same directory as where __init__.py is -
$(PYLIBDIR)/site-packages/selinux. But _selinux module is installed into
$(PYLIBDIR)/site-packages/ since a9604c30a5e2f ("libselinux: Change the location
of _selinux.so").

In order to prevent such breakage in future use Python's distutils instead of
building and installing python bindings manually in Makefile.

Fixes:
>>> import selinux
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.7/site-packages/selinux/__init__.py", line 13, in <module>
    from . import _selinux
ImportError: cannot import name '_selinux' from 'selinux' (/usr/lib64/python3.7/site-packages/selinux/__init__.py)
>>>

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
2019-05-22 12:47:32 +02:00