Commit Graph

10 Commits (master)

Author SHA1 Message Date
David Wilson 30ae3d85cb compat: fix Py2.4 SyntaxError 5 years ago
Marc Hartmayer 0a6c0cd8fb pkgutil: fix Python3 compatibility
Starting with Python3 the `as` clause must be used to associate a name to the
exception being passed.
5 years ago
David Wilson 0e193c223c issue #508: master: minify all Mitogen/ansible_mitogen sources.
Minify-safe files are marked with a magical "# !mitogen: minify_safe"
comment anywhere in the file, which activates the minifier. The result
is naturally cached by ModuleResponder, therefore lru_cache is gone too.

Given:

    import os, mitogen
    @mitogen.main()
    def main(router):
        c = router.ssh(hostname='k3')
        c.call(os.getpid)
        router.sudo(via=c)

SSH footprint drops from 56.2 KiB to 42.75 KiB (-23.9%)
Ansible "shell: hostname" drops 149.26 KiB to 117.42 KiB (-21.3%)
5 years ago
David Wilson 3aff3e5506 issue #408: fix mitogen.compat.tokenize 2.4 compatibility. 5 years ago
David Wilson 9e3e02fb65 tokenize must parse under 3.x even if it won't run there
To support 3.x parent 2.x child
6 years ago
David Wilson 410016ff47 Initial Python 3.x port work.
* ansible: use unicode_literals everywhere since it only needs to be
  compatible back to 2.6.
* compat/collections.py: delete this entirely and rip out the parts of
  functools that require it.
* Introduce serializable Kwargs dict subclass that translates keys to
  Unicode on instantiation.
* enable_debug_logging() must set _v/_vv globals.
* cStringIO does not exist in 3.x.
* Treat IOLogger and LogForwarder input as latin-1.
* Avoid ResourceWarnings in first stage by explicitly closing fps.
* Fix preamble_size.py syntax errors.
6 years ago
David Wilson 813d139d48 Import v2.7.11 tokenize.py for use on older Pythons; closes #189.
It's worth note that 2.7.10 shipped with Sierra, managed to not notice
this due to using a Homebrew 2.7.14.
6 years ago
Alex Willmer 0b46b90c62 Issue #160: Apply 2.x workarounds to lru_cache backport
all() was introduced in Python 2.5
with: blocks arrived in Python 2.6
nonlocal and default utf-8 source encoding were added in Python 3.x
6 years ago
Alex Willmer fc0fb732a3 Issue #160: Vendorize namedtuple and lru_cache
namedtuple from
https://hg.python.org/cpython/file/3f79ecab5e52/Lib/collections.py
(Python 2.6)

lru_cache from
937ac1fe06/Lib/functools.py
Python 3.5
6 years ago
David Wilson e7ff6259a3 Initial commit. 6 years ago