mirror of
				https://github.com/Klipper3d/klipper.git
				synced 2025-10-31 18:36:09 +01:00 
			
		
		
		
	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>
This commit is contained in:
		
				
					committed by
					
						 KevinOConnor
						KevinOConnor
					
				
			
			
				
	
			
			
			
						parent
						
							12e304fbec
						
					
				
				
					commit
					c8cc2a1e27
				
			| @@ -1,4 +1,4 @@ | |||||||
| #!/usr/bin/env python2 | #!/usr/bin/env python3 | ||||||
| # Check files for whitespace problems | # Check files for whitespace problems | ||||||
| # | # | ||||||
| # Copyright (C) 2018  Kevin O'Connor <kevin@koconnor.net> | # Copyright (C) 2018  Kevin O'Connor <kevin@koconnor.net> | ||||||
| @@ -29,7 +29,7 @@ def check_file(filename): | |||||||
|     # Do checks |     # Do checks | ||||||
|     is_source_code = any([filename.endswith(s) for s in ['.c', '.h', '.py']]) |     is_source_code = any([filename.endswith(s) for s in ['.c', '.h', '.py']]) | ||||||
|     lineno = 0 |     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 |         # Verify line is valid utf-8 | ||||||
|         try: |         try: | ||||||
|             line = line.decode('utf-8') |             line = line.decode('utf-8') | ||||||
| @@ -53,9 +53,9 @@ def check_file(filename): | |||||||
|         # Check for more than 80 characters |         # Check for more than 80 characters | ||||||
|         if is_source_code and len(line) > 80: |         if is_source_code and len(line) > 80: | ||||||
|             report_error(filename, lineno, "Line longer than 80 characters") |             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") |         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") |         report_error(filename, lineno, "Extra newlines at end of file") | ||||||
|  |  | ||||||
| def main(): | def main(): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user