issue #477: fix 3.x test regressions.

issue510
David Wilson 6 years ago
parent 01db198122
commit 84a0424749

@ -35,6 +35,7 @@ how to build arguments for it, preseed related data, etc.
""" """
import atexit import atexit
import codecs
import imp import imp
import os import os
import shlex import shlex
@ -47,6 +48,7 @@ import mitogen.core
import ansible_mitogen.target # TODO: circular import import ansible_mitogen.target # TODO: circular import
from mitogen.core import b from mitogen.core import b
from mitogen.core import bytes_partition from mitogen.core import bytes_partition
from mitogen.core import str_partition
from mitogen.core import str_rpartition from mitogen.core import str_rpartition
try: try:
@ -131,7 +133,7 @@ class EnvironmentFileWatcher(object):
def _load(self): def _load(self):
try: try:
fp = open(self.path, 'r') fp = codecs.open(self.path, 'r', encoding='utf-8')
try: try:
return list(self._parse(fp)) return list(self._parse(fp))
finally: finally:
@ -149,10 +151,10 @@ class EnvironmentFileWatcher(object):
if (not bits) or bits[0].startswith('#'): if (not bits) or bits[0].startswith('#'):
continue continue
if bits[0] == 'export': if bits[0] == u'export':
bits.pop(0) bits.pop(0)
key, sep, value = bytes_partition(' '.join(bits), '=') key, sep, value = str_partition(u' '.join(bits), u'=')
if key and sep: if key and sep:
yield key, value yield key, value

@ -61,8 +61,8 @@ except ImportError:
try: try:
reduce reduce
except ImportError: except NameError:
# Python 2.4 # Python 3.x.
from functools import reduce from functools import reduce
try: try:

Loading…
Cancel
Save