Remove empty path elements when constructing modname

Without this, autohelp fails if you don't put a trailing slash on
the input directory name.

Change-Id: I6c37636c87ad86f93d1fd7121461ce543a6260b3
This commit is contained in:
Shaun McCance
2014-02-11 16:13:07 -05:00
parent 50ba3733b1
commit f17327874c

View File

@@ -65,6 +65,7 @@ def import_modules(repo_location, package_name, verbose=0):
if pyfile.endswith('.py'):
modfile = os.path.join(root, pyfile).split(repo_location)[1]
modname = os.path.splitext(modfile)[0].split(os.path.sep)
modname = [m for m in modname if m != '']
modname = '.'.join(modname)
if modname.endswith('.__init__'):
modname = modname[:modname.rfind(".")]