python3-libselinux-2.9-1.fc31 when rebuilt with swig 4 cannot import selinux. This is python3-libselinux-2.9-1.fc31 from Fedora rawhide (rebuilt with swig 3.0.12): <mock-chroot> sh-5.0# rpm -q python3-libselinux python3-libselinux-2.9-1.fc31.x86_64 <mock-chroot> sh-5.0# head /usr/lib64/python3.7/site-packages/selinux/__init__.py -n2 # This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.12 <mock-chroot> sh-5.0# python3 -c 'import selinux' && echo OK OK However when I rebuild it with swig 4.0.0: <mock-chroot> sh-5.0# rpm -q python3-libselinux python3-libselinux-2.9-3.fc31.x86_64 <mock-chroot> sh-5.0# head /usr/lib64/python3.8/site-packages/selinux/__init__.py -n2 # This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.0 <mock-chroot> sh-5.0# python3 -c 'import selinux' && echo OK Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib64/python3.8/site-packages/selinux/__init__.py", line 13, in <module> from . import _selinux ImportError: cannot import name '_selinux' from 'selinux' (/usr/lib64/python3.8/site-packages/selinux/__init__.py) (The double bump form -1 to -3 was done by me.) This happens with Python 3.8, I'm runn ing a scratch build against 3.7 to see if it is also affected. This blocks the rebuild of setroubleshoot for Python 3.8: checking whether /usr/bin/python3 version is >= 3... yes checking for /usr/bin/python3 version... 3.8 checking for /usr/bin/python3 platform... linux checking for /usr/bin/python3 script directory... ${prefix}/lib/python3.8/site-packages checking for /usr/bin/python3 extension module directory... ${exec_prefix}/lib64/python3.8/site-packages checking for the selinux python3 module... no configure: error: cannot import Python3 module selinux Please check your Python3 installation. The error was: Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib64/python3.8/site-packages/selinux/__init__.py", line 13, in <module> from . import _selinux ImportError: cannot import name '_selinux' from 'selinux' (/usr/lib64/python3.8/site-packages/selinux/__init__.py)
With a new Python 3.7 scratchbuild: https://koji.fedoraproject.org/koji/taskinfo?taskID=35151346 $ mock -r fedora-rawhide-x86_64 install https://kojipkgs.fedoraproject.org//work/tasks/1417/35151417/python3-libselinux-2.9-1.fc31.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/1417/35151417/libselinux-2.9-1.fc31.x86_64.rpm $ mock -r fedora-rawhide-x86_64 shell <mock-chroot> sh-5.0# rpm -q python3-libselinux python3-libselinux-2.9-1.fc31.x86_64 <mock-chroot> sh-5.0# head /usr/lib64/python3.7/site-packages/selinux/__init__.py -n2 # This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.0 <mock-chroot> sh-5.0# python3 -c 'import selinux' && echo OK Traceback (most recent call last): File "<string>", 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)
https://src.fedoraproject.org/rpms/libselinux/c/5d8ec18db09e97729be68029ace116c5f91e7755?branch=master I haven't found out how to do it so it works with swig-4.0.0 and swig-3.x.0 :/
Thanks for the super fast fix.