[Buildroot] [PATCH 3/3] package/python-iptables: use installed iptables by default

Frank Vanbever frank.vanbever at essensium.com
Thu Feb 27 14:56:34 UTC 2020

Hi Thomas,

Thank you for the comments.

 > But overall, is there a better way ? Like some official way to pass
> these values at build time as setup.py options, with the environment
> variable taking precedence if available ? That would make this
> hopefully acceptable by upstream. Perhaps the setup.py logic could even
> check the xtables-version.h by itself ?

For installations from source this would work. [1] However Python also has the 
option of distributing Wheel binary packages, where this logic would not be 
executed. [2] This would mean that we put the burden of handling the difference 
between installations on the upstream.

I took a second look and actually I think I can propose a workaround to the 
upstream. There's 2 problems that need to be tackled.

The first one is loading libxtables.so. iptables installs a libxtables.so 
symlink without any version. CDLL has no issues with this so it can just try 
and load that if all the other attempts fail.

The second problem is the location of the XTABLES_LIBDIR. Right now it tries 
all paths that are mentioned in the output of ldconfig -N -v. I guess it 
wouldn't be that much of a stretch to test some sensible locations (/usr/
local/lib/xtables, /usr/lib/xtables etc) if that should fail, in the same vein 
as the libc solution. It's not clean but it gets the job done.

I'll see if I can whip something up and submit it upstream.

Best regards,

[1] https://stackoverflow.com/questions/20288711/post-install-script-with-python-setuptools
[2] https://github.com/pypa/setuptools/issues/1782

More information about the buildroot mailing list