Patchwork [4,of,6] i18n: use unicode literals to appease Python 3

login
register
mail settings
Submitter Gregory Szorc
Date June 1, 2016, 5:53 a.m.
Message ID <58033b58046aecaf64f5.1464760381@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/15321/
State Accepted
Headers show

Comments

Gregory Szorc - June 1, 2016, 5:53 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1464759144 25200
#      Tue May 31 22:32:24 2016 -0700
# Node ID 58033b58046aecaf64f59b3557f50b2aacfe98b5
# Parent  fae2a2edc2a1e9d507f1c882c58e4d30962815a2
i18n: use unicode literals to appease Python 3

More of the same sacrifices to the Python 3 gods.
Yuya Nishihara - June 4, 2016, 2 p.m.
On Tue, 31 May 2016 22:53:01 -0700, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1464759144 25200
> #      Tue May 31 22:32:24 2016 -0700
> # Node ID 58033b58046aecaf64f59b3557f50b2aacfe98b5
> # Parent  fae2a2edc2a1e9d507f1c882c58e4d30962815a2
> i18n: use unicode literals to appease Python 3

> +    exceptions = os.environ.get(u'HGPLAINEXCEPT', u'').strip().split(u',')
> +    return u'i18n' not in exceptions

It may raise UnicodeDecodeError on Python 2 because environ is bytes.

HGPLAINEXCEPT=<non-ascii> hg

I haven't read the whole series yet, but I'm surprised that we'll need a bunch
of unicode strings to get along with Python 3. Even __doc__ can't be bytes.
Martijn Pieters - June 6, 2016, 3:47 p.m.
On 4 June 2016 at 07:00, Yuya Nishihara <yuya@tcha.org> wrote:
> I haven't read the whole series yet, but I'm surprised that we'll need a bunch
> of unicode strings to get along with Python 3. Even __doc__ can't be bytes.

The __doc__ issue is avoided by ignoring triple-quoted strings in the
tokeniser. So 'string literal' becomes b'string literal', but
'''string literal''' is untouched.
Matt Mackall - June 6, 2016, 9:14 p.m.
On Mon, 2016-06-06 at 08:47 -0700, Martijn Pieters wrote:
> On 4 June 2016 at 07:00, Yuya Nishihara <yuya@tcha.org> wrote:
> > 
> > I haven't read the whole series yet, but I'm surprised that we'll need a
> > bunch
> > of unicode strings to get along with Python 3. Even __doc__ can't be bytes.
> The __doc__ issue is avoided by ignoring triple-quoted strings in the
> tokeniser. So 'string literal' becomes b'string literal', but
> '''string literal''' is untouched.

Not avoided, but deferred. We need to parse those docstrings to generate our
online help.

We also have doctests that test our charset handling that contain tons of \x
escapes.

Lastly, we almost certainly have some single-quoted docstrings.
timeless - June 7, 2016, 3:10 a.m.
Matt Mackall wrote:
> Lastly, we almost certainly have some single-quoted docstrings.

I think we can add a test to check-code or something and resolve this.

Patch

diff --git a/mercurial/i18n.py b/mercurial/i18n.py
--- a/mercurial/i18n.py
+++ b/mercurial/i18n.py
@@ -10,17 +10,17 @@  from __future__ import absolute_import
 import gettext as gettextmod
 import locale
 import os
 import sys
 
 from . import encoding
 
 # modelled after templater.templatepath:
-if getattr(sys, 'frozen', None) is not None:
+if getattr(sys, u'frozen', None) is not None:
     module = sys.executable
 else:
     module = __file__
 
 try:
     unicode
 except NameError:
     unicode = str
@@ -87,17 +87,17 @@  def gettext(message):
             # translated string use non-ASCII characters.
             _msgcache[message] = u.encode(encoding.encoding, "replace")
         except LookupError:
             # An unknown encoding results in a LookupError.
             _msgcache[message] = message
     return _msgcache[message]
 
 def _plain():
-    if 'HGPLAIN' not in os.environ and 'HGPLAINEXCEPT' not in os.environ:
+    if u'HGPLAIN' not in os.environ and u'HGPLAINEXCEPT' not in os.environ:
         return False
-    exceptions = os.environ.get('HGPLAINEXCEPT', '').strip().split(',')
-    return 'i18n' not in exceptions
+    exceptions = os.environ.get(u'HGPLAINEXCEPT', u'').strip().split(u',')
+    return u'i18n' not in exceptions
 
 if _plain():
     _ = lambda message: message
 else:
     _ = gettext
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -30,120 +30,115 @@ 
   tests/md5sum.py not using absolute_import
   tests/readlink.py not using absolute_import
   tests/run-tests.py not using absolute_import
   tests/test-demandimport.py not using absolute_import
 
 #if py3exe
   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py
   doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  hgext/acl.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/automv.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/blackbox.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  hgext/acl.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/automv.py: error importing module: <SyntaxError> invalid syntax (commands.py, line 3382) (line 30)
+  hgext/blackbox.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   hgext/bugzilla.py: error importing module: <ImportError> No module named 'urlparse' (line 284)
-  hgext/censor.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  hgext/censor.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   hgext/chgserver.py: error importing module: <ImportError> No module named 'SocketServer' (line 43)
-  hgext/children.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/churn.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/clonebundles.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  hgext/children.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/churn.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/clonebundles.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  hgext/convert/bzr.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  hgext/convert/bzr.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line 19)
   hgext/convert/common.py: error importing module: <ImportError> No module named 'cPickle' (line 10)
