diff options
author | Florian Bruhin <me@the-compiler.org> | 2021-01-28 16:04:55 +0100 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2021-01-28 16:11:54 +0100 |
commit | bd21ff688d8598905c0ad8fd250f1f54030b7068 (patch) | |
tree | 77f9186156196499f360f76a021aa676eae1406b /scripts | |
parent | fd429fd3a59b2f1b693bdc68d177e63c3254b822 (diff) | |
download | qutebrowser-bd21ff688d8598905c0ad8fd250f1f54030b7068.tar.gz qutebrowser-bd21ff688d8598905c0ad8fd250f1f54030b7068.zip |
Use and enforce python3 shebangs in userscripts
See #6080
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/dev/misc_checks.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/dev/misc_checks.py b/scripts/dev/misc_checks.py index 1d6c3155e..f66081dbf 100644 --- a/scripts/dev/misc_checks.py +++ b/scripts/dev/misc_checks.py @@ -313,14 +313,18 @@ def check_userscript_shebangs(_args: argparse.Namespace) -> bool: continue with sub.open('r', encoding='utf-8') as f: - shebang = f.readline() + shebang = f.readline().rstrip('\n') assert shebang.startswith('#!'), shebang - binary = shebang.split()[0][2:] + shebang = shebang[2:] + binary = shebang.split()[0] if binary not in ['/bin/sh', '/usr/bin/env']: bin_name = pathlib.Path(binary).name print(f"In {sub}, use #!/usr/bin/env {bin_name} instead of #!{binary}") ok = False + elif shebang in ['/usr/bin/env python', '/usr/bin/env python2']: + print(f"In {sub}, use #!/usr/bin/env python3 instead of #!{shebang}") + ok = False return ok |