Bug 1547730 - Don't try to py3-ize indented_repr yet. r=#build
☠☠ backed out by ee4b88439111 ☠ ☠
authorJustin Wood <Callek@gmail.com>
Mon, 15 Apr 2019 11:34:35 -0400
changeset 474144 16b1c53aba9d757d50fcd88b91f937266296dd26
parent 474143 b7b1062d0aad633e369d12613e8919b5e44d4c28
child 474145 1891cfbb55d1570132882c3adda6ad8d80e08cc4
push id36023
push userncsoregi@mozilla.com
push dateThu, 16 May 2019 21:56:43 +0000
treeherdermozilla-central@786f094a30ae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1547730
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1547730 - Don't try to py3-ize indented_repr yet. r=#build Differential Revision: https://phabricator.services.mozilla.com/D28103
python/mozbuild/mozbuild/util.py
--- a/python/mozbuild/mozbuild/util.py
+++ b/python/mozbuild/mozbuild/util.py
@@ -1222,35 +1222,38 @@ class EnumString(six.text_type):
 def _escape_char(c):
     # str.encode('unicode_espace') doesn't escape quotes, presumably because
     # quoting could be done with either ' or ".
     if c == "'":
         return "\\'"
     return six.text_type(c.encode('unicode_escape'))
 
 
-# Mapping table between raw characters below \x80 and their escaped
-# counterpart, when they differ
-_INDENTED_REPR_TABLE = {
-    c: e
-    for c, e in map(lambda x: (x, _escape_char(x)),
-                    map(unichr, range(128)))
-    if c != e
-}
-# Regexp matching all characters to escape.
-_INDENTED_REPR_RE = re.compile(
-    '([' + ''.join(_INDENTED_REPR_TABLE.values()) + ']+)')
+if six.PY2:  # Not supported for py3 yet
+    # Mapping table between raw characters below \x80 and their escaped
+    # counterpart, when they differ
+    _INDENTED_REPR_TABLE = {
+        c: e
+        for c, e in map(lambda x: (x, _escape_char(x)),
+                        map(unichr, range(128)))
+        if c != e
+    }
+    # Regexp matching all characters to escape.
+    _INDENTED_REPR_RE = re.compile(
+        '([' + ''.join(_INDENTED_REPR_TABLE.values()) + ']+)')
 
 
 def indented_repr(o, indent=4):
     '''Similar to repr(), but returns an indented representation of the object
 
     One notable difference with repr is that the returned representation
     assumes `from __future__ import unicode_literals`.
     '''
+    if six.PY3:
+        raise NotImplementedError("indented_repr is not yet supported on py3")
     one_indent = ' ' * indent
 
     def recurse_indented_repr(o, level):
         if isinstance(o, dict):
             yield '{\n'
             for k, v in sorted(o.items()):
                 yield one_indent * (level + 1)
                 for d in recurse_indented_repr(k, level + 1):