From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 26AD84CA2; Tue, 13 Nov 2018 17:06:29 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2018 08:06:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,499,1539673200"; d="scan'208";a="108224203" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga002.jf.intel.com with ESMTP; 13 Nov 2018 08:06:27 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id wADG6QpO021927; Tue, 13 Nov 2018 16:06:26 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id wADG6QJb028992; Tue, 13 Nov 2018 16:06:26 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id wADG6QD8028987; Tue, 13 Nov 2018 16:06:26 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: ferruh.yigit@intel.com, roszenrami@gmail.com, stable@dpdk.org Date: Tue, 13 Nov 2018 16:06:26 +0000 Message-Id: <9b28e77a26d11b3cb8d063ea5949f231b0f9830d.1542124966.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2] devbind: check for lspci X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2018 16:06:30 -0000 On some distributions (such as CentOS 7) lspci may not be installed by default, causing exceptions which are difficult to interpret. Fix devbind script to check if lspci is installed at script startup. Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov --- Notes: v2: correct package name to "pciutils" usertools/dpdk-devbind.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py index 7d564634c..40dc28a7d 100755 --- a/usertools/dpdk-devbind.py +++ b/usertools/dpdk-devbind.py @@ -655,6 +655,13 @@ def do_arg_actions(): def main(): '''program main function''' + # check if lspci is installed, suppress any output + with open(os.devnull, 'w') as devnull: + ret = subprocess.call(['which', 'lspci'], + stdout=devnull, stderr=devnull) + if ret != 0: + print("'lspci' not found - please install 'pciutils'") + sys.exit(1) parse_args() check_modules() clear_data() -- 2.17.1