#14490, #14491: add 'sundry'-style import tests for Tools/scripts.

This patch changes a few of the scripts to have __name__=='__main__'
clauses so that they are importable without running.  Also fixes the
syntax errors revealed by the tests.
diff --git a/Tools/scripts/findnocoding.py b/Tools/scripts/findnocoding.py
index 77607ce..a494a48 100755
--- a/Tools/scripts/findnocoding.py
+++ b/Tools/scripts/findnocoding.py
@@ -76,29 +76,31 @@
     -c: recognize Python source files trying to compile them
     -d: debug output""" % sys.argv[0]
 
-try:
-    opts, args = getopt.getopt(sys.argv[1:], 'cd')
-except getopt.error as msg:
-    print(msg, file=sys.stderr)
-    print(usage, file=sys.stderr)
-    sys.exit(1)
+if __name__ == '__main__':
 
-is_python = pysource.looks_like_python
-debug = False
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], 'cd')
+    except getopt.error as msg:
+        print(msg, file=sys.stderr)
+        print(usage, file=sys.stderr)
+        sys.exit(1)
 
-for o, a in opts:
-    if o == '-c':
-        is_python = pysource.can_be_compiled
-    elif o == '-d':
-        debug = True
+    is_python = pysource.looks_like_python
+    debug = False
 
-if not args:
-    print(usage, file=sys.stderr)
-    sys.exit(1)
+    for o, a in opts:
+        if o == '-c':
+            is_python = pysource.can_be_compiled
+        elif o == '-d':
+            debug = True
 
-for fullpath in pysource.walk_python_files(args, is_python):
-    if debug:
-        print("Testing for coding: %s" % fullpath)
-    result = needs_declaration(fullpath)
-    if result:
-        print(fullpath)
+    if not args:
+        print(usage, file=sys.stderr)
+        sys.exit(1)
+
+    for fullpath in pysource.walk_python_files(args, is_python):
+        if debug:
+            print("Testing for coding: %s" % fullpath)
+        result = needs_declaration(fullpath)
+        if result:
+            print(fullpath)