Remove py2 support from cipd.py

Python 2 is officially deprecated and should not be used anymore for any
scripts.

Change-Id: I24ef651f58c40969bade669577ff15a632eead2d
Reviewed-on: https://fuchsia-review.googlesource.com/c/infra/prebuilt/+/853644
Reviewed-by: Rob Mohr <mohrr@google.com>
diff --git a/cipd.py b/cipd.py
index 5c45101..c07ccbd 100755
--- a/cipd.py
+++ b/cipd.py
@@ -6,32 +6,20 @@
 
 This script installs cipd in ./tools/ (if necessary) and then executes it,
 passing through all arguments.
-
-Must be tested with Python 2 and Python 3.
 """
 
-from __future__ import print_function
-
+import base64
 import hashlib
+import http.client
 import os
 import platform
 import ssl
 import subprocess
 import sys
-import base64
-
-try:
-    import httplib  # Python 2
-except ImportError:
-    import http.client as httplib
-
-try:
-    import urlparse  # Python 2
-except ImportError:
-    import urllib.parse as urlparse
+import urllib.parse
 
 # Generated from the following command. May need to be periodically rerun.
-# $ cipd ls infra/tools/cipd | perl -pe "s[.*/][];s/^/    '/;s/\s*$/',\n/;"
+# $ cipd ls infra/tools/cipd | perl -pe 's[.*/][];s/^/    "/;s/\s*$/",\n/;'
 SUPPORTED_PLATFORMS = (
     "aix-ppc64",
     "linux-386",
@@ -43,11 +31,13 @@
     "linux-mipsle",
     "linux-ppc64",
     "linux-ppc64le",
+    "linux-riscv64",
     "linux-s390x",
     "mac-amd64",
     "mac-arm64",
     "windows-386",
     "windows-amd64",
+    "windows-arm64",
 )
 
 
@@ -138,11 +128,11 @@
 
     proxy_env = os.environ.get("HTTPS_PROXY") or os.environ.get("https_proxy")
     if proxy_env in (None, ""):
-        conn = httplib.HTTPSConnection(target_url)
+        conn = http.client.HTTPSConnection(target_url)
         return conn
 
-    url = urlparse.urlparse(proxy_env)
-    conn = httplib.HTTPSConnection(url.hostname, url.port)
+    url = urllib.parse.urlparse(proxy_env)
+    conn = http.client.HTTPSConnection(url.hostname, url.port)
     headers = {}
     if url.username and url.password:
         auth = "%s:%s" % (url.username, url.password)
@@ -222,20 +212,19 @@
                 "    brew doctor\n"
                 "\n"
                 "Otherwise, check that your machine's Python can use SSL, "
-                "testing with the httplib module on Python 2 or http.client on "
-                "Python 3.",
+                "testing with the http.client module.",
                 file=sys.stderr,
             )
             raise
 
         # Found client bytes.
-        if res.status == httplib.OK:  # pylint: disable=no-else-return
+        if res.status == http.client.OK:  # pylint: disable=no-else-return
             return content
 
         # Redirecting to another location.
-        elif res.status == httplib.FOUND:
+        elif res.status == http.client.FOUND:
             location = res.getheader("location")
-            url = urlparse.urlparse(location)
+            url = urllib.parse.urlparse(location)
             if url.netloc != conn.host:
                 conn = https_connect_with_proxy(url.netloc)
             path = "{}?{}".format(url.path, url.query)