changeset 28966:ea1fab5293ca

py3: make gendoc use absolute_import Fixed direct imports even the tests were not complaining.
author Pulkit Goyal <7895pulkit@gmail.com>
date Sun, 17 Apr 2016 00:20:44 +0530
parents 98153441c8cc
children cd5e7195e441
files doc/gendoc.py tests/test-check-py3-compat.t
diffstat 2 files changed, 21 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/doc/gendoc.py	Sun Apr 17 00:14:42 2016 +0530
+++ b/doc/gendoc.py	Sun Apr 17 00:20:44 2016 +0530
@@ -4,7 +4,11 @@
 where DOC is the name of a document
 """
 
-import os, sys, textwrap
+from __future__ import absolute_import
+
+import os
+import sys
+import textwrap
 
 # This script is executed during installs and may not have C extensions
 # available. Relax C module requirements.
@@ -12,12 +16,22 @@
 # import from the live mercurial repo
 sys.path.insert(0, "..")
 from mercurial import demandimport; demandimport.enable()
-from mercurial import minirst
-from mercurial.commands import table, globalopts
-from mercurial.i18n import gettext, _
-from mercurial.help import helptable, loaddoc
-from mercurial import extensions
-from mercurial import ui as uimod
+from mercurial import (
+    commands,
+    extensions,
+    help,
+    minirst,
+    ui as uimod,
+)
+from mercurial.i18n import (
+    gettext,
+    _,
+)
+
+table = commands.table
+globalopts = commands.globalopts
+helptable = help.helptable
+loaddoc = help.loaddoc
 
 def get_desc(docstr):
     if not docstr:
--- a/tests/test-check-py3-compat.t	Sun Apr 17 00:14:42 2016 +0530
+++ b/tests/test-check-py3-compat.t	Sun Apr 17 00:20:44 2016 +0530
@@ -3,7 +3,6 @@
   $ cd "$TESTDIR"/..
 
   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
-  doc/gendoc.py not using absolute_import
   doc/hgmanpage.py not using absolute_import
   hgext/color.py not using absolute_import
   hgext/eol.py not using absolute_import