Enable oslo.i18n for oslo.vmware

Change-Id: Ie6c8406bf55a4fb96373cdd3e1a2f5b3c2aafe59
This commit is contained in:
Davanum Srinivas 2014-09-09 18:37:57 -04:00
parent 48847a5857
commit 5571e9f435
15 changed files with 48 additions and 16 deletions

1
doc/source/history.rst Normal file
View File

@ -0,0 +1 @@
.. include:: ../../ChangeLog

View File

@ -10,6 +10,7 @@ Contents:
installation
usage
contributing
history
Code Documentation
==================

View File

@ -2,7 +2,6 @@
# The list of modules to copy from oslo-incubator.git
module=excutils
module=gettextutils
module=units
script=tools/run_cross_tests.sh

35
oslo/vmware/_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.
See http://docs.openstack.org/developer/oslo.i18n/usage.html
"""
from oslo import i18n
_translators = i18n.TranslatorFactory(domain='oslo.vmware')
# 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

@ -25,10 +25,10 @@ import logging
import six
from oslo.vmware._i18n import _, _LE, _LI, _LW
from oslo.vmware.common import loopingcall
from oslo.vmware import exceptions
from oslo.vmware.openstack.common import excutils
from oslo.vmware.openstack.common.gettextutils import _, _LE, _LI, _LW
from oslo.vmware import pbm
from oslo.vmware import vim
from oslo.vmware import vim_util

View File

@ -21,7 +21,7 @@ import sys
from eventlet import event
from eventlet import greenthread
from oslo.vmware.openstack.common.gettextutils import _LE, _LW
from oslo.vmware._i18n import _LE, _LW
from oslo.vmware.openstack.common import timeutils
LOG = logging.getLogger(__name__)

View File

@ -21,7 +21,7 @@ import logging
import six
from oslo.vmware.openstack.common.gettextutils import _, _LE
from oslo.vmware._i18n import _, _LE
LOG = logging.getLogger(__name__)

View File

@ -25,8 +25,8 @@ from eventlet import greenthread
from eventlet import queue
from eventlet import timeout
from oslo.vmware._i18n import _
from oslo.vmware import exceptions
from oslo.vmware.openstack.common.gettextutils import _
from oslo.vmware import rw_handles

View File

@ -16,7 +16,7 @@ import posixpath
import six.moves.urllib.parse as urlparse
from oslo.vmware.openstack.common.gettextutils import _
from oslo.vmware._i18n import _
from oslo.vmware import vim_util

View File

@ -27,7 +27,7 @@ import urlparse
import suds.sax.element as element
from oslo.vmware.openstack.common.gettextutils import _LW
from oslo.vmware._i18n import _LW
from oslo.vmware import service
from oslo.vmware import vim_util

View File

@ -30,9 +30,9 @@ import urlparse
import netaddr
from oslo.vmware._i18n import _, _LE, _LW
from oslo.vmware import exceptions
from oslo.vmware.openstack.common import excutils
from oslo.vmware.openstack.common.gettextutils import _, _LE, _LW
from oslo.vmware import vim_util

View File

@ -25,8 +25,8 @@ import netaddr
import six
import suds
from oslo.vmware._i18n import _
from oslo.vmware import exceptions
from oslo.vmware.openstack.common.gettextutils import _
from oslo.vmware import vim_util

View File

@ -11,7 +11,7 @@ iso8601>=0.1.9
# for jsonutils
six>=1.7.0
# used by openstack/common/gettextutils.py
oslo.i18n>=0.3.0
Babel>=1.3
# for the routing notifier

View File

@ -155,9 +155,7 @@ class PBMUtilityTest(base.TestCase):
self.assertIsNone(wsdl)
def expected_wsdl(version):
driver_dir = os.path.join(os.path.dirname(__file__), '..',
'oslo', 'vmware')
driver_abs_dir = os.path.abspath(driver_dir)
driver_abs_dir = os.path.abspath(os.path.dirname(pbm.__file__))
path = os.path.join(driver_abs_dir, 'wsdl', version,
'pbmService.wsdl')
return urlparse.urljoin('file:', urllib.pathname2url(path))

View File

@ -1,5 +1,4 @@
[tox]
skipsdist = True
envlist = py26,py27,py33,py34,pep8
[testenv]
@ -7,7 +6,6 @@ setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}'
usedevelop = True
[testenv:pep8]
commands = flake8
@ -33,4 +31,4 @@ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,__in
builtins = _
[hacking]
import_exceptions = oslo.vmware.openstack.common.gettextutils
import_exceptions = oslo.vmware._i18n