Hello, Am Dienstag, 20. September 2016, 11:45:23 CEST schrieb Steve Beattie: > On Wed, Sep 14, 2016 at 11:32:06PM +0200, Christian Boltz wrote: ... > > My patch has a big advantage: it works ;-) (and it's already in > > Tumbleweed and Leap 42.2 beta to un-break the aa-* tools) > > Except for where it doesn't, which is python2.7, where the __init__.py > import fails.
Oops. I have to admit that I only tested with py3, because that's what I actually use (both for myself and in the openSUSE packages). > I spent some time poking at swig 3.10 trying to get it to work some > other way, but the documentation seems to lie, as I couldn't make swig > generate python code that did a relative import; no amount of futzing > with -relativeimport or -py3 or -modern or setting the package name > in the libapparmor.i seemed to make any difference in the > _LibAppArmor import code generated by swig. Given the, well, limited amount of answers on the swig mailinglist, this doesn't really surprise me. > So as far as I can see, a > variant of the import * solution will have to suffice, as follows: ... > --- /dev/null > +++ b/libraries/libapparmor/swig/python/__init__.py > @@ -0,0 +1,6 @@ > +import sys > + > +if sys.version_info[0] > 3: As already mentioned on IRC some days ago, this is very future-proof ;-) Your condition will match for python 4 and newer, but not for python 3. > + from LibAppArmor.LibAppArmor import * > +else: > + from .LibAppArmor import * It seems the line in the else branch works for py2 and py3, so why not simplify the file to "from .LibAppArmor import *"? > > > make maintainer-clean, I believe (but it's only supported by the > > > libapparmor subdirectory). > > > > # make maintainer-clean > > ... > > # bzr ignored | awkcol 1 > > libraries/libapparmor/swig/python/Makefile.in <---------- > > > > So it cleans up a lot, but not everything. > > > > Needless to say that .../swig/python/Makefile.in contains code from > > Makefile.am and needs to be updated ;-) > > Changes made to Makefile.am will cause autotools to regenerate > Makefile.in. I'd still expect to have a make target that *really* cleans everything instead of "just" most files - but that's a different topic ;-) and not related to this patch. Regards, Christian Boltz -- Sagt mal ehrlich: Ist mein Rechner geisteskrank???? [Harald Katzer in suse-linux]
signature.asc
Description: This is a digitally signed message part.
-- AppArmor mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
