[master 1/2] Use python3 for the proxy server and remove python2 compatibility

dashea installerbot-noreply at redhat.com
Thu Jul 30 14:28:36 UTC 2015


From: David Shea <dshea at redhat.com>

I could have sworn that I tested this thing after blindly copying it
from whatever I originally wrote it for, but the evidence suggests
otherwise.
---
 tests/kickstart_tests/proxy-cmdline.ks   | 9 +++++----
 tests/kickstart_tests/proxy-kickstart.ks | 9 +++++----
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/tests/kickstart_tests/proxy-cmdline.ks b/tests/kickstart_tests/proxy-cmdline.ks
index e64c03f..2fc17fe 100644
--- a/tests/kickstart_tests/proxy-cmdline.ks
+++ b/tests/kickstart_tests/proxy-cmdline.ks
@@ -3,8 +3,9 @@
 %pre --erroronfail
 # Write the proxy script to a file in /tmp
 cat - << "EOF" > /tmp/proxy-test.py
-from six.moves import SimpleHTTPServer, socketserver
-from six.moves.urllib.request import urlopen
+from http.server import SimpleHTTPRequestHandler
+import socketserver
+from urllib.request import urlopen
 import os, sys
 
 import logging
@@ -13,7 +14,7 @@ log_handler = logging.FileHandler('/tmp/proxy.log')
 log.setLevel(logging.INFO)
 log.addHandler(log_handler)
 
-class ProxyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
+class ProxyHandler(SimpleHTTPRequestHandler):
     def do_GET(self):
         # Log the path then proxy the request via urllib
         log.info(self.path)
@@ -33,7 +34,7 @@ ProxyServer().serve_forever()
 EOF
 
 # Run the server in the background and exit
-python /tmp/proxy-test.py > /dev/null 2>&1 &
+python3 /tmp/proxy-test.py > /dev/null 2>&1 &
 %end
 
 url --url=http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/
diff --git a/tests/kickstart_tests/proxy-kickstart.ks b/tests/kickstart_tests/proxy-kickstart.ks
index accce49..ee067ec 100644
--- a/tests/kickstart_tests/proxy-kickstart.ks
+++ b/tests/kickstart_tests/proxy-kickstart.ks
@@ -3,8 +3,9 @@
 %pre --erroronfail
 # Write the proxy script to a file in /tmp
 cat - << "EOF" > /tmp/proxy-test.py
-from six.moves import SimpleHTTPServer, socketserver
-from six.moves.urllib.request import urlopen
+from http.server import SimpleHTTPRequestHandler
+import socketserver
+from urllib.request import urlopen
 import os, sys
 
 import logging
@@ -13,7 +14,7 @@ log_handler = logging.FileHandler('/tmp/proxy.log')
 log.setLevel(logging.INFO)
 log.addHandler(log_handler)
 
-class ProxyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
+class ProxyHandler(SimpleHTTPRequestHandler):
     def do_GET(self):
         # Log the path then proxy the request via urllib
         log.info(self.path)
@@ -33,7 +34,7 @@ ProxyServer().serve_forever()
 EOF
 
 # Run the server in the background and exit
-python /tmp/proxy-test.py > /dev/null 2>&1 &
+python3 /tmp/proxy-test.py > /dev/null 2>&1 &
 %end
 
 url --url=http://dl.fedoraproject.org/pub/fedora/linux/development/$releasever/$basearch/os/ --proxy=127.0.0.1:8080


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/fe04864a80460d080cd98cf3e02b67c5db801c11


More information about the anaconda-patches mailing list