summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorXinglu Chen <public@yoctocell.xyz>2021-05-15 11:17:12 +0200
committerLudovic Courtès <ludo@gnu.org>2021-05-16 23:28:11 +0200
commitae0882bbd686cb213420bd7b84601e0c97771cf7 (patch)
treebdf04c09bfd6f3e6873cc34b74cbf5d93b1575d9 /gnu/packages/patches
parent541f93ada0a1e32c615f70b55ec41cdfba44668f (diff)
downloadguix-patches-ae0882bbd686cb213420bd7b84601e0c97771cf7.tar
guix-patches-ae0882bbd686cb213420bd7b84601e0c97771cf7.tar.gz
gnu: mercurial: Patch to make it read HGEXTENSIONPATH.
This will make Mercurial be able to find third-party extensions installed with Guix, without having to set PYTHONPATH. * gnu/packages/patches/mercurial-hg-extension-path.patch: New file. * gnu/local.mk (dist_patch_DATA): Register the patch. * gnu/packages/version-control.scm (mercurial)[origin](patches): Apply the patch. [native-search-paths]: Add HGEXTENSIONPATH. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/mercurial-hg-extension-path.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/gnu/packages/patches/mercurial-hg-extension-path.patch b/gnu/packages/patches/mercurial-hg-extension-path.patch
new file mode 100644
index 0000000000..d1073dd01c
--- /dev/null
+++ b/gnu/packages/patches/mercurial-hg-extension-path.patch
@@ -0,0 +1,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:]: