Patchwork [3,of,6,import-refactor,V2] check-seclevel: set module load policy to Python only

login
register
mail settings
Submitter Gregory Szorc
Date Nov. 25, 2015, 7:31 a.m.
Message ID <0dc3217bc6dd586230a9.1448436707@ubuntu-main>
Download mbox | patch
Permalink /patch/11653/
State Superseded
Commit ab776610fc6d4120a22b694dc9636085f30ae50f
Delegated to: Yuya Nishihara
Headers show

Comments

Gregory Szorc - Nov. 25, 2015, 7:31 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1448434435 28800
#      Tue Nov 24 22:53:55 2015 -0800
# Node ID 0dc3217bc6dd586230a900ea0b1b3f24b9c29e71
# Parent  18fcf978ddd46ba5df67210a8586051c77653b5f
check-seclevel: set module load policy to Python only

If we don't change this, the upcoming change to make the module
loading policy only load C modules will cause this script to fail if
run with CPython against an unbuilt source checkout.

Patch

diff --git a/doc/check-seclevel.py b/doc/check-seclevel.py
--- a/doc/check-seclevel.py
+++ b/doc/check-seclevel.py
@@ -1,19 +1,18 @@ 
 #!/usr/bin/env python
 #
 # checkseclevel - checking section title levels in each online help document
 
 import sys, os
 import optparse
 
 # import from the live mercurial repo
+os.environ['HGMODULEPOLICY'] = 'py'
 sys.path.insert(0, "..")
-# fall back to pure modules if required C extensions are not available
-sys.path.append(os.path.join('..', 'mercurial', 'pure'))
 from mercurial import demandimport; demandimport.enable()
 from mercurial.commands import table
 from mercurial.help import helptable
 from mercurial import extensions
 from mercurial import minirst
 from mercurial import ui as uimod
 
 level2mark = ['"', '=', '-', '.', '#']