D7452: debugextensions: gracefully handle missing __file__ attributes

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


mharbison72 added a comment.


  In D7452#109475 <https://phab.mercurial-scm.org/D7452#109475>, @indygreg wrote:
  
  > The failure might be due to PyOxidizer not supporting namespace packages. I'm pretty sure that isn't implemented and nobody has asked for it yet. Workaround would be to bundle the Mercurial modules in the binary.
  
  OK, I filed a feature request.
  
  I think the modules //are// bundled into the binary for what I'm hacking on:
  
    #BUILD_PATH = CWD + "/../../build/pyoxidizer"
    
    Config(
        application_name="hg_pyO2_041",
        python_distribution=default_python_distribution(),
        embedded_python_config=EmbeddedPythonConfig(
            legacy_windows_fs_encoding=True,
            legacy_windows_stdio=True,
         sys_frozen=True,
    #        sys_paths=["$ORIGIN/lib"],
    #        sys_paths=["$ORIGIN"],
    #        sys_paths=["C:/Users/Matt/hg"],
         unbuffered_stdio=True,
        ),
        python_run_mode=python_run_mode_eval("import hgdemandimport; hgdemandimport.enable(); import mercurial.dispatch; mercurial.dispatch.run()"),
        packaging_rules=[
            # Mercurial requires a fully featured Python because extensions may use
            # anything.
            StdlibExtensionsPolicy("all"),
            Stdlib(include_source=True),
            SetupPyInstall(
                package_path="C:/Users/Matt/hg",
                extra_global_arguments=["clean", "--all", "build"],
                # Our code doesn't yet work with the in-memory importer. So package
                # relative to the executable for now.
                #install_location="app-relative:lib",
            ),
            PipInstallSimple("hg-evolve"
            ),
        ]
    )
    
    
    # END OF COMMON USER-ADJUSTED SETTINGS.
    #
    # Everything below this is typically managed by PyOxidizer and doesn't need
    # to be updated by people.
    
    PYOXIDIZER_VERSION = "0.5.0"
    PYOXIDIZER_COMMIT = "c7d9c79690d3f6ad8187e2d409c9e5e14b14d916"
  
  I'm hacking on getting the disabled extensions to list in `hg help extensions`.  With this config, `hgext.__path__` is None.  If I uncomment the `sys_paths=C:/Users...` line, it prints the path as C:/Users/..., so I assume that counts as unbundled modules.
  
  It's not getting in my way or anything, so not a high priority.

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, indygreg
Cc: indygreg, mercurial-devel


More information about the Mercurial-devel mailing list