Patchwork D8162: hghave: add a `rust` keyword to detect the use of compiled rust code

login
register
mail settings
Submitter phabricator
Date March 9, 2020, 10:03 a.m.
Message ID <23a6deb6260e6484aa9f72e923a5cf44@localhost.localdomain>
Download mbox | patch
Permalink /patch/45632/
State Not Applicable
Headers show

Comments

phabricator - March 9, 2020, 10:03 a.m.
Closed by commit rHGd4689494c436: hghave: add a `rust` keyword to detect the use of compiled rust code (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8162?vs=20577&id=20624

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8162/new/

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

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS




To: Alphare, #hg-reviewers, pulkit
Cc: marmoute, mercurial-devel

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -332,6 +332,17 @@ 
     return gethgversion() >= (int(major), int(minor))
 
 
+@check("rust", "Using the Rust extensions")
+def has_rust():
+    """Check is the mercurial currently running is using some rust code"""
+    cmd = b'hg debuginstall --quiet 2>&1'
+    match = br'checking module policy \(([^)]+)\)'
+    policy = matchoutput(cmd, match)
+    if not policy:
+        return False
+    return b'rust' in policy.group(1)
+
+
 @check("hg08", "Mercurial >= 0.8")
 def has_hg08():
     if checks["hg09"][0]():