From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id B6E512BB1; Wed, 7 Nov 2018 14:56:16 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2018 05:56:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,475,1534834800"; d="scan'208";a="84665068" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga008.fm.intel.com with ESMTP; 07 Nov 2018 05:56:14 -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 wA7DuESC019738; Wed, 7 Nov 2018 13:56:14 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id wA7DuDYa019317; Wed, 7 Nov 2018 13:56:13 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id wA7DuDT3019313; Wed, 7 Nov 2018 13:56:13 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: john.mcnamara@intel.com, stable@dpdk.org Date: Wed, 7 Nov 2018 13:56:13 +0000 Message-Id: X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] 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: Wed, 07 Nov 2018 13:56:17 -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 --- usertools/dpdk-devbind.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py index 7d564634c..74bf514c0 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 'lspci'") + sys.exit(1) parse_args() check_modules() clear_data() -- 2.17.1