autohelp.py: remove the oslo.i18n hack
All the projects use oslo.i18n in kilo and liberty, the workaround for projects non using this module is not needed anymore. Change-Id: I7a096c11eef2ae2f3e9006fa0379f49f18a1cc81
This commit is contained in:
parent
a92753f4cb
commit
a98a112832
|
@ -29,7 +29,6 @@ import sys
|
|||
|
||||
import git
|
||||
from lxml import etree
|
||||
import oslo_i18n as i18n
|
||||
import stevedore
|
||||
|
||||
from hooks import HOOKS # noqa
|
||||
|
@ -121,29 +120,6 @@ def import_modules(repo_location, package_name, verbose=0):
|
|||
populate the configuration object (cfg.CONF) created from Oslo.
|
||||
"""
|
||||
|
||||
# If the project uses oslo.i18n, make sure that it is initialized so that
|
||||
# the builtins contain the _ function.
|
||||
requirements = os.path.join(repo_location, 'requirements.txt')
|
||||
with open(requirements) as fd:
|
||||
with_i18n = False
|
||||
for line in fd:
|
||||
if line.startswith('oslo.i18n'):
|
||||
i18n.enable_lazy()
|
||||
i18n.install(package_name)
|
||||
with_i18n = True
|
||||
break
|
||||
if not with_i18n:
|
||||
# NOTE(gpocentek): projects didn't use oslo.i18n on havana, and
|
||||
# some imports fail because _ is not yet registered in the
|
||||
# builtins. We try to import and setup the translation tools
|
||||
# manually.
|
||||
try:
|
||||
modname = "%s.openstack.common.gettextutils" % package_name
|
||||
module = importlib.import_module(modname)
|
||||
module.install(package_name)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
pkg_location = os.path.join(repo_location, package_name)
|
||||
for root, dirs, files in os.walk(pkg_location):
|
||||
skipdir = False
|
||||
|
|
Loading…
Reference in New Issue