From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 59CA31384B4 for ; Thu, 26 Nov 2015 22:30:36 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0786521C087; Thu, 26 Nov 2015 22:30:21 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1EA8521C079 for ; Thu, 26 Nov 2015 22:30:19 +0000 (UTC) Received: from localhost.localdomain (d202-251.icpnet.pl [109.173.202.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id DC4F333D3C7; Thu, 26 Nov 2015 22:30:16 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: python_fix_shebang, skip empty files Date: Thu, 26 Nov 2015 23:30:08 +0100 Message-Id: <1448577009-32161-1-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1448221870-17269-1-git-send-email-mgorny@gentoo.org> References: <1448221870-17269-1-git-send-email-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: a1d6c0fa-e919-417a-839c-26485725ff26 X-Archives-Hash: 07673a99ebaf609cd219caaded4a4841 Skip empty files when traversing directories in python_fix_shebangs. This prevents read from failing on them, and avoids opening them unnecessarily. --- eclass/python-utils-r1.eclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 0a04e12..95689f6 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -1030,9 +1030,12 @@ python_fix_shebang() { local path f for path; do - local any_correct any_fixed is_recursive + local any_correct any_fixed find_args is_recursive - [[ -d ${path} ]] && is_recursive=1 + if [[ -d ${path} ]]; then + is_recursive=1 + find_args=( -size +0c ) + fi while IFS= read -r -d '' f; do local shebang i @@ -1128,7 +1131,7 @@ python_fix_shebang() { eerror " requested impl: ${EPYTHON}" die "${FUNCNAME}: conversion of incompatible shebang requested" fi - done < <(find "${path}" -type f -print0 || die) + done < <(find "${path}" -type f "${find_args[@]}" -print0 || die) if [[ ! ${any_fixed} ]]; then eqawarn "QA warning: ${FUNCNAME}, ${path#${D}} did not match any fixable files." -- 2.6.3