diff options
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/crlf.py | 12 | ||||
-rwxr-xr-x | Tools/scripts/findnocoding.py | 4 | ||||
-rwxr-xr-x | Tools/scripts/pysetup3 | 4 | ||||
-rw-r--r-- | Tools/scripts/pysource.py | 2 | ||||
-rw-r--r-- | Tools/unittestgui/unittestgui.py | 1 |
5 files changed, 13 insertions, 10 deletions
diff --git a/Tools/scripts/crlf.py b/Tools/scripts/crlf.py index 0622282..f231d29 100755 --- a/Tools/scripts/crlf.py +++ b/Tools/scripts/crlf.py @@ -8,16 +8,16 @@ def main(): if os.path.isdir(filename): print(filename, "Directory!") continue - data = open(filename, "rb").read() - if '\0' in data: + with open(filename, "rb") as f: + data = f.read() + if b'\0' in data: print(filename, "Binary!") continue - newdata = data.replace("\r\n", "\n") + newdata = data.replace(b"\r\n", b"\n") if newdata != data: print(filename) - f = open(filename, "wb") - f.write(newdata) - f.close() + with open(filename, "wb") as f: + f.write(newdata) if __name__ == '__main__': main() diff --git a/Tools/scripts/findnocoding.py b/Tools/scripts/findnocoding.py index 77607ce..c42fa7c 100755 --- a/Tools/scripts/findnocoding.py +++ b/Tools/scripts/findnocoding.py @@ -2,7 +2,7 @@ """List all those Python files that require a coding directive -Usage: nocoding.py dir1 [dir2...] +Usage: findnocoding.py dir1 [dir2...] """ __author__ = "Oleg Broytmann, Georg Brandl" @@ -50,7 +50,7 @@ def has_correct_encoding(text, codec): def needs_declaration(fullpath): try: - infile = open(fullpath, 'rU') + infile = open(fullpath) except IOError: # Oops, the file was removed - ignore it return None diff --git a/Tools/scripts/pysetup3 b/Tools/scripts/pysetup3 new file mode 100755 index 0000000..e6a908d --- /dev/null +++ b/Tools/scripts/pysetup3 @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 +import sys +from packaging.run import main +sys.exit(main()) diff --git a/Tools/scripts/pysource.py b/Tools/scripts/pysource.py index 048131e..c7dbe60 100644 --- a/Tools/scripts/pysource.py +++ b/Tools/scripts/pysource.py @@ -42,7 +42,7 @@ def _open(fullpath): return None try: - return open(fullpath, 'rU') + return open(fullpath) except IOError as err: # Access denied, or a special file - ignore it print_debug("%s: access denied: %s" % (fullpath, err)) return None diff --git a/Tools/unittestgui/unittestgui.py b/Tools/unittestgui/unittestgui.py index b526646..09a20e2 100644 --- a/Tools/unittestgui/unittestgui.py +++ b/Tools/unittestgui/unittestgui.py @@ -28,7 +28,6 @@ SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. """ __author__ = "Steve Purcell (stephen_purcell@yahoo.com)" -__version__ = "$Revision: 1.7 $"[11:-2] import sys import traceback |