Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH 1/2] Replace sed call with variable substitution.
Date: Tue, 23 Apr 2013 05:45:09
Message-Id: 1366695985-3820-1-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-python] [PATCHES] Use bash built-ins rather than external tools by "Michał Górny"
1 Bash variable substitution is simpler and faster. It will also allow us
2 to spare the pipes in the next commit.
3 ---
4 gx86/eclass/python-utils-r1.eclass | 3 ++-
5 1 file changed, 2 insertions(+), 1 deletion(-)
6
7 diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
8 index 81e6d59..1ab8366 100644
9 --- a/gx86/eclass/python-utils-r1.eclass
10 +++ b/gx86/eclass/python-utils-r1.eclass
11 @@ -493,8 +493,9 @@ _python_rewrite_shebang() {
12
13 local f
14 for f; do
15 - local shebang=$(head -n 1 "${f}" | sed 's/\r$//')
16 + local shebang=$(head -n 1 "${f}")
17 local from
18 + shebang=${shebang%$'\r'}
19 debug-print "${FUNCNAME}: path = ${f}"
20 debug-print "${FUNCNAME}: shebang = ${shebang}"
21
22 --
23 1.8.1.5