Commit 03596358 authored by Michal Čihař's avatar Michal Čihař

Share code for getting version module

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 278fd4e3
......@@ -37,23 +37,7 @@ def get_version_module(module, name, url, optional=False):
return None
raise Exception(
'Failed to import %s, please install %s from %s' % (
module,
name,
url,
)
)
return mod
def get_translate_module(name, url):
'''
Returns module object for translate toolkit.
'''
try:
mod = importlib.import_module('translate.__version__')
except ImportError:
raise Exception(
'Failed to import translate-toolkit, please install %s from %s' % (
module.replace('.__version__', ''),
name,
url,
)
......@@ -127,7 +111,7 @@ def get_versions():
name = 'Translate Toolkit'
url = 'http://toolkit.translatehouse.org/'
mod = get_translate_module(name, url)
mod = get_version_module('translate.__version__', name, url)
result.append((
name,
url,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment