Patchwork doc: make gendoc.py module import policy aware

login
register
mail settings
Submitter Gregory Szorc
Date Dec. 12, 2015, 6:24 p.m.
Message ID <9902117fcf113ad4aa4d.1449944669@gps-mbp.local>
Download mbox | patch
Permalink /patch/11982/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Gregory Szorc - Dec. 12, 2015, 6:24 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1449944609 18000
#      Sat Dec 12 13:23:29 2015 -0500
# Node ID 9902117fcf113ad4aa4d9041c949bf27dde3ac70
# Parent  944af8e2eb4cddf96ba5b8a96854528b40979715
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.
Yuya Nishihara - Dec. 13, 2015, 5:57 a.m.
On Sat, 12 Dec 2015 13:24:29 -0500, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc@gmail.com>
> # Date 1449944609 18000
> #      Sat Dec 12 13:23:29 2015 -0500
> # Node ID 9902117fcf113ad4aa4d9041c949bf27dde3ac70
> # Parent  944af8e2eb4cddf96ba5b8a96854528b40979715
> doc: make gendoc.py module import policy aware

Queued, thanks. I'll push it to the clowncopter if the host come back.

Patch

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -3,12 +3,14 @@ 
 where DOC is the name of a document
 """
 
 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
 from mercurial.i18n import gettext, _