python-wrapper: Fix handling of line breaks.

Not really critical for anything we have in <nixpkgs> I guess, but
skipping lines three times really was a workaround and we're better off
just appending the lines ending with backslash to the pattern space so
we can accumulate all the crap until the last line of crap (crap, that
is "broken lines").

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
This commit is contained in:
aszlig 2014-07-29 06:53:17 +02:00
parent ff15c31c37
commit 21a2f99dd3
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961

View File

@ -28,7 +28,7 @@ wrapPythonProgramsIn() {
echo "wrapping \`$i'..."
sed -i "$i" -re '1 {
/^#!/!b; :r
/\\$/{n;n;n;b r}
/\\$/{N;b r}
/__future__|^ *(#.*)?$/{n;b r}
/^ *[^# ]/i import sys; sys.argv[0] = '"'$(basename "$i")'"'
}'