ansible: fix 3.x dependency scanning on OS X
On OS X with case-insensitive filenames, resolving 'ansible.module_utils.facts.base.Hardware' finds 'ansible.module_utils.facts.hardware/__init__.py', because module_finder's procedure is completely wrong for resolving child modules. Patch over it for now since it otherwise works for Ansible.
This commit is contained in:
parent
3a8ea930d7
commit
3b7a1d4f36
|
@ -91,18 +91,22 @@ def find(name, path=(), parent=None):
|
|||
return parent
|
||||
|
||||
fp, modpath, (suffix, mode, kind) = tup
|
||||
if fp:
|
||||
fp.close()
|
||||
|
||||
if parent and modpath == parent.path:
|
||||
# 'from timeout import timeout', where 'timeout' is a function but also
|
||||
# the name of the module being imported.
|
||||
return None
|
||||
|
||||
if fp:
|
||||
fp.close()
|
||||
|
||||
if kind == imp.PKG_DIRECTORY:
|
||||
modpath = os.path.join(modpath, '__init__.py')
|
||||
|
||||
module = Module(head, modpath, kind, parent)
|
||||
if tail:
|
||||
# TODO: this code is entirely wrong on Python 3.x, but works well enough
|
||||
# for Ansible. We need a new find_child() that only looks in the package
|
||||
# directory, never falling back to the parent search path.
|
||||
if tail and kind == imp.PKG_DIRECTORY:
|
||||
return find_relative(module, tail, path)
|
||||
return module
|
||||
|
||||
|
|
Loading…
Reference in New Issue