| 1 |
# (c) 2014, Toshio Kuratomi <[email protected]> |
| 2 |
# |
| 3 |
# This file is part of Ansible |
| 4 |
# |
| 5 |
# Ansible is free software: you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation, either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# Ansible is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
# Make coding more python3-ish |
| 19 |
from __future__ import (absolute_import, division, print_function) |
| 20 |
__metaclass__ = type |
| 21 |
|
| 22 |
''' |
| 23 |
Compat six library. RHEL7 has python-six 1.3.0 which is too old |
| 24 |
''' |
| 25 |
# The following makes it easier for us to script updates of the bundled code |
| 26 |
_BUNDLED_METADATA = { "pypi_name": "six", "version": "1.10.0" } |
| 27 |
|
| 28 |
import os.path |
| 29 |
|
| 30 |
try: |
| 31 |
import six as _system_six |
| 32 |
#print('six_brokenpkg: using system six:', _system_six) |
| 33 |
except ImportError: |
| 34 |
#print('six_brokenpkg: no system six available') |
| 35 |
_system_six = None |
| 36 |
|
| 37 |
if _system_six: |
| 38 |
# If we need some things from even newer versions of six, then we need to |
| 39 |
# use our bundled copy instead |
| 40 |
|
| 41 |
if ( # Added in six-1.8.0 |
| 42 |
not hasattr(_system_six.moves, 'shlex_quote') or |
| 43 |
# Added in six-1.4.0 |
| 44 |
not hasattr(_system_six, 'byte2int') or |
| 45 |
not hasattr(_system_six, 'add_metaclass') or |
| 46 |
not hasattr(_system_six.moves, 'urllib') |
| 47 |
): |
| 48 |
|
| 49 |
_system_six = False |
| 50 |
|
| 51 |
if _system_six: |
| 52 |
six = _system_six |
| 53 |
else: |
| 54 |
from . import _six as six |
| 55 |
six_py_file = '{0}.py'.format(os.path.splitext(six.__file__)[0]) |
| 56 |
with open(six_py_file, 'rb') as f: exec(f.read()) |