[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/04: gnu: mercurial: Patch to make it read HGEXTENSIONPATH.
From: |
guix-commits |
Subject: |
02/04: gnu: mercurial: Patch to make it read HGEXTENSIONPATH. |
Date: |
Sun, 16 May 2021 17:29:39 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit ae0882bbd686cb213420bd7b84601e0c97771cf7
Author: Xinglu Chen <public@yoctocell.xyz>
AuthorDate: Sat May 15 11:17:12 2021 +0200
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>
---
gnu/local.mk | 1 +
.../patches/mercurial-hg-extension-path.patch | 29 ++++++++++++++++++++++
gnu/packages/version-control.scm | 6 +++++
3 files changed, 36 insertions(+)
diff --git a/gnu/local.mk b/gnu/local.mk
index 97b4dd7..0d3ab38 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1413,6 +1413,7 @@ dist_patch_DATA =
\
%D%/packages/patches/mcrypt-CVE-2012-4527.patch \
%D%/packages/patches/libmemcached-build-with-gcc7.patch \
%D%/packages/patches/libmhash-hmac-fix-uaf.patch \
+ %D%/packages/patches/mercurial-hg-extension-path.patch \
%D%/packages/patches/mesa-skip-tests.patch \
%D%/packages/patches/mescc-tools-boot.patch \
%D%/packages/patches/meson-for-build-rpath.patch \
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 0000000..d1073dd
--- /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:]:
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 3a6de33..167495c 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -1614,6 +1614,7 @@ execution of any hook written in any language before
every commit.")
(method url-fetch)
(uri (string-append "https://www.mercurial-scm.org/"
"release/mercurial-" version ".tar.gz"))
+ (patches (search-patches "mercurial-hg-extension-path.patch"))
(sha256
(base32
"17rhlmmkqz5ll3k68jfzpcifg3nndbcbc2nx7kw8xn3qcj7nlpgw"))))
@@ -1684,6 +1685,11 @@ execution of any hook written in any language before
every commit.")
("which" ,which)))
(inputs
`(("python" ,python)))
+ ;; Find third-party extensions.
+ (native-search-paths
+ (list (search-path-specification
+ (variable "HGEXTENSIONPATH")
+ (files '("lib/python3.8/site-packages/hgext3rd")))))
(home-page "https://www.mercurial-scm.org/")
(synopsis "Decentralized version control system")
(description