Merge pull request #15656 from abadger/ziploader-namespace

Fix ziploader for the cornercase of ansible invoking ansible.
This commit is contained in:
Toshio Kuratomi
2016-04-29 11:12:11 -07:00
11 changed files with 53 additions and 22 deletions

View File

@@ -145,15 +145,15 @@ class PluginLoader:
def _get_package_paths(self):
''' Gets the path of a Python package '''
paths = []
if not self.package:
return []
if not hasattr(self, 'package_path'):
m = __import__(self.package)
parts = self.package.split('.')[1:]
self.package_path = os.path.join(os.path.dirname(m.__file__), *parts)
paths.extend(self._all_directories(self.package_path))
return paths
for parent_mod in parts:
m = getattr(m, parent_mod)
self.package_path = os.path.dirname(m.__file__)
return self._all_directories(self.package_path)
def _get_paths(self):
''' Return a list of paths to search for plugins in '''