# HG changeset patch # User Augie Fackler # Date 2016-10-08 12:36:39 # Node ID 9b230a8e60087ac95074fabce575b5e8c0dcfd0a # Parent f3a1089654e390c4f0a67fdb46aae457ed9b2cfb util: ensure forwarded attrs are set in globals() as sysstr Custom module importer strikes again. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -60,7 +60,8 @@ for attr in ( 'socketserver', 'xmlrpclib', ): - globals()[attr] = getattr(pycompat, attr) + a = pycompat.sysstr(attr) + globals()[a] = getattr(pycompat, a) # This line is to make pyflakes happy: urlreq = pycompat.urlreq 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 @@ -16,121 +16,43 @@ $ hg files 'set:(**.py) - grep(pygments)' | sed 's|\\|/|g' \ > | xargs $PYTHON3 contrib/check-py3-compat.py \ > | sed 's/[0-9][0-9]*)$/*)/' - hgext/automv.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/blackbox.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/bugzilla.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/censor.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/chgserver.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/children.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/churn.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/clonebundles.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/color.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) hgext/convert/bzr.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/common.py: error importing module: module 'mercurial.util' has no attribute 'pickle' (line *) - hgext/convert/convcmd.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) + hgext/convert/convcmd.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) hgext/convert/cvs.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/cvsps.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) hgext/convert/darcs.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) hgext/convert/filemap.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) hgext/convert/git.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) hgext/convert/gnuarch.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/hg.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) + hgext/convert/hg.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) hgext/convert/monotone.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) hgext/convert/p4.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) hgext/convert/subversion.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) hgext/convert/transport.py: error importing module: No module named 'svn.client' (line *) - hgext/eol.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/extdiff.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/factotum.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - hgext/fetch.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) hgext/fsmonitor/watchmanclient.py: error importing module: Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (line *) - hgext/gpg.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/graphlog.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/hgk.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/histedit.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - hgext/journal.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/keyword.py: error importing: module 'mercurial.util' has no attribute 'httpserver' (error at common.py:*) + hgext/journal.py: error importing module: Parent module 'hgext' not loaded, cannot perform relative import (line *) hgext/largefiles/basestore.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/lfcommands.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/largefiles/lfutil.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) + hgext/largefiles/lfcommands.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) hgext/largefiles/localstore.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/overrides.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/largefiles/proto.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - hgext/largefiles/remotestore.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - hgext/largefiles/reposetup.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - hgext/largefiles/storefactory.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - hgext/largefiles/uisetup.py: error importing: module 'mercurial.util' has no attribute 'httpserver' (error at common.py:*) + hgext/largefiles/overrides.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) + hgext/largefiles/proto.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) + hgext/largefiles/remotestore.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) + hgext/largefiles/reposetup.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) + hgext/largefiles/storefactory.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) + hgext/largefiles/uisetup.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) hgext/largefiles/wirestore.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/mq.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/notify.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/pager.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/patchbomb.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/purge.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/rebase.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/record.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/relink.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/schemes.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/share.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/shelve.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - hgext/strip.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - hgext/transplant.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - mercurial/archival.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/bundle2.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - mercurial/bundlerepo.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - mercurial/byterange.py: error importing module: module 'mercurial.util' has no attribute 'urlerr' (line *) - mercurial/changelog.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/cmdutil.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/commands.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/context.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/crecord.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/dispatch.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) + hgext/mq.py: error importing: startswith first arg must be str or a tuple of str, not bytes (error at extensions.py:*) + hgext/rebase.py: error importing: Can't convert 'bytes' object to str implicitly (error at registrar.py:*) + hgext/record.py: error importing module: '^commit|ci' (line *) + hgext/shelve.py: error importing module: Parent module 'hgext' not loaded, cannot perform relative import (line *) + hgext/transplant.py: error importing: Can't convert 'bytes' object to str implicitly (error at registrar.py:*) mercurial/encoding.py: error importing module: bytes expected, not str (line *) - mercurial/exchange.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - mercurial/extensions.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/filelog.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/filemerge.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/fileset.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/formatter.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/help.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/hg.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - mercurial/hgweb/common.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) - mercurial/hgweb/hgweb_mod.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) - mercurial/hgweb/hgwebdir_mod.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) - mercurial/hgweb/protocol.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) - mercurial/hgweb/request.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) - mercurial/hgweb/server.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) - mercurial/hgweb/webcommands.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) - mercurial/hgweb/webutil.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) - mercurial/hgweb/wsgicgi.py: error importing module: Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) - mercurial/hook.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/httpconnection.py: error importing module: module 'mercurial.util' has no attribute 'urlerr' (line *) - mercurial/httppeer.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) + mercurial/fileset.py: error importing: Can't convert 'bytes' object to str implicitly (error at registrar.py:*) mercurial/i18n.py: error importing module: bytes expected, not str (line *) - mercurial/keepalive.py: error importing module: module 'mercurial.util' has no attribute 'httplib' (line *) - mercurial/localrepo.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - mercurial/manifest.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/merge.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/namespaces.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/patch.py: error importing module: module 'mercurial.util' has no attribute 'stringio' (line *) - mercurial/pvec.py: error importing module: name 'xrange' is not defined (line *) - mercurial/repair.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - mercurial/revlog.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) mercurial/revset.py: error importing module: 'dict' object has no attribute 'iteritems' (line *) mercurial/scmwindows.py: error importing module: No module named 'winreg' (line *) - mercurial/sshpeer.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) - mercurial/sshserver.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/statichttprepo.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at byterange.py:*) - mercurial/store.py: error importing module: name 'xrange' is not defined (line *) - mercurial/subrepo.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/templatefilters.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/templatekw.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/templater.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/ui.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/unionrepo.py: error importing: module 'mercurial.util' has no attribute 'stringio' (error at patch.py:*) - mercurial/url.py: error importing: module 'mercurial.util' has no attribute 'urlerr' (error at httpconnection.py:*) + mercurial/store.py: error importing module: Can't convert 'bytes' object to str implicitly (line *) mercurial/win32.py: error importing module: No module named 'msvcrt' (line *) mercurial/windows.py: error importing module: No module named 'msvcrt' (line *) - mercurial/wireproto.py: error importing: %b requires bytes, or an object that implements __bytes__, not 'str' (error at bundle2.py:*) #endif