2015-10-20 03:39:15 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-11-08 01:46:33 +01:00
|
|
|
metaclass1=$(find ./bin -type f -exec grep -HL '__metaclass__ = type' '{}' '+')
|
|
|
|
future1=$(find ./bin -type f -exec grep -HL 'from __future__ import (absolute_import, division, print_function)' '{}' '+')
|
2015-10-20 03:39:15 +02:00
|
|
|
|
2016-12-06 17:29:16 +01:00
|
|
|
metaclass2=$(find ./lib/ansible -path ./lib/ansible/modules -prune \
|
2016-11-08 00:02:13 +01:00
|
|
|
-o -path ./lib/ansible/modules/__init__.py \
|
2017-06-14 17:08:34 +02:00
|
|
|
-o -path ./lib/ansible/config/__init__.py \
|
2015-10-20 03:39:15 +02:00
|
|
|
-o -path ./lib/ansible/module_utils -prune \
|
2017-03-23 21:35:05 +01:00
|
|
|
-o -path ./lib/ansible/module_utils/six/_six.py -prune \
|
2017-02-01 17:48:23 +01:00
|
|
|
-o -path ./lib/ansible/compat/selectors/_selectors2.py -prune \
|
2015-10-20 03:39:15 +02:00
|
|
|
-o -path ./lib/ansible/utils/module_docs_fragments -prune \
|
2017-05-23 23:16:49 +02:00
|
|
|
-o -path ./lib/ansible/inventory/__init__.py \
|
|
|
|
-o -path ./lib/ansible/vars/__init__.py \
|
2016-11-08 01:46:33 +01:00
|
|
|
-o -name '*.py' -exec grep -HL '__metaclass__ = type' '{}' '+')
|
2015-10-20 03:39:15 +02:00
|
|
|
|
2016-12-06 17:29:16 +01:00
|
|
|
future2=$(find ./lib/ansible -path ./lib/ansible/modules -prune \
|
2016-11-08 00:02:13 +01:00
|
|
|
-o -path ./lib/ansible/modules/__init__.py \
|
2017-06-14 17:08:34 +02:00
|
|
|
-o -path ./lib/ansible/config/__init__.py \
|
2015-10-20 03:39:15 +02:00
|
|
|
-o -path ./lib/ansible/module_utils -prune \
|
2017-03-23 21:35:05 +01:00
|
|
|
-o -path ./lib/ansible/module_utils/six/_six.py -prune \
|
2017-02-01 17:48:23 +01:00
|
|
|
-o -path ./lib/ansible/compat/selectors/_selectors2.py -prune \
|
2015-10-20 03:39:15 +02:00
|
|
|
-o -path ./lib/ansible/utils/module_docs_fragments -prune \
|
2017-05-23 23:16:49 +02:00
|
|
|
-o -path ./lib/ansible/inventory/__init__.py \
|
|
|
|
-o -path ./lib/ansible/vars/__init__.py \
|
2016-11-08 01:46:33 +01:00
|
|
|
-o -name '*.py' -exec grep -HL 'from __future__ import (absolute_import, division, print_function)' '{}' '+')
|
2015-10-20 03:39:15 +02:00
|
|
|
|
|
|
|
### TODO:
|
|
|
|
### - contrib/
|
|
|
|
### - module_utils that are py2.6+
|
|
|
|
|
|
|
|
|
|
|
|
if test -n "$metaclass1" -o -n "$metaclass2" ; then
|
|
|
|
printf "\n== Missing __metaclass__ = type ==\n"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$metaclass1" ; then
|
|
|
|
printf "$metaclass1\n"
|
|
|
|
fi
|
|
|
|
if test -n "$metaclass2" ; then
|
|
|
|
printf "$metaclass2\n"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$future1" -o -n "$future2" ; then
|
|
|
|
printf "\n== Missing from __future__ import (absolute_import, division, print_function) ==\n"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$future1" ; then
|
|
|
|
printf "$future1\n"
|
|
|
|
fi
|
|
|
|
if test -n "$future2" ; then
|
|
|
|
printf "$future2\n"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -n "$future1$future2$metaclass1$metaclass2" ; then
|
|
|
|
failures=$(printf "$future1$future2$metaclass1$metaclass2"| wc -l)
|
|
|
|
failures=$(expr $failures + 2)
|
|
|
|
exit $failures
|
|
|
|
fi
|
|
|
|
exit 0
|