Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o
Subject: [gentoo-dev] python-utils-r1.eclass: fixes & improvements for python_fix_shebang
Date: Fri, 13 Jun 2014 22:36:50
Message-Id: 20140614003602.44da5f4e@pomiot.lan
1 Hello, all.
2
3 Attaching two patches: one that practically rewrites
4 python_fix_shebang, and the other one that adds proper tests for it.
5
6 Major changes:
7
8 1. I replaced unclear space magic that attempted to handle corner cases
9 with plain 'for i in ${shebang}' -- trying to match various python*
10 patterns left-to-right to shebang. This specifically fixes corner cases
11 like:
12
13 /usr/bin/python2 python
14
15 (not that it's meaningful but we mangle it correctly now -- always
16 the leftmost matching thingie is replaced!)
17
18 2. I've added --quiet and --force options, the former to silence
19 the 'fixing shebang in ...' output, the latter to force replacing even
20 incompatible shebangs (e.g. python3 -> python2.7).
21
22 3. Added proper tests for a lot of cases, including corner cases like:
23
24 /mnt/python2/usr/bin/python3
25
26 Please review.
27
28 --
29 Best regards,
30 Michał Górny

Attachments

File name MIME type
python-utils-r1.eclass.diff text/x-patch
python-utils-r1.sh.diff text/x-patch
signature.asc application/pgp-signature