summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-06-12 05:25:16 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-06-12 05:25:16 (GMT)
commite52140caf1dda7313e59e1a076192aa501492159 (patch)
treeca438da74ac44e094f569e4d857486ac741312fc /Lib/pydoc.py
parentbe2bb472b09320f174b0277917ec2696ca13940c (diff)
downloadcpython-e52140caf1dda7313e59e1a076192aa501492159.zip
cpython-e52140caf1dda7313e59e1a076192aa501492159.tar.gz
cpython-e52140caf1dda7313e59e1a076192aa501492159.tar.bz2
#16484: Change PYTHONDOCS to "https:", and fix links to use lowercase
Implementation by Sean Rodman; test by Kaushik Nadikuditi.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 9316fff..b4b190f 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -28,7 +28,7 @@ to a file named "<name>.html".
Module docs for core modules are assumed to be in
- http://docs.python.org/library/
+ https://docs.python.org/library/
This can be overridden by setting the PYTHONDOCS environment variable
to a different URL or to a local directory containing the Library
@@ -374,7 +374,9 @@ class Doc:
docmodule = docclass = docroutine = docother = docproperty = docdata = fail
- def getdocloc(self, object):
+ def getdocloc(self, object,
+ basedir=os.path.join(sys.exec_prefix, "lib",
+ "python"+sys.version[0:3])):
"""Return the location of module docs or None"""
try:
@@ -383,9 +385,8 @@ class Doc:
file = '(built-in)'
docloc = os.environ.get("PYTHONDOCS",
- "http://docs.python.org/library")
- basedir = os.path.join(sys.exec_prefix, "lib",
- "python"+sys.version[0:3])
+ "https://docs.python.org/library")
+ basedir = os.path.normcase(basedir)
if (isinstance(object, type(os)) and
(object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
'marshal', 'posix', 'signal', 'sys',
@@ -393,10 +394,10 @@ 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://"):
- docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__)
+ if docloc.startswith(("http://", "https://")):
+ docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__.lower())
else:
- docloc = os.path.join(docloc, object.__name__ + ".html")
+ docloc = os.path.join(docloc, object.__name__.lower() + ".html")
else:
docloc = None
return docloc