summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2017-11-06 07:27:47 -0800
committerToshio Kuratomi <a.badger@gmail.com>2017-11-06 11:22:54 -0800
commitb77de1bd5dbeb8cfb42c8b7589c60a0353f77ee0 (patch)
tree60ab501b60a0b27191375daabd71dc2b9162fabe
parent2fb4f547a915755e21be401bb7fd3f4817505e89 (diff)
downloadansible-b77de1bd5dbeb8cfb42c8b7589c60a0353f77ee0.tar.gz
If we can't find a .py file for the system six, use our bundled copy instead.
Fixes #32567
-rw-r--r--lib/ansible/compat/six/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/ansible/compat/six/__init__.py b/lib/ansible/compat/six/__init__.py
index 4860440419..eae73e1f71 100644
--- a/lib/ansible/compat/six/__init__.py
+++ b/lib/ansible/compat/six/__init__.py
@@ -50,5 +50,12 @@ if _system_six:
six = _system_six
else:
from . import _six as six
+
six_py_file = '{0}.py'.format(os.path.splitext(six.__file__)[0])
+if not os.path.exists(six_py_file):
+ # Only the .pyc/.pyo version of six was installed but we need a .py file
+ # Fallback to the bundled copy
+ from . import _six as six
+ six_py_file = '{0}.py'.format(os.path.splitext(six.__file__)[0])
+
exec(open(six_py_file, 'rb').read())