Convert the remaining python scripts to use python 3
authorRichard Levitte <levitte@openssl.org>
Tue, 14 Dec 2021 19:29:28 +0000 (20:29 +0100)
committerRichard Levitte <levitte@openssl.org>
Wed, 15 Dec 2021 10:18:19 +0000 (11:18 +0100)
bin/mk-committers
bin/mk-cvepage

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/web/pull/283)

bin/mk-committers
bin/mk-cvepage

index b3690ec6bfc99cbe4f42326461b2ea6fb273b58a..bddf796fcae81020b3829d80c7bf37eee763f906 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 
 import json, sys
 
@@ -10,13 +10,11 @@ for member in json:
     github = '--'
     for names in member:
         if type(names) == type({}):
-            if names.has_key(u'github'):
-                github = names[u'github']
+            if 'github' in names:
+                github = names['github']
         elif names.find(' ') != -1:
             name = names
     if name and github:
-        name = name.encode('ascii', 'xmlcharrefreplace')
-        github = github.encode('ascii', 'xmlcharrefreplace')
         if github == '--':
             url = 'https://github.com/openssl'
         else:
@@ -26,4 +24,4 @@ for member in json:
 
 members.sort()
 for m in members:
-    print m
+    print(m)
index abed8b469efafe52199002086f2ec5db7433c012..81be326abefd1d46d9cf2bcb0bd89aaf712fde50 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#! /usr/bin/python3
 #
 # Convert our XML file to a HTML file for the web page
 # let's replace vulnerabilities.xsl
@@ -35,7 +35,7 @@ def merge_affects(issue,base):
        else:
           alist[-1].append(ver)
        prev = ver
-       if (unicode.isdigit(ver[-1])):   # First version after 1.0.1 is 1.0.1a
+       if (str.isdigit(ver[-1])):   # First version after 1.0.1 is 1.0.1a
            anext = ver + "a"
        elif (ver[-1] == "y"):
            anext = ver[:-1] + "za"    # We ran out of letters once so y->za->zb....
@@ -63,7 +63,7 @@ parser.add_option("-b", "--base", help="only include vulnerabilities for this ma
 
 # We need an output directory not stdout because we might write multiple files
 if not options.input:
-   print "needs input file"
+   print("needs input file")
    parser.print_help()
    exit();
 
@@ -153,5 +153,5 @@ if allissues != "":
 else:
     preface += "No vulnerabilities fixed"
 
-sys.stdout.write(preface.encode('utf-8'))
-
+sys.stdout.reconfigure(encoding='utf-8')
+sys.stdout.write(preface)