From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <remy.horton@intel.com>
Received: from mga01.intel.com (mga01.intel.com [192.55.52.88])
 by dpdk.org (Postfix) with ESMTP id 63C3E2BBA
 for <dev@dpdk.org>; Wed, 29 Jun 2016 17:12:58 +0200 (CEST)
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by fmsmga101.fm.intel.com with ESMTP; 29 Jun 2016 08:12:24 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.26,547,1459839600"; d="scan'208";a="726873051"
Received: from rhorton-mobl.ger.corp.intel.com (HELO [163.33.228.169])
 ([163.33.228.169])
 by FMSMGA003.fm.intel.com with ESMTP; 29 Jun 2016 08:12:22 -0700
To: Neil Horman <nhorman@tuxdriver.com>, dev@dpdk.org
References: <1465494421-6210-1-git-send-email-nhorman@tuxdriver.com>
 <1466189185-21952-1-git-send-email-nhorman@tuxdriver.com>
 <1466189185-21952-6-git-send-email-nhorman@tuxdriver.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>,
 Thomas Monjalon <thomas.monjalon@6wind.com>,
 Stephen Hemminger <stephen@networkplumber.org>,
 Panu Matilainen <pmatilai@redhat.com>
From: Remy Horton <remy.horton@intel.com>
Organization: Intel Shannon Limited
Message-ID: <54616833-c0cc-8e93-c9de-1580f264c57e@intel.com>
Date: Wed, 29 Jun 2016 16:12:21 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101
 Thunderbird/45.1.1
MIME-Version: 1.0
In-Reply-To: <1466189185-21952-6-git-send-email-nhorman@tuxdriver.com>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCHv8 5/6] pmdinfo.py: Add tool to query binaries
 for hw and other support information
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 29 Jun 2016 15:12:59 -0000

'noon,

The tool does not work for static PMD libraries (e.g. librte_pmd_i40e.a) 
- is this an intended limitation?

DPDK doesn't to my knowledge have any coding guidelines for Python, so 
the comments below should be considered advisory rather than 
merge-blocking issues.


On 17/06/2016 19:46, Neil Horman wrote:
[..]
> +++ b/tools/pmdinfo.py
> @@ -0,0 +1,629 @@
> +#!/usr/bin/python
> +# -------------------------------------------------------------------------
> +# scripts/pmdinfo.py
> +#
> +# Utility to dump PMD_INFO_STRING support from an object file
> +#

No licence..?


> +# -------------------------------------------------------------------------
> +import os
> +import sys
> +from optparse import OptionParser
> +import string
> +import json
> +
> +# For running from development directory. It should take precedence over the
> +# installed pyelftools.
> +sys.path.insert(0, '.')

Aside from causing all the subsequent imports to have PEP8 errors, this 
does not looks like a good way of pulling in project-specific Python 
library installs. Usual method is either using virtualenv or the 
PYTHONPATH enviornment variable.


> +from elftools import __version__
> +from elftools.common.exceptions import ELFError
[..]
> +from elftools.dwarf.constants import (
> +    DW_LNS_copy, DW_LNS_set_file, DW_LNE_define_file)
> +from elftools.dwarf.callframe import CIE, FDE

According to PyLint, most of these imports are unused.


> +
> +
> +class Vendor:

Old style class definition. Using modern notation it is:

class Vendor(object):


> +    def report(self):
> +        print "\t%s\t%s" % (self.ID, self.name)
> +        for subID, subdev in self.subdevices.items():
> +            subdev.report()

subID unused. An underscore can be used as a placeholder for these types 
of loops.


> +    optparser.add_option("-t", "--table", dest="tblout",
> +                         help="output information on hw support as a hex table",

PEP8: pmdinfo.py:573:80: E501 line too long (80 > 79 characters)