unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob d1073dd01c53df942b8d306e1b5f8470a2b52f10 985 bytes (raw)
name: packages/patches/mercurial-hg-extension-path.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
This is needed to make Mercurial read the HGEXTENSIONPATH to detect
third-party extensions.  It is called HGEXTENSIONPATH and not
HG_EXTENSION_PATH to keep it consistent with other environment variables for
Mercurial, e.g. HGENCODINGAMBIGUOUS, HGEDITOR ...  Hopefully I or someone else
will get this into Mercurial proper.

diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -13,6 +13,7 @@
 import imp
 import inspect
 import os
+import sys
 
 from .i18n import (
     _,
@@ -108,6 +109,11 @@
 
 def _importh(name):
     """import and return the <name> module"""
+    # Read HGEXTENSIONSPATH environment variable when import extensions.
+    extension_path = os.getenv("HGEXTENSIONSPATH")
+    if extension_path is not None:
+        for path in extension_path:
+            sys.path.append(path)
     mod = __import__(pycompat.sysstr(name))
     components = name.split(b'.')
     for comp in components[1:]:

debug log:

solving d1073dd01c53df942b8d306e1b5f8470a2b52f10 ...
found d1073dd01c53df942b8d306e1b5f8470a2b52f10 in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).