Change oslo.i18n to oslo_i18n

The oslo libraries are moving away from namespace packages.

bp drop-namespace-packages

Change-Id: I5b6bb46ac55b8309845fcc8b01d93d97be4e86ca
This commit is contained in:
Brant Knudson 2015-01-31 08:12:55 -06:00
parent a333c56ac9
commit 750d5a39dc
3 changed files with 17 additions and 4 deletions

View File

@ -24,8 +24,9 @@ import re
def check_oslo_namespace_imports(logical_line, blank_before, filename):
oslo_namespace_imports = re.compile(
r"(((from)|(import))\s+oslo\.((config)|(serialization)|(utils)))|"
"(from\s+oslo\s+import\s+((config)|(serialization)|(utils)))")
r"(((from)|(import))\s+oslo\."
"((config)|(serialization)|(utils)|(i18n)))|"
"(from\s+oslo\s+import\s+((config)|(serialization)|(utils)|(i18n)))")
if re.match(oslo_namespace_imports, logical_line):
msg = ("K333: '%s' must be used instead of '%s'.") % (

View File

@ -18,10 +18,10 @@ See http://docs.openstack.org/developer/oslo.i18n/usage.html .
"""
from oslo import i18n
import oslo_i18n
_translators = i18n.TranslatorFactory(domain='keystoneclient')
_translators = oslo_i18n.TranslatorFactory(domain='keystoneclient')
# The primary translation function using the well-known name "_"
_ = _translators.primary

View File

@ -567,6 +567,14 @@ class HackingCode(fixtures.Fixture):
from oslo import config
from oslo.config import cfg
from oslo_config import cfg
import oslo.i18n
import oslo_i18n
import oslo.i18n.log
import oslo_i18n.log
from oslo import i18n
from oslo.i18n import log
from oslo_i18n import log
""",
'expected_errors': [
(1, 0, 'K333'),
@ -581,5 +589,9 @@ class HackingCode(fixtures.Fixture):
(19, 0, 'K333'),
(21, 0, 'K333'),
(22, 0, 'K333'),
(25, 0, 'K333'),
(27, 0, 'K333'),
(29, 0, 'K333'),
(30, 0, 'K333'),
],
}