(shebangline)
| 194 | |
| 195 | |
| 196 | def populate_flags(shebangline): |
| 197 | old_flags = b'' |
| 198 | if keep_flags: |
| 199 | old_flags = parse_shebang(shebangline) |
| 200 | if old_flags: |
| 201 | old_flags = old_flags[2:] |
| 202 | if not (old_flags or add_flags): |
| 203 | return b'' |
| 204 | # On Linux, the entire string following the interpreter name |
| 205 | # is passed as a single argument to the interpreter. |
| 206 | # e.g. "#! /usr/bin/python3 -W Error -s" runs "/usr/bin/python3 "-W Error -s" |
| 207 | # so shebang should have single '-' where flags are given and |
| 208 | # flag might need argument for that reasons adding new flags is |
| 209 | # between '-' and original flags |
| 210 | # e.g. #! /usr/bin/python3 -sW Error |
| 211 | return b' -' + add_flags + old_flags |
| 212 | |
| 213 | |
| 214 | def fixline(line): |
no test coverage detected