[PATCH 2 of 7] doc: make gendoc use absolute_import

Pulkit Goyal 7895pulkit at gmail.com
Sat Apr 16 17:33:08 EDT 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1460832644 -19800
#      Sun Apr 17 00:20:44 2016 +0530
# Node ID e536aea26a4b9ff532c8271504f6233175451a22
# Parent  6b4778fa8c39b2d70ffb920e4ccf747f6c27e47d
doc: make gendoc use absolute_import

Fixed direct imports even the tests were not complaining.

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -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:
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -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


More information about the Mercurial-devel mailing list