D7452: debugextensions: gracefully handle missing __file__ attributes

mharbison72 (Matt Harbison) phabricator at mercurial-scm.org
Sun Nov 17 01:42:22 EST 2019


mharbison72 added a comment.


  Interesting failure trying to load an external copy of evolve (e5d92ac69a9c):
  
    $ ./build/apps/hg/x86_64-pc-windows-msvc/debug/hg.exe debugextensions -v
    *** failed to import extension evolve from C:/Users/Matt/hg-evolve/hgext3rd\evolve: cannot import name 'compat' from 'hgext_evolve' (C:/Users/Matt/hg-evolve/hgext3rd\evolve\__init__.py)
    Traceback (most recent call last):
      File "mercurial.extensions", line 294, in loadall
        load(ui, name, path, loadingtime)
      File "mercurial.extensions", line 211, in load
        mod = _importext(name, path, bind(_reportimporterror, ui))
      File "mercurial.extensions", line 119, in _importext
        mod = loadpath(path, b'hgext.%s' % name)
      File "mercurial.extensions", line 95, in loadpath
        return imp.load_module(module_name, fd, fpath, desc)
      File "imp", line 244, in load_module
        return load_package(name, filename)
      File "imp", line 216, in load_package
        return _load(spec)
      File "<frozen importlib._bootstrap>", line 696, in _load
      File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 728, in exec_module
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "C:/Users/Matt/hg-evolve/hgext3rd\evolve\__init__.py", line 289, in <module>
        from . import (
    ImportError: cannot import name 'compat' from 'hgext_evolve' (C:/Users/Matt/hg-evolve/hgext3rd\evolve\__init__.py)
    absorb
      location: c:\Users\Matt\hg3\hg\build\apps\hg\x86_64-pc-windows-msvc\debug\hg.exe
      bundled: yes
  
  It loads fine when using `PipInstallSimple` to bundle it into the executable.  Not sure why the name is `hgext_evolve` and not `hgext3rd_evolve`.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7452/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7452

To: mharbison72, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list