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:13 +0100 |
commit | 8f9d07674c35d6f9148ef0867279f0ef8f10f623 (patch) | |
tree | d81c892b9124607234f3bd22f6b4971a9a1277f8 /scripts | |
parent | 38fec3726fc0aa518a3637574f7e3e0029df41d4 (diff) | |
download | qutebrowser-8f9d07674c35d6f9148ef0867279f0ef8f10f623.tar.gz qutebrowser-8f9d07674c35d6f9148ef0867279f0ef8f10f623.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 |