mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Bundle a new version of python-six for compatibility along with some code to make it easy for distributions to override the bunndled copy if they have a new enough version.
This commit is contained in:
parent
28c933ce5e
commit
baa309309d
54 changed files with 1017 additions and 84 deletions
|
@ -28,27 +28,11 @@ from ansible.errors import AnsibleError
|
|||
from hashlib import sha256
|
||||
from binascii import hexlify
|
||||
from binascii import unhexlify
|
||||
from six import PY3
|
||||
|
||||
# Note: Only used for loading obsolete VaultAES files. All files are written
|
||||
# using the newer VaultAES256 which does not require md5
|
||||
from hashlib import md5
|
||||
|
||||
|
||||
try:
|
||||
from six import byte2int
|
||||
except ImportError:
|
||||
# bytes2int added in six-1.4.0
|
||||
if PY3:
|
||||
import operator
|
||||
byte2int = operator.itemgetter(0)
|
||||
else:
|
||||
def byte2int(bs):
|
||||
return ord(bs[0])
|
||||
|
||||
from ansible.utils.unicode import to_unicode, to_bytes
|
||||
|
||||
|
||||
try:
|
||||
from Crypto.Hash import SHA256, HMAC
|
||||
HAS_HASH = True
|
||||
|
@ -86,6 +70,9 @@ try:
|
|||
except ImportError:
|
||||
pass
|
||||
|
||||
from ansible.compat.six import PY3, byte2int
|
||||
from ansible.utils.unicode import to_unicode, to_bytes
|
||||
|
||||
HAS_ANY_PBKDF2HMAC = HAS_PBKDF2 or HAS_PBKDF2HMAC
|
||||
|
||||
CRYPTO_UPGRADE = "ansible-vault requires a newer version of pycrypto than the one installed on your platform. You may fix this with OS-specific commands such as: yum install python-devel; rpm -e --nodeps python-crypto; pip install pycrypto"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue