changeset 32209:85dc5a25f1fc

debuginstall: check C extensions only if they are loadable per policy This check is useless in pure installation and I want to make it directly import C extension modules.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 26 Apr 2017 23:30:52 +0900
parents d74b0cff94a9
children 56148133ef36
files mercurial/debugcommands.py tests/test-install.t
diffstat 2 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Wed Apr 26 22:26:28 2017 +0900
+++ b/mercurial/debugcommands.py	Wed Apr 26 23:30:52 2017 +0900
@@ -1020,19 +1020,20 @@
     fm.write('hgmodules', _("checking installed modules (%s)...\n"),
              os.path.dirname(pycompat.fsencode(__file__)))
 
-    err = None
-    try:
-        from . import (
-            base85,
-            bdiff,
-            mpatch,
-            osutil,
-        )
-        dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
-    except Exception as inst:
-        err = inst
-        problems += 1
-    fm.condwrite(err, 'extensionserror', " %s\n", err)
+    if policy.policy in ('c', 'allow'):
+        err = None
+        try:
+            from . import (
+                base85,
+                bdiff,
+                mpatch,
+                osutil,
+            )
+            dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes
+        except Exception as inst:
+            err = inst
+            problems += 1
+        fm.condwrite(err, 'extensionserror', " %s\n", err)
 
     compengines = util.compengines._engines.values()
     fm.write('compengines', _('checking registered compression engines (%s)\n'),
--- a/tests/test-install.t	Wed Apr 26 22:26:28 2017 +0900
+++ b/tests/test-install.t	Wed Apr 26 23:30:52 2017 +0900
@@ -34,7 +34,7 @@
     "editornotfound": false,
     "encoding": "ascii",
     "encodingerror": null,
-    "extensionserror": null,
+    "extensionserror": null, (no-pure !)
     "hgmodulepolicy": "*", (glob)
     "hgmodules": "*mercurial", (glob)
     "hgver": "*", (glob)