aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklós Tusz <miklos@aon3d.com>2022-03-08 11:49:03 -0800
committerKevinOConnor <kevin@koconnor.net>2022-03-14 13:53:21 -0400
commitc8cc2a1e276d475123dea8b66284e70e563f253c (patch)
tree6ec73d7ad99ca0d92d116d1b660e8c1b2920b851
parent12e304fbec5de9a8b50a7044d1f24f05ad46e780 (diff)
downloadkutter-c8cc2a1e276d475123dea8b66284e70e563f253c.tar.gz
kutter-c8cc2a1e276d475123dea8b66284e70e563f253c.tar.xz
kutter-c8cc2a1e276d475123dea8b66284e70e563f253c.zip
scripts: Migrate `check_whitespace.py` to python3
Modified strings used in pattern matching to b-strings as are expected with python3. Signed-off-by: Miklos Tusz <miklos@aon3d.com>
-rwxr-xr-xscripts/check_whitespace.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/check_whitespace.py b/scripts/check_whitespace.py
index da4cadab..fe8c7ae8 100755
--- a/scripts/check_whitespace.py
+++ b/scripts/check_whitespace.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python3
# Check files for whitespace problems
#
# Copyright (C) 2018 Kevin O'Connor <kevin@koconnor.net>
@@ -29,7 +29,7 @@ def check_file(filename):
# Do checks
is_source_code = any([filename.endswith(s) for s in ['.c', '.h', '.py']])
lineno = 0
- for lineno, line in enumerate(data.split('\n')):
+ for lineno, line in enumerate(data.split(b'\n')):
# Verify line is valid utf-8
try:
line = line.decode('utf-8')
@@ -53,9 +53,9 @@ def check_file(filename):
# Check for more than 80 characters
if is_source_code and len(line) > 80:
report_error(filename, lineno, "Line longer than 80 characters")
- if not data.endswith('\n'):
+ if not data.endswith(b'\n'):
report_error(filename, lineno, "No newline at end of file")
- if data.endswith('\n\n'):
+ if data.endswith(b'\n\n'):
report_error(filename, lineno, "Extra newlines at end of file")
def main():