1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
From: Stefano Rivera <stefanor@debian.org>
Date: Sat, 16 Jan 2021 12:06:39 -0700
Subject: We removed the bundled simplejson
The simplejson compatibility module isn't importable in 3.x, breaking
our byte-compilation toolchain. As it's only needed for Python 2.4
targets, we simply choose to drop it. If necessary, simplejson can be
manually installed on targets.
Forwarded: not-needed
---
ansible_mitogen/process.py | 37 -------------------------------------
ansible_mitogen/target.py | 5 -----
2 files changed, 42 deletions(-)
diff --git a/ansible_mitogen/process.py b/ansible_mitogen/process.py
index 9276614..63caa88 100644
--- a/ansible_mitogen/process.py
+++ b/ansible_mitogen/process.py
@@ -180,42 +180,6 @@ def setup_pool(pool):
LOG.debug('Service pool configured: size=%d', pool.size)
-def _setup_simplejson(responder):
- """
- We support serving simplejson for Python 2.4 targets on Ansible 2.3, at
- least so the package's own CI Docker scripts can run without external
- help, however newer versions of simplejson no longer support Python
- 2.4. Therefore override any installed/loaded version with a
- 2.4-compatible version we ship in the compat/ directory.
- """
- responder.whitelist_prefix('simplejson')
-
- # issue #536: must be at end of sys.path, in case existing newer
- # version is already loaded.
- compat_path = os.path.join(os.path.dirname(__file__), 'compat')
- sys.path.append(compat_path)
-
- for fullname, is_pkg, suffix in (
- (u'simplejson', True, '__init__.py'),
- (u'simplejson.decoder', False, 'decoder.py'),
- (u'simplejson.encoder', False, 'encoder.py'),
- (u'simplejson.scanner', False, 'scanner.py'),
- ):
- path = os.path.join(compat_path, 'simplejson', suffix)
- fp = open(path, 'rb')
- try:
- source = fp.read()
- finally:
- fp.close()
-
- responder.add_source_override(
- fullname=fullname,
- path=path,
- source=source,
- is_pkg=is_pkg,
- )
-
-
def _setup_responder(responder):
"""
Configure :class:`mitogen.master.ModuleResponder` to only permit
@@ -223,7 +187,6 @@ def _setup_responder(responder):
"""
responder.whitelist_prefix('ansible')
responder.whitelist_prefix('ansible_mitogen')
- _setup_simplejson(responder)
# Ansible 2.3 is compatible with Python 2.4 targets, however
# ansible/__init__.py is not. Instead, executor/module_common.py writes
diff --git a/ansible_mitogen/target.py b/ansible_mitogen/target.py
index 2c65c51..68a78fe 100644
--- a/ansible_mitogen/target.py
+++ b/ansible_mitogen/target.py
@@ -371,11 +371,6 @@ def init_child(econtext, log_level, candidate_temp_dirs):
LOG.setLevel(log_level)
logging.getLogger('ansible_mitogen').setLevel(log_level)
- # issue #536: if the json module is available, remove simplejson from the
- # importer whitelist to avoid confusing certain Ansible modules.
- if json.__name__ == 'json':
- econtext.importer.whitelist.remove('simplejson')
-
global _fork_parent
if FORK_SUPPORTED:
mitogen.parent.upgrade_router(econtext)
|