Patchwork D8122: pyoxidizer: allow extensions to be loaded from the file system

login
register
mail settings
Submitter phabricator
Date Feb. 15, 2020, 4:30 a.m.
Message ID <differential-rev-PHID-DREV-lmvx5c2buevaxmgpuvxs-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45249/
State Superseded
Headers show

Comments

phabricator - Feb. 15, 2020, 4:30 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It seems that setting this config is all that's needed to be able to
  load extensions from the file system (which we clearly want). Thanks
  for making this work, Gregory Szorc!.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/packaging/pyoxidizer.bzl

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 15, 2020, 6 a.m.
mharbison72 added a comment.


  Does this also allow extensions to be bundled in the exe, or are you thinking we need to leave the extensions outside the binary?

REPOSITORY
  rHG Mercurial

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

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

To: martinvonz, #hg-reviewers
Cc: mharbison72, mercurial-devel
phabricator - Feb. 15, 2020, 6:11 a.m.
martinvonz added a comment.


  In D8122#120939 <https://phab.mercurial-scm.org/D8122#120939>, @mharbison72 wrote:
  
  > Does this also allow extensions to be bundled in the exe, or are you thinking we need to leave the extensions outside the binary?
  
  I'm pretty sure this just tells the PyOxidized binary to *also* allow importing from file system. The bundled extensions are still imported properly from inside the binary.

REPOSITORY
  rHG Mercurial

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

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

To: martinvonz, #hg-reviewers
Cc: mharbison72, mercurial-devel
phabricator - Feb. 15, 2020, 9:54 p.m.
This revision is now accepted and ready to land.
indygreg added a comment.
indygreg accepted this revision.


  This simply tells PyOxidizer to load the `sys.meta_path` importer that performs filesystem-based importing, like a normal Python process. https://pyoxidizer.readthedocs.io/en/stable/config_api.html#pythoninterpreterconfig

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

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

Patch

diff --git a/contrib/packaging/pyoxidizer.bzl b/contrib/packaging/pyoxidizer.bzl
--- a/contrib/packaging/pyoxidizer.bzl
+++ b/contrib/packaging/pyoxidizer.bzl
@@ -21,6 +21,8 @@ 
     config = PythonInterpreterConfig(
         raw_allocator = "system",
         run_eval = code,
+        # We want to let the user load extensions from the file system
+        filesystem_importer = True,
         # We need this to make resourceutil happy, since it looks for sys.frozen.
         sys_frozen = True,
         legacy_windows_stdio = True,