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 |