mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 10:51:24 -07:00
Remove use of simplejson throughout code base (#43548)
* Remove use of simplejson throughout code base. Fixes #42761 * Address failing tests * Remove simplejson from contrib and other outlying files * Add changelog fragment for simplejson removal
This commit is contained in:
parent
96346938ee
commit
c1c229c6d4
55 changed files with 73 additions and 285 deletions
|
@ -109,26 +109,14 @@ NoneType = type(None)
|
|||
try:
|
||||
import json
|
||||
# Detect the python-json library which is incompatible
|
||||
# Look for simplejson if that's the case
|
||||
try:
|
||||
if not isinstance(json.loads, types.FunctionType) or not isinstance(json.dumps, types.FunctionType):
|
||||
raise ImportError
|
||||
except AttributeError:
|
||||
raise ImportError
|
||||
except ImportError:
|
||||
try:
|
||||
import simplejson as json
|
||||
except ImportError:
|
||||
print('\n{"msg": "Error: ansible requires the stdlib json or simplejson module, neither was found!", "failed": true}')
|
||||
sys.exit(1)
|
||||
except SyntaxError:
|
||||
print('\n{"msg": "SyntaxError: probably due to installed simplejson being for a different python version", "failed": true}')
|
||||
sys.exit(1)
|
||||
else:
|
||||
sj_version = json.__version__.split('.')
|
||||
if sj_version < ['1', '6']:
|
||||
# Version 1.5 released 2007-01-18 does not have the encoding parameter which we need
|
||||
print('\n{"msg": "Error: Ansible requires the stdlib json or simplejson >= 1.6. Neither was found!", "failed": true}')
|
||||
print('\n{"msg": "Error: ansible requires the stdlib json and was not found!", "failed": true}')
|
||||
sys.exit(1)
|
||||
|
||||
AVAILABLE_HASH_ALGORITHMS = dict()
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue