summaryrefslogtreecommitdiffstats
path: root/events/src
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2018-05-30 08:15:29 -0400
committerAmar Tumballi <amarts@redhat.com>2018-06-04 19:55:35 +0000
commit7cdcd9b022180ee279f6408f7daaa882a8266f3a (patch)
treedb92267be85f33d809d44d02b22ba63847999c7a /events/src
parent3894f4262d53d1c1c593a78b21d72ba1103c86cd (diff)
core/various: python3 compat, prepare for python2 -> python3
see https://review.gluster.org/#/c/19788/, https://review.gluster.org/#/c/19871/, and https://review.gluster.org/#/c/19952/ This patch adds version agnostic imports for urllib, cpickle, socketserver, _thread, queue, etc., suggested by Aravinda in https://review.gluster.org/#/c/19767/1 Note: Fedora packaging guidelines require explicit shebangs, so popular practices like #!/usr/bin/env python and #!/usr/bin/python are not allowed; they must be #!/usr/bin/python2 or #!/usr/bin/python3 Note: Selected small fixes from 2to3 utility. Specifically apply, basestring, funcattrs, idioms, numliterals, set_literal, types, urllib, and zip have already been applied. Note: these 2to3 fixes report no changes are necessary: exec, execfile, exitfunc, filter, getcwdu, intern, itertools, metaclass, methodattrs, ne, next, nonzero, operator, paren, raw_input, reduce, reload, renames, repr, standarderror, sys_exc, throw, tuple_params, xreadlines. Change-Id: I8d393064a1837874d8b4bc87c8ce05c679664642 updates: #411 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'events/src')
-rw-r--r--events/src/glustereventsd.py5
-rw-r--r--events/src/utils.py5
2 files changed, 8 insertions, 2 deletions
diff --git a/events/src/glustereventsd.py b/events/src/glustereventsd.py
index 32fb6c52aa9..014f5a0009d 100644
--- a/events/src/glustereventsd.py
+++ b/events/src/glustereventsd.py
@@ -13,7 +13,10 @@
from __future__ import print_function
import sys
import signal
-import SocketServer
+try:
+ import socketserver
+except ImportError:
+ import SocketServer as socketserver
import socket
from argparse import ArgumentParser, RawDescriptionHelpFormatter
diff --git a/events/src/utils.py b/events/src/utils.py
index 7d9b7b51d95..c1c0bccfe66 100644
--- a/events/src/utils.py
+++ b/events/src/utils.py
@@ -16,7 +16,10 @@ import fcntl
from errno import EBADF
from threading import Thread
import multiprocessing
-from Queue import Queue
+try:
+ from queue import Queue
+except ImportError:
+ from Queue import Queue
from datetime import datetime, timedelta
import base64
import hmac