[apparmor] [patch] fix python LibAppArmor import failures with swig > 3.0.8
Steve Beattie
steve at nxnw.org
Wed Sep 14 20:32:50 UTC 2016
On Wed, Sep 14, 2016 at 02:12:35PM -0500, Tyler Hicks wrote:
> On 09/14/2016 01:52 PM, Christian Boltz wrote:
> > Hello,
> >
> > renaming LibAppArmor.py to __init__.py breaks the import path
> > calculation in swig (> 3.0.8)-generated python code, leading to an error
> > message saying
> > No module named '_LibAppArmor'
> >
> > Therefore this patch drops renaming the file. To stay compatible with the
> > import LibAppArmor.$function_name
> > syntax, add an __init__.py that does
> > from LibAppArmor.LibAppArmor import *
> >
> > References: https://bugzilla.opensuse.org/show_bug.cgi?id=987607
> >
> >
> > Also adjust .bzrignore for this change.
> >
> >
> >
> > I propose this patch for trunk and 2.10.
> > I'm undecided about 2.9 - technically it shares this bug, but I'd expect
> > that 2.9 users don't use the latest swig ;-) - opinions?
>
> Acked-by: Tyler Hicks <tyhicks at canonical.com>
>
> Please apply to 2.9, as well. IIRC, this is one of the errors I hit when
> I run `make check` on the utils/ dir from Ubuntu 16.04 (with swig
> 3.0.8-0ubuntu3) development machine so it'd be nice if that's fixed in
> all of our stable branches. Thanks for fixing it!
Also, no, it does not fix the make check issue in the utils/ directory:
=== test-pivot_root_parse.py ===
Traceback (most recent call last):
File "test-pivot_root_parse.py", line 12, in <module>
import apparmor.aa as aa
File "/home/steve/bzr/apparmor-master/utils/apparmor/aa.py", line 29, in <module>
import apparmor.logparser
File "/home/steve/bzr/apparmor-master/utils/apparmor/logparser.py", line 19, in <module>
import LibAppArmor
File "/home/steve/bzr/apparmor-master/libraries/libapparmor/swig/python/build/lib.linux-x86_64-3.5/LibAppArmor/__init__.py", line 1, in <module>
from LibAppArmor.LibAppArmor import *
File "/home/steve/bzr/apparmor-master/libraries/libapparmor/swig/python/build/lib.linux-x86_64-3.5/LibAppArmor/LibAppArmor.py", line 28, in <module>
_LibAppArmor = swig_import_helper()
File "/home/steve/bzr/apparmor-master/libraries/libapparmor/swig/python/build/lib.linux-x86_64-3.5/LibAppArmor/LibAppArmor.py", line 20, in swig_import_helper
import _LibAppArmor
ImportError: No module named _LibAppArmor
--
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20160914/abc13521/attachment-0001.pgp>
More information about the AppArmor
mailing list