summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorChristoph Erhardt <kolab@sicherha.de>2022-03-13 20:48:00 +0100
committerChristoph Erhardt <kolab@sicherha.de>2022-03-13 20:48:12 +0100
commit81921eb1f9949abc5dea46823516ab1d33ae4857 (patch)
tree110fe83f0c6669db41374af63fb90fa1bce5097a /pykolab
parente6c4153ac7de6d32c57c88cdec4cc627863ad506 (diff)
downloadpykolab-81921eb1f9949abc5dea46823516ab1d33ae4857.tar.gz
[Python 3] relative imports fixes (dynamic imports)
Summary: similar to D3391, but with variables Reviewers: #pykolab_developers, sicherha Reviewed By: #pykolab_developers, sicherha Differential Revision: https://git.kolab.org/D3427
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/cli/commands.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/pykolab/cli/commands.py b/pykolab/cli/commands.py
index 29e327d..16ef753 100644
--- a/pykolab/cli/commands.py
+++ b/pykolab/cli/commands.py
@@ -45,7 +45,7 @@ def __init__():
cmd_name = module_name.replace('cmd_', '')
#print "exec(\"from %s import __init__ as %s_register\"" % (module_name,cmd_name)
try:
- exec("from %s import __init__ as %s_register" % (module_name,cmd_name))
+ exec("from .%s import __init__ as %s_register" % (module_name,cmd_name))
except ImportError:
pass
@@ -122,7 +122,7 @@ def execute(cmd_name, *args, **kw):
group = commands[cmd_name]['group']
command_name = commands[cmd_name]['cmd_name']
try:
- exec("from %s.cmd_%s import cli_options as %s_%s_cli_options" % (group,command_name,group,command_name))
+ exec("from .%s.cmd_%s import cli_options as %s_%s_cli_options" % (group,command_name,group,command_name))
exec("%s_%s_cli_options()" % (group,command_name))
except ImportError:
pass
@@ -152,7 +152,7 @@ def register_group(dirname, module):
module_name = filename.replace('.py','')
cmd_name = module_name.replace('cmd_', '')
#print "exec(\"from %s.%s import __init__ as %s_%s_register\"" % (module,module_name,module,cmd_name)
- exec("from %s.%s import __init__ as %s_%s_register" % (module,module_name,module,cmd_name))
+ exec("from .%s.%s import __init__ as %s_%s_register" % (module,module_name,module,cmd_name))
exec("%s_%s_register()" % (module,cmd_name))
def register(cmd_name, func, group=None, description=None, aliases=[]):