# HG changeset patch # User Pierre-Yves David # Date 2021-08-18 19:37:55 # Node ID b962a913ee3b949ff0e0061e5e3acb085e31c66c # Parent f07a0054339643679f24d47d256271b97dfa2896 pyoxidizer: re-install PYTHONPATH behavior 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 Differential Revision: https://phab.mercurial-scm.org/D11302 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,14 @@ IS_WINDOWS = "windows" in BUILD_TARGET_T # 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 + # We do not prepend the values because the Mercurial library wants to be in + # the front of the sys.path to avoid picking up other installations. + sys.path.extend(extra_path.split(os.pathsep)) import hgdemandimport; hgdemandimport.enable(); from mercurial import dispatch;