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

REVISION SUMMARY
  This is a port of 53221078e0de 
<https://phab.mercurial-scm.org/rHG53221078e0de65d1a821ce5311dec45a7a978301> to 
Windows to allow pip-installed extensions to
  be loaded without specifying a path.  It's a major headache to have an hg.exe 
on
  `PATH` that needs to have the path to the extensions specified, because WSL
  doesn't see the same path.
  
  This is only for Windows for now, to match the currently shipping py2 
behavior.
  There is a better solution with using the `site` package, but this needs 
support
  in PyOxidizer[1].
  
  [1] https://github.com/indygreg/PyOxidizer/issues/430

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

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
@@ -44,6 +44,17 @@
     # 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))
+# Add user site to sys.path to load extensions without the full path
+if os.name == 'nt':
+    vi = sys.version_info
+    sys.path.append(
+        os.path.join(
+            os.environ['APPDATA'],
+            'Python',
+            'Python%d%d' % (vi[0], vi[1]),
+            'site-packages',
+        )
+    )
 import hgdemandimport;
 hgdemandimport.enable();
 from mercurial import dispatch;



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to