Port to use oslo.i18n

Module gettextutils from oslo-incubator was graduated to separate
library (oslo.i18n) and removed from repository, so we should use
new library.

Change-Id: I15d36ac5a2bb88b332ffa38d29488b75c55a20a9
This commit is contained in:
Andrey Kurilin 2014-10-16 01:19:48 +03:00
parent 1eb1abe870
commit dc09cf27e3
25 changed files with 60 additions and 23 deletions

View File

@ -44,7 +44,7 @@ except ImportError:
from six.moves.urllib import parse
from novaclient import exceptions
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import service_catalog
from novaclient import utils

35
novaclient/i18n.py Normal file
View File

@ -0,0 +1,35 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""oslo.i18n integration module for novaclient.
See http://docs.openstack.org/developer/oslo.i18n/usage.html .
"""
from oslo import i18n
_translators = i18n.TranslatorFactory(domain='novaclient')
# The primary translation function using the well-known name "_"
_ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical

View File

@ -47,8 +47,8 @@ import novaclient.auth_plugin
from novaclient import client
from novaclient import exceptions as exc
import novaclient.extension
from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient.openstack.common.gettextutils import _
from novaclient import utils
from novaclient.v1_1 import shell as shell_v1_1
from novaclient.v3 import shell as shell_v3

View File

@ -23,8 +23,8 @@ import prettytable
import six
from novaclient import exceptions
from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient.openstack.common.gettextutils import _
arg = cliutils.arg

View File

@ -16,8 +16,9 @@
"""
Baremetal interface (v2 extension).
"""
from novaclient import base
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import utils

View File

@ -14,7 +14,7 @@
# under the License.
from novaclient import base
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import utils

View File

@ -14,7 +14,7 @@
# under the License.
from novaclient import base
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import utils

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import utils

View File

@ -14,7 +14,7 @@
# under the License.
from novaclient import base
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import utils

View File

@ -16,7 +16,7 @@
import pprint
from novaclient import base
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import utils

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import utils
from novaclient.v1_1 import shell

View File

@ -17,7 +17,7 @@ migration interface
from six.moves.urllib import parse
from novaclient import base
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import utils

View File

@ -13,7 +13,7 @@
# limitations under the License.
from novaclient import base
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import utils

View File

@ -16,7 +16,7 @@
"""Flavor access interface."""
from novaclient import base
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
class FlavorAccess(base.Resource):

View File

@ -21,7 +21,7 @@ from six.moves.urllib import parse
from novaclient import base
from novaclient import exceptions
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient import utils

View File

@ -19,7 +19,7 @@ Network interface.
from novaclient import base
from novaclient import exceptions
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
class Network(base.Resource):

View File

@ -16,7 +16,7 @@ Security group default rules interface.
from novaclient import base
from novaclient import exceptions
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
class SecurityGroupDefaultRule(base.Resource):

View File

@ -19,7 +19,7 @@ Security group rules interface (1.1 extension).
from novaclient import base
from novaclient import exceptions
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
class SecurityGroupRule(base.Resource):

View File

@ -27,7 +27,7 @@ from six.moves.urllib import parse
from novaclient import base
from novaclient import crypto
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
from novaclient.v1_1 import security_groups

View File

@ -34,8 +34,8 @@ from oslo.utils import timeutils
import six
from novaclient import exceptions
from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient.openstack.common.gettextutils import _
from novaclient.openstack.common import uuidutils
from novaclient import utils
from novaclient.v1_1 import availability_zones

View File

@ -27,7 +27,8 @@ from six.moves.urllib import parse
from novaclient import base
from novaclient import crypto
from novaclient.openstack.common.gettextutils import _
from novaclient.i18n import _
REBOOT_SOFT, REBOOT_HARD = 'SOFT', 'HARD'

View File

@ -32,8 +32,8 @@ from oslo.utils import timeutils
import six
from novaclient import exceptions
from novaclient.i18n import _
from novaclient.openstack.common import cliutils
from novaclient.openstack.common.gettextutils import _
from novaclient.openstack.common import uuidutils
from novaclient import utils
from novaclient.v3 import availability_zones

View File

@ -3,7 +3,6 @@
# The list of modules to copy from oslo-incubator
module=apiclient
module=cliutils
module=gettextutils
module=install_venv_common
module=uuidutils

View File

@ -4,6 +4,7 @@
pbr>=0.6,!=0.7,<1.0
argparse
iso8601>=0.1.9
oslo.i18n>=1.0.0 # Apache-2.0
oslo.serialization>=1.0.0 # Apache-2.0
oslo.utils>=1.0.0 # Apache-2.0
PrettyTable>=0.7,<0.8

View File

@ -48,4 +48,4 @@ show-source = True
exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build,doc/source/conf.py
[hacking]
import_exceptions = novaclient.openstack.common.gettextutils
import_exceptions = novaclient.i18n