On Mon, Sep 26, 2022 at 03:44:38PM +0200, Robin Jarry wrote: > dpdk-pmdinfo.py does not produce any parseable output. The -r/--raw flag > merely prints multiple independent JSON lines which cannot be fed > directly to any JSON parser. Moreover, the script complexity is rather > high for such a simple task: extracting PMD_INFO_STRING from .rodata ELF > sections. Rewrite it so that it can produce valid JSON. > > Remove the PCI database parsing for PCI-ID to Vendor-Device names > conversion. This should be done by external scripts (if really needed). > > The script passes flake8, black, isort and pylint checks. > > I have tested this with a matrix of python/pyelftools versions: > > pyelftools > 0.22 0.23 0.24 0.25 0.26 0.27 0.28 0.29 > 3.6 ok ok ok ok ok ok ok ok > 3.7 ok ok ok ok ok ok ok ok > Python 3.8 ok ok ok ok ok ok ok ok > 3.9 ok ok ok ok ok ok ok ok > 3.10 fail fail fail fail ok ok ok ok > > All failures with python 3.10 are related to the same issue: > > File "elftools/construct/lib/container.py", line 5, in <module> > from collections import MutableMapping > ImportError: cannot import name 'MutableMapping' from 'collections' > > Python 3.10 support is only available since pyelftools 0.26. The script > will only work with Python 3.6 and later. Update the minimal system > requirements, docs and release notes. > > Cc: Olivier Matz <olivier.m...@6wind.com> > Cc: Ferruh Yigit <ferruh.yi...@xilinx.com> > Cc: Bruce Richardson <bruce.richard...@intel.com> > Signed-off-by: Robin Jarry <rja...@redhat.com> > --- > v5 -> v6: > > * fixed typo: /etc/ld.so.conf/*.conf -> /etc/ld.so.conf.d/*.conf
I am a little uncertain about doing this parsing, and worried it may be a bit fragile. The main file for ld.so still is ld.so.conf, which, on my system anyway, does indeed just have an include for *.conf in the .d directory. However, is it possible that there are systems out there that still have entries in ld.so.conf and possibly elsewhere? I think my preference would still be to shell out to ldconfig and query its database, or to shell out to ldd to get the dependencies of a .so from there. I just think it may be more robust, but at the cost of running some shell commands. However, I don't feel strongly about this, so if others prefer the pure-python ld.so.conf parsing approach better, I'm ok with that. /Bruce