public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
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	[thread overview]
Message-ID: <1448577009-32161-1-git-send-email-mgorny@gentoo.org> (raw)
In-Reply-To: <1448221870-17269-1-git-send-email-mgorny@gentoo.org>

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



  parent reply	other threads:[~2015-11-26 22:30 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-22 19:50 [gentoo-dev] [PATCHES] Clean-up & EAPI 6 support for python-r1 suite Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 01/29] python-utils-r1.eclass: Add missing ||die for external getters Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 02/29] python-utils-r1.eclass: Add missing ||die on 'cat' file writes Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 03/29] python-utils-r1.eclass: Add missing ||die on file read Michał Górny
2015-11-25 16:16   ` Michał Górny
2015-11-26 22:26     ` Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 04/29] python-utils-r1.eclass: Remove py2.6 note from python_optimize Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 05/29] python-utils-r1.eclass: Replace local INSDESTTREE with subshells Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 06/29] python-utils-r1.eclass: Ban installation helpers in EAPIs < 5 Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 07/29] python-utils-r1.eclass: Make python_fix_shebang QAwarns fatal in EAPI 6 Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 08/29] python-utils-r1.eclass: Remove unneeded multilib inherit " Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 09/29] python-utils-r1.eclass: Support nonfatal in python_do* and python_new* Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 10/29] python-utils-r1.eclass: Make heredocs consistent Michał Górny
2015-11-23 10:55   ` Justin Lecher (jlec)
2015-11-25 12:00     ` [gentoo-dev] [PATCH] " Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 11/29] python-utils-r1.eclass: Move ||die out of command substitution subshells Michał Górny
2015-11-22 22:33   ` Davide Pesavento
2015-11-22 23:23     ` Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 12/29] python-utils-r1.eclass: Enable EAPI 6 Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 13/29] python-any-r1.eclass: Enable EAPI=6, no changes needed Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 14/29] python-single-r1.eclass: " Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 15/29] multibuild.eclass: Ban multibuild_parallel_foreach_variant in EAPI 6 Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 16/29] multibuild.eclass: Enable " Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 17/29] python-r1.eclass: Ban python_parallel_foreach_impl in " Michał Górny
2015-11-22 19:50 ` [gentoo-dev] [PATCH 18/29] python-r1.eclass: Ban python_export_best " Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 19/29] python-r1.eclass: Fix missing explicit eutils inherit for EAPI < 6 Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 20/29] python-r1.eclass: Enable EAPI 6 Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 21/29] distutils-r1.eclass: esetup.py, respect nonfatal in " Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 22/29] distutils-r1.eclass: Use default_src_prepare to apply patches " Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 23/29] distutils-r1.eclass: Ban no-op default phase implementations " Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 24/29] distutils-r1.eclass: Make pypy/share QA error fatal " Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 25/29] distutils-r1.eclass: Ban EXAMPLES " Michał Górny
2015-11-22 21:14   ` Markus Meier
2015-11-25 12:01     ` [gentoo-dev] [PATCH] " Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 26/29] distutils-r1.eclass: Ban DISTUTILS_NO_PARALLEL_BUILD " Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 27/29] distutils-r1.eclass: Make default _all impl call warning fatal " Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 28/29] distutils-r1.eclass: Remove unnecessary eutils inherit " Michał Górny
2015-11-22 19:51 ` [gentoo-dev] [PATCH 29/29] distutils-r1.eclass: Enable " Michał Górny
2015-11-26 22:30 ` Michał Górny [this message]
2015-11-26 22:30   ` [gentoo-dev] [PATCH 2/2] python-utils-r1.eclass: python_fix_shebang, accept symlink as parameter Michał Górny
2015-11-27  5:35   ` [gentoo-dev] [PATCH 1/2] python-utils-r1.eclass: python_fix_shebang, skip empty files Michał Górny
2015-11-27 13:15   ` Michał Górny
2015-11-28 19:10 ` [gentoo-dev] [PATCHES] Clean-up & EAPI 6 support for python-r1 suite Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1448577009-32161-1-git-send-email-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox