[apparmor] [patch] fix python LibAppArmor import failures with swig > 3.0.8

Steve Beattie steve at nxnw.org
Wed Sep 14 19:41:33 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:
> > 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?

Ugh, I *really* don't like the 'from LibAppArmor.LibAppArmor import *'
bit.

> 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!

Bleah, swig 3.0.8 is seriously broken. It's requiring that the
_LibAppArmor.so be a globally visible module/shared library, rather than
being hidden in LibAppArmor._LibAppArmor.

> > Note: you'll need to cleanup your libraries/libapparmor/swig/python/
> > directory manually before applying this patch ("make clean" isn't enough,
> > so check "bzr ignored"), and regenerate the autogenerated files with
> > autogen.sh and configure afterwards.
> > 
> > If there's a "superclean" make target I missed, please tell me ;-)

make maintainer-clean, I believe (but it's only supported by the
libapparmor subdirectory).


-- 
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/d3fe5ebb/attachment.pgp>


More information about the AppArmor mailing list