2020-01-24, Bruce Richardson:
> Rather than having to explicitly list each and every driver to disable in a
> build, we can use a small python script and the python glob library to
> expand out the wildcards. This means that we can configure meson using e.g.
> 
>     meson -Ddisable_drivers=crypto/*,event/* build
> 
> to do a build omitting all the crypto and event drivers. Explicitly
> specified drivers e.g. net/i40e, work as before, and can be mixed with
> wildcarded drivers as required.
> 
> Signed-off-by: Bruce Richardson <bruce.richard...@intel.com>
[snip]
> +from os.path import join, relpath, isdir

As a general rule, it is better to only import one symbol per line. This
makes subsequent patches easier to read.

> +if len(sys.argv) != 2:
> +  print("Usage: {0} <path-glob>[,<path-glob>[,...]]".format(sys.argv[0]))
> +  sys.exit(1)

PEP8 advises to use 4 spaces per indentation level. This is the
indentation style adopted by all other python scripts in dpdk (see
doc/guides/contributing/coding_style.rst). Could you fix that?

> +root = '.'
> +if 'MESON_SOURCE_ROOT' in os.environ and 'MESON_SUBDIR' in os.environ:
> +  root = join(os.environ['MESON_SOURCE_ROOT'], os.environ['MESON_SUBDIR'])

You can do simpler and shorter:

  root = join(os.getenv('MESON_SOURCE_ROOT', ''),
              os.getenv('MESON_SUBDIR', ''), '.')

Sorry to pester you with all this, but python code in DPDK really needs
some loving :-)

-- 
Robin

Reply via email to