[Request] [+ ] D11302: pyoxidizer: re-install PYTHONPATH behavior

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Wed Aug 18 16:21:25 UTC 2021


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Hooks and extensions can rely on PYTHONPATH value. Yet the pyoxidized binary
  ignore the variable. So we manually reinstall the behavior to fix various tests
  and restore the expected behavior.
  
  This positively affects:
  
  - test-extension.t
  - test-hook.t

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -36,6 +36,12 @@
 
 # Code to run in Python interpreter.
 RUN_CODE = """
+import os
+import sys
+extra_path = os.environ.get('PYTHONPATH')
+if extra_path is not None:
+    # extensions and hooks expect a working python environment
+    sys.path[0:0] = extra_path.split(os.pathsep)
 import hgdemandimport;
 hgdemandimport.enable();
 from mercurial import dispatch;



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20210818/5a710927/attachment.html>


More information about the Mercurial-patches mailing list