Update module_utils.six to latest (#22855)

* Update module_utils.six to latest

We've been held back on the version of six we could use on the module
side to 1.4.x because of python-2.4 compatibility.  Now that our minimum
is Python-2.6, we can update to the latest version of six in
module_utils and get rid of the second copy in lib/ansible/compat.
This commit is contained in:
Toshio Kuratomi 2017-03-23 13:35:05 -07:00 committed by GitHub
commit 2fff690caa
127 changed files with 404 additions and 911 deletions

View file

@ -6,7 +6,7 @@ future1=$(find ./bin -type f -exec grep -HL 'from __future__ import (absolute_im
metaclass2=$(find ./lib/ansible -path ./lib/ansible/modules -prune \
-o -path ./lib/ansible/modules/__init__.py \
-o -path ./lib/ansible/module_utils -prune \
-o -path ./lib/ansible/compat/six/_six.py -prune \
-o -path ./lib/ansible/module_utils/six/_six.py -prune \
-o -path ./lib/ansible/compat/selectors/_selectors2.py -prune \
-o -path ./lib/ansible/utils/module_docs_fragments -prune \
-o -name '*.py' -exec grep -HL '__metaclass__ = type' '{}' '+')
@ -14,7 +14,7 @@ metaclass2=$(find ./lib/ansible -path ./lib/ansible/modules -prune \
future2=$(find ./lib/ansible -path ./lib/ansible/modules -prune \
-o -path ./lib/ansible/modules/__init__.py \
-o -path ./lib/ansible/module_utils -prune \
-o -path ./lib/ansible/compat/six/_six.py -prune \
-o -path ./lib/ansible/module_utils/six/_six.py -prune \
-o -path ./lib/ansible/compat/selectors/_selectors2.py -prune \
-o -path ./lib/ansible/utils/module_docs_fragments -prune \
-o -name '*.py' -exec grep -HL 'from __future__ import (absolute_import, division, print_function)' '{}' '+')

View file

@ -6,8 +6,7 @@ BASESTRING_USERS=$(grep -r basestring . \
| grep isinstance \
| grep -v \
-e test/results/ \
-e lib/ansible/compat/six/_six.py \
-e lib/ansible/module_utils/six.py \
-e lib/ansible/module_utils/six/_six.py \
-e lib/ansible/modules/ \
-e '^[^:]*:#'
)

View file

@ -6,8 +6,7 @@ ITERITEMS_USERS=$(grep -rI '\.iteritems' . \
--exclude-dir docsite \
| grep -v \
-e 'six\.iteritems' \
-e lib/ansible/compat/six/_six.py \
-e lib/ansible/module_utils/six.py \
-e lib/ansible/module_utils/six/_six.py \
-e test/sanity/code-smell/no-dict-iteritems.sh \
)
@ -15,7 +14,6 @@ if [ "${ITERITEMS_USERS}" ]; then
echo 'iteritems has been removed in python3. Alternatives:'
echo ' for KEY, VALUE in DICT.items():'
echo ' from ansible.module_utils.six import iteritems ; for KEY, VALUE in iteritems(DICT):'
echo ' from ansible.compat.six import iteritems ; for KEY, VALUE in iteritems(DICT):'
echo "${ITERITEMS_USERS}"
exit 1
fi

View file

@ -6,8 +6,7 @@ ITERVALUES_USERS=$(grep -rI '\.itervalues' . \
--exclude-dir docsite \
| grep -v \
-e 'six\.itervalues' \
-e lib/ansible/compat/six/_six.py \
-e lib/ansible/module_utils/six.py \
-e lib/ansible/module_utils/six/_six.py \
-e test/sanity/code-smell/no-dict-itervalues.sh \
)
@ -15,7 +14,6 @@ if [ "${ITERVALUES_USERS}" ]; then
echo 'itervalues has been removed in python3. Alternatives:'
echo ' for VALUE in DICT.values():'
echo ' from ansible.module_utils.six import itervalues ; for VALUE in itervalues(DICT):'
echo ' from ansible.compat.six import itervalues ; for VALUE in itervalues(DICT):'
echo "${ITERVALUES_USERS}"
exit 1
fi

View file

@ -7,8 +7,7 @@ ITERKEYS_USERS=$(grep -r -I iterkeys . \
--exclude-dir docsite \
--exclude-dir results \
| grep -v \
-e lib/ansible/compat/six/_six.py \
-e lib/ansible/module_utils/six.py \
-e lib/ansible/module_utils/six/_six.py \
-e test/sanity/code-smell/no-iterkeys.sh \
-e '^[^:]*:#'
)

View file

@ -3,8 +3,7 @@
urllib_users=$(find . -name '*.py' -exec grep -H urlopen '{}' '+' | grep -v \
-e '^[^:]*/.tox/' \
-e '^\./lib/ansible/module_utils/urls.py:' \
-e '^\./lib/ansible/module_utils/six.py:' \
-e '^\./lib/ansible/compat/six/_six.py:' \
-e '^\./lib/ansible/module_utils/six/_six.py:' \
-e '^[^:]*:#'
)

View file

@ -10,8 +10,8 @@ WHITELIST='(lib/ansible/modules/cloud/digital_ocean/digital_ocean.py)'
SIX_USERS=$(find "$BASEDIR" -name '*.py' -exec grep -wH six '{}' '+' \
| grep import \
| grep -v ansible.compat \
| grep -v ansible.module_utils.six \
| grep -v 'ansible.module_utils import six' \
| egrep -v "^$WHITELIST:"
)