doc: make gendoc.py module import policy aware
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 12 Dec 2015 13:23:29 -0500
changeset 27330 6fbf1159a85a
parent 27329 944af8e2eb4c
child 27331 35e69407b1ac
doc: make gendoc.py module import policy aware Without this, running gendoc.py during an install without C modules available (via `make local`) will result in an import failure because the default module load policy insists on C modules. We also remove the sys.path adjustment because it is no longer needed since our magic importer handles things.
doc/gendoc.py
--- a/doc/gendoc.py	Fri Dec 11 17:45:19 2015 -0600
+++ b/doc/gendoc.py	Sat Dec 12 13:23:29 2015 -0500
@@ -4,10 +4,12 @@
 """
 
 import os, sys, textwrap
+
+# This script is executed during installs and may not have C extensions
+# available. Relax C module requirements.
+os.environ['HGMODULEPOLICY'] = 'allow'
 # import from the live mercurial repo
 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 import minirst
 from mercurial.commands import table, globalopts