From: Jay S. Bryant Date: Wed, 10 Sep 2014 03:07:48 +0000 (-0500) Subject: Remove deprecated use of gettextutils import _ X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=a108a828bb6123c46d5452eff862d9d88a323226;p=openstack-build%2Fcinder-build.git Remove deprecated use of gettextutils import _ The initial hacking check I wrote allowed users to check in code using 'from cinder.openstack.common.gettextutils import _' or 'from cinder.i18n import _'. This was to ease the transition for code that was in flight with the old import. Now that we have moved Cinder over to using cinder.i18n and most of the code that was in flight with the old import has been merged and/or fixed, I am updating the hacking check to enforce the use of cinder.i18n and fixing the cases that still had the old import. Change-Id: Iff6ccac1996c06bbc5defd5139113a2baa0b677c --- diff --git a/cinder/api/__init__.py b/cinder/api/__init__.py index 0b9bda0fa..bfa5ae02b 100644 --- a/cinder/api/__init__.py +++ b/cinder/api/__init__.py @@ -18,7 +18,7 @@ from oslo.config import cfg import paste.urlmap -from cinder.openstack.common.gettextutils import _ +from cinder.i18n import _ from cinder.openstack.common import log as logging diff --git a/cinder/hacking/checks.py b/cinder/hacking/checks.py index 3f6e675ee..d05ad7efb 100644 --- a/cinder/hacking/checks.py +++ b/cinder/hacking/checks.py @@ -36,7 +36,7 @@ translated_log = re.compile( "\(\s*_\(\s*('|\")") string_translation = re.compile(r"(.)*_\(\s*('|\")") vi_header_re = re.compile(r"^#\s+vim?:.+") -underscore_import_check = re.compile(r"(.)*import _(.)*") +underscore_import_check = re.compile(r"(.)*i18n\s+import\s+_(.)*") # We need this for cases where they have created their own _ function. custom_underscore_check = re.compile(r"(.)*_\s*=\s*(.)*") no_audit_log = re.compile(r"(.)*LOG\.audit(.)*") diff --git a/cinder/keymgr/barbican.py b/cinder/keymgr/barbican.py index 1ebcfd321..3d7e8ac44 100644 --- a/cinder/keymgr/barbican.py +++ b/cinder/keymgr/barbican.py @@ -27,10 +27,10 @@ from keystoneclient.v2_0 import client as keystone_client from oslo.config import cfg from cinder import exception +from cinder.i18n import _ from cinder.keymgr import key as keymgr_key from cinder.keymgr import key_mgr from cinder.openstack.common import excutils -from cinder.openstack.common.gettextutils import _ # noqa from cinder.openstack.common import log as logging CONF = cfg.CONF diff --git a/cinder/volume/drivers/prophetstor/dpl_fc.py b/cinder/volume/drivers/prophetstor/dpl_fc.py index 88e564ba6..a266f7657 100644 --- a/cinder/volume/drivers/prophetstor/dpl_fc.py +++ b/cinder/volume/drivers/prophetstor/dpl_fc.py @@ -18,7 +18,7 @@ import errno import six from cinder import exception -from cinder.openstack.common.gettextutils import _ +from cinder.i18n import _ from cinder.openstack.common import log as logging from cinder.volume import driver from cinder.volume.drivers.prophetstor import dplcommon diff --git a/cinder/volume/drivers/prophetstor/dpl_iscsi.py b/cinder/volume/drivers/prophetstor/dpl_iscsi.py index 4b289be35..cd53317c1 100644 --- a/cinder/volume/drivers/prophetstor/dpl_iscsi.py +++ b/cinder/volume/drivers/prophetstor/dpl_iscsi.py @@ -16,7 +16,7 @@ import errno from cinder import exception -from cinder.openstack.common.gettextutils import _ +from cinder.i18n import _ from cinder.openstack.common import log as logging import cinder.volume.driver from cinder.volume.drivers.prophetstor import dplcommon diff --git a/cinder/volume/drivers/prophetstor/dplcommon.py b/cinder/volume/drivers/prophetstor/dplcommon.py index a6f02165d..d446ce2ed 100644 --- a/cinder/volume/drivers/prophetstor/dplcommon.py +++ b/cinder/volume/drivers/prophetstor/dplcommon.py @@ -26,7 +26,7 @@ import time import six from cinder import exception -from cinder.openstack.common.gettextutils import _ +from cinder.i18n import _ from cinder.openstack.common import log as logging from cinder.openstack.common import loopingcall from cinder.openstack.common import units diff --git a/cinder/volume/drivers/remotefs.py b/cinder/volume/drivers/remotefs.py index abed9c806..f0393b460 100644 --- a/cinder/volume/drivers/remotefs.py +++ b/cinder/volume/drivers/remotefs.py @@ -23,8 +23,8 @@ import tempfile from oslo.config import cfg from cinder import exception +from cinder.i18n import _ from cinder.image import image_utils -from cinder.openstack.common.gettextutils import _ from cinder.openstack.common import log as logging from cinder.openstack.common import processutils as putils from cinder.openstack.common import units diff --git a/cinder/volume/drivers/smbfs.py b/cinder/volume/drivers/smbfs.py index 2a355a891..d824e8127 100644 --- a/cinder/volume/drivers/smbfs.py +++ b/cinder/volume/drivers/smbfs.py @@ -20,8 +20,8 @@ from oslo.config import cfg from cinder.brick.remotefs import remotefs from cinder import exception +from cinder.i18n import _ from cinder.image import image_utils -from cinder.openstack.common.gettextutils import _ from cinder.openstack.common import log as logging from cinder.openstack.common import processutils as putils from cinder.openstack.common import units diff --git a/cinder/volume/drivers/vmware/datastore.py b/cinder/volume/drivers/vmware/datastore.py index a44baefa7..ce29acd16 100644 --- a/cinder/volume/drivers/vmware/datastore.py +++ b/cinder/volume/drivers/vmware/datastore.py @@ -17,8 +17,8 @@ Classes and utility methods for datastore selection. """ +from cinder.i18n import _ from cinder.openstack.common import excutils -from cinder.openstack.common.gettextutils import _ from cinder.openstack.common import log as logging from cinder.volume.drivers.vmware import error_util from cinder.volume.drivers.vmware import vim_util diff --git a/cinder/volume/drivers/windows/remotefs.py b/cinder/volume/drivers/windows/remotefs.py index ff22214fc..0d9482e8a 100644 --- a/cinder/volume/drivers/windows/remotefs.py +++ b/cinder/volume/drivers/windows/remotefs.py @@ -21,7 +21,7 @@ if sys.platform == 'win32': from cinder.brick.remotefs import remotefs from cinder import exception -from cinder.openstack.common.gettextutils import _ +from cinder.i18n import _ from cinder.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/cinder/volume/drivers/windows/smbfs.py b/cinder/volume/drivers/windows/smbfs.py index c2c07985b..c7e26eff4 100644 --- a/cinder/volume/drivers/windows/smbfs.py +++ b/cinder/volume/drivers/windows/smbfs.py @@ -21,9 +21,9 @@ import sys from oslo.config import cfg from cinder import exception +from cinder.i18n import _ from cinder.image import image_utils from cinder.openstack.common import fileutils -from cinder.openstack.common.gettextutils import _ from cinder.openstack.common import log as logging from cinder.openstack.common import units from cinder import utils