From 78cb608ff7bf3a589fcb4d83530393c516e652cb Mon Sep 17 00:00:00 2001 From: janonymous Date: Sun, 5 Jul 2015 11:49:54 +0530 Subject: [PATCH] Python3: Fix Remaining issues of python3 compatibility in bin directory Changes Of py3 in bin : * https://review.openstack.org/#/c/196835/ * ConfigParser from six.moves Change-Id: Ic0374c8e09dfd595ec12c4d31b17dad30eaa803c --- bin/swift-dispersion-populate | 5 +++-- bin/swift-dispersion-report | 2 +- bin/swift-drive-audit | 4 +++- bin/swift-recon-cron | 3 ++- bin/swift-temp-url | 5 +++-- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bin/swift-dispersion-populate b/bin/swift-dispersion-populate index d80d80e5d8..aa53046cdb 100755 --- a/bin/swift-dispersion-populate +++ b/bin/swift-dispersion-populate @@ -15,14 +15,15 @@ # limitations under the License. import traceback -from ConfigParser import ConfigParser from optparse import OptionParser from sys import exit, stdout from time import time -from six.moves import range + from eventlet import GreenPool, patcher, sleep from eventlet.pools import Pool +from six.moves import range from six.moves import cStringIO as StringIO +from six.moves.configparser import ConfigParser try: from swiftclient import get_auth diff --git a/bin/swift-dispersion-report b/bin/swift-dispersion-report index b08d02717f..a50d1f7cda 100755 --- a/bin/swift-dispersion-report +++ b/bin/swift-dispersion-report @@ -15,7 +15,7 @@ # limitations under the License. from collections import defaultdict -from ConfigParser import ConfigParser +from six.moves.configparser import ConfigParser from optparse import OptionParser from sys import exit, stdout, stderr from time import time diff --git a/bin/swift-drive-audit b/bin/swift-drive-audit index ea17357998..a0a1fbac35 100755 --- a/bin/swift-drive-audit +++ b/bin/swift-drive-audit @@ -20,7 +20,9 @@ import os import re import subprocess import sys -from ConfigParser import ConfigParser + + +from six.moves.configparser import ConfigParser from swift.common.utils import backward, get_logger, dump_recon_cache, \ config_true_value diff --git a/bin/swift-recon-cron b/bin/swift-recon-cron index 7adbce0255..0b4650cd86 100755 --- a/bin/swift-recon-cron +++ b/bin/swift-recon-cron @@ -18,8 +18,9 @@ swift-recon-cron.py import os import sys -from ConfigParser import ConfigParser + from gettext import gettext as _ +from six.moves.configparser import ConfigParser from swift.common.utils import get_logger, dump_recon_cache from swift.obj.diskfile import ASYNCDIR_BASE diff --git a/bin/swift-temp-url b/bin/swift-temp-url index 1e728d1ad4..0d8012e375 100755 --- a/bin/swift-temp-url +++ b/bin/swift-temp-url @@ -17,7 +17,8 @@ from hashlib import sha1 from os.path import basename from sys import argv, exit, stderr from time import time -import urllib + +from six.moves import urllib if __name__ == '__main__': @@ -66,7 +67,7 @@ if __name__ == '__main__': stderr.write( 'WARNING: Non-object paths will be rejected by tempurl.\n') if '--quoted' in argv[5:]: - real_path = urllib.unquote(path) + real_path = urllib.parse.unquote(path) else: real_path = path sig = hmac.new(key, '%s\n%s\n%s' % (method, expires, real_path),