]> granicus.if.org Git - python/commitdiff
Issue #16484: Fix pydoc link and test on Windows, by Kaushik Nadikuditi
authorMartin Panter <vadmium+py@gmail.com>
Sun, 12 Jun 2016 04:24:06 +0000 (04:24 +0000)
committerMartin Panter <vadmium+py@gmail.com>
Sun, 12 Jun 2016 04:24:06 +0000 (04:24 +0000)
Lib/pydoc.py
Lib/test/test_pydoc.py
Misc/NEWS

index 3ca08c9b589e4b497cab6ed658967e4b6914985d..0d0d0abec1ba7efb4b20730a3a7a172edd8c0a37 100755 (executable)
@@ -28,7 +28,7 @@ to a file named "<name>.html".
 
 Module docs for core modules are assumed to be in
 
-    http://docs.python.org/X.Y/library/
+    https://docs.python.org/X.Y/library/
 
 This can be overridden by setting the PYTHONDOCS environment variable
 to a different URL or to a local directory containing the Library
@@ -395,6 +395,7 @@ class Doc:
 
         docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS)
 
+        basedir = os.path.normcase(basedir)
         if (isinstance(object, type(os)) and
             (object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
                                  'marshal', 'posix', 'signal', 'sys',
@@ -402,7 +403,7 @@ class Doc:
              (file.startswith(basedir) and
               not file.startswith(os.path.join(basedir, 'site-packages')))) and
             object.__name__ not in ('xml.etree', 'test.pydoc_mod')):
-            if docloc.startswith("http://"):
+            if docloc.startswith(("http://", "https://")):
                 docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower())
             else:
                 docloc = os.path.join(docloc, object.__name__.lower() + ".html")
index 59aa7151ee1cf26d8564ca76060667967bfa3f25..aee979b8e8b05d0c0afdd0b5a6cee208efde2434 100644 (file)
@@ -356,7 +356,7 @@ def get_pydoc_html(module):
 def get_pydoc_link(module):
     "Returns a documentation web link of a module"
     dirname = os.path.dirname
-    basedir = os.path.join(dirname(dirname(__file__)))
+    basedir = dirname(dirname(__file__))
     doc = pydoc.TextDoc()
     loc = doc.getdocloc(module, basedir=basedir)
     return loc
index bde2dbc170f4759751b10730d0f9678518ace77b..8a39c0880e7dfa0de921602bc602433b1ef36418 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -591,6 +591,10 @@ IDLE
 Documentation
 -------------
 
+- Issue #16484: Change the default PYTHONDOCS URL to "https:", and fix the
+  resulting links to use lowercase.  Patch by Sean Rodman, test by Kaushik
+  Nadikuditi.
+
 - Issue #24136: Document the new PEP 448 unpacking syntax of 3.5.
 
 - Issue #26736: Used HTTPS for external links in the documentation if possible.