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 <[email protected]> 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! Tyler > > > 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 ;-) > > > > [ libapparmor-fix-import-path.diff ] > > Index: libraries/libapparmor/swig/python/Makefile.am > =================================================================== > --- libraries/libapparmor/swig/python/Makefile.am.orig 2014-01-06 > 23:08:55.000000000 +0100 > +++ libraries/libapparmor/swig/python/Makefile.am 2016-08-26 > 18:03:52.526582753 +0200 > @@ -6,9 +6,8 @@ SUBDIRS = test > > libapparmor_wrap.c: $(srcdir)/../SWIG/libapparmor.i > $(SWIG) -python -I$(srcdir)/../../include -module LibAppArmor -o $@ > $(srcdir)/../SWIG/libapparmor.i > - mv LibAppArmor.py __init__.py > > -MOSTLYCLEANFILES=libapparmor_wrap.c __init__.py > +MOSTLYCLEANFILES=libapparmor_wrap.c LibAppArmor.py > > all-local: libapparmor_wrap.c setup.py > if test ! -f libapparmor_wrap.c; then cp $(srcdir)/libapparmor_wrap.c > . ; fi > Index: libraries/libapparmor/swig/python/__init__.py > =================================================================== > --- /dev/null 1970-01-01 00:00:00.000000000 +0000 > +++ libraries/libapparmor/swig/python/__init__.py 2016-08-26 > 18:03:16.790763701 +0200 > @@ -0,0 +1 @@ > +from LibAppArmor.LibAppArmor import * > === modified file '.bzrignore' > --- .bzrignore 2015-10-21 19:40:35 +0000 > +++ .bzrignore 2016-09-14 18:34:04 +0000 > @@ -88,7 +88,7 @@ > libraries/libapparmor/swig/perl/blib > libraries/libapparmor/swig/perl/libapparmor_wrap.c > libraries/libapparmor/swig/perl/pm_to_blib > -libraries/libapparmor/swig/python/__init__.py > +libraries/libapparmor/swig/python/LibAppArmor.py > libraries/libapparmor/swig/python/build/ > libraries/libapparmor/swig/python/libapparmor_wrap.c > libraries/libapparmor/swig/python/Makefile > > > > Regards, > > Christian Boltz > > >
signature.asc
Description: OpenPGP digital signature
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