-  hgext/convert/convcmd.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/convert/cvs.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  hgext/convert/convcmd.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/convert/cvs.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   hgext/convert/cvsps.py: error importing module: <ImportError> No module named 'cPickle' (line 9)
-  hgext/convert/darcs.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/convert/filemap.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/convert/git.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/convert/gnuarch.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/convert/hg.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/convert/monotone.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/convert/p4.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  hgext/convert/darcs.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line 15)
+  hgext/convert/git.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/convert/gnuarch.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/convert/hg.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/convert/monotone.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/convert/p4.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   hgext/convert/subversion.py: error importing module: <ImportError> No module named 'cPickle' (line 6)
   hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line 21)
-  hgext/eol.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/extdiff.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/factotum.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/fetch.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/fsmonitor/state.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/gpg.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/graphlog.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/hgk.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/highlight/highlight.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/histedit.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/keyword.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/largefiles/basestore.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/largefiles/lfcommands.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/largefiles/lfutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/largefiles/localstore.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/largefiles/overrides.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  hgext/eol.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/extdiff.py: error importing module: <SyntaxError> invalid syntax (archival.py, line 234) (line 75)
+  hgext/factotum.py: error importing: <ImportError> No module named 'rfc822' (error at __init__.py:47)
+  hgext/fetch.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/fsmonitor/state.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/gpg.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/graphlog.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/hgk.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/highlight/highlight.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/histedit.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line 992) (line 180)
+  hgext/keyword.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/largefiles/basestore.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/largefiles/lfcommands.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/largefiles/lfutil.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/largefiles/localstore.py: error importing module: <ImportError> No module named 'lfutil' (line 13)
+  hgext/largefiles/overrides.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   hgext/largefiles/proto.py: error importing: <ImportError> No module named 'httplib' (error at httppeer.py:*) (glob)
-  hgext/largefiles/remotestore.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/largefiles/reposetup.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  hgext/largefiles/remotestore.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/largefiles/reposetup.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   hgext/largefiles/uisetup.py: error importing module: <SyntaxError> invalid syntax (archival.py, line *) (line *) (glob)
   hgext/largefiles/wirestore.py: error importing module: <ImportError> No module named 'lfutil' (line 8)
-  hgext/mq.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/notify.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/pager.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/patchbomb.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/purge.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/rebase.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/record.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/relink.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/schemes.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/share.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/shelve.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/strip.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/transplant.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/win32mbcs.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  hgext/win32text.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  hgext/mq.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/notify.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/pager.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/patchbomb.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/purge.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/rebase.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/record.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/relink.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/schemes.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/share.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/shelve.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line 992) (line 30)
+  hgext/strip.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  hgext/transplant.py: error importing: <SyntaxError> invalid syntax (bundle2.py, line 992) (error at bundlerepo.py:23)
+  hgext/win32text.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  mercurial/bookmarks.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/branchmap.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  mercurial/bookmarks.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/branchmap.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   mercurial/bundle*.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
-  mercurial/bundlerepo.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/byterange.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/changegroup.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/changelog.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/cmdutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
+  mercurial/bundlerepo.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line 992) (line 23)
+  mercurial/byterange.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/changegroup.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/changelog.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:40)
+  mercurial/cmdutil.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
   mercurial/commandserver.py: error importing module: <ImportError> No module named 'SocketServer' (line 10)
-  mercurial/config.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/context.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/copies.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/crecord.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/dagparser.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/dagutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/destutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/dirstate.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/discovery.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/dispatch.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:18)
-  mercurial/exchange.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
-  mercurial/extensions.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
-  mercurial/fancyopts.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
-  mercurial/filelog.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
-  mercurial/filemerge.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
-  mercurial/fileset.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
+  mercurial/config.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/context.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/copies.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/crecord.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/destutil.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/dirstate.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/discovery.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/dispatch.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/exchange.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/extensions.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/filelog.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:40)
+  mercurial/filemerge.py: error importing: <ImportError> No module named 'cPickle' (error at formatter.py:10)
+  mercurial/fileset.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   mercurial/formatter.py: error importing module: <ImportError> No module named 'cPickle' (line 10)
-  mercurial/graphmod.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
-  mercurial/hbisect.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
-  mercurial/help.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
-  mercurial/hg.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
+  mercurial/graphmod.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/help.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/hg.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
   mercurial/hgweb/common.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line 11)
   mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 14)
   mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 15)
   mercurial/hgweb/protocol.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 13)
   mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 15)
   mercurial/hgweb/server.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line 11)
   mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 16)
   mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 16)
   mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line 16)
-  mercurial/hook.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
-  mercurial/httpconnection.py: error importing: <TypeError> getattr(): attribute name must be string (error at i18n.py:*) (glob)
+  mercurial/hook.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:81)
+  mercurial/httpconnection.py: error importing: <ImportError> No module named 'rfc822' (error at __init__.py:47)
   mercurial/httppeer.py: error importing module: <ImportError> No module named 'httplib' (line 12)
   mercurial/keepalive.py: error importing module: <ImportError> No module named 'httplib' (line 113)
   mercurial/localrepo.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
   mercurial/lock.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
   mercurial/mail.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
   mercurial/manifest.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
   mercurial/match.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
   mercurial/mdiff.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)