mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
Merge: #16484: Fix pydoc doc links to modules whose names are mixed case.
This commit is contained in:
commit
13ee7d15e3
3 changed files with 21 additions and 6 deletions
12
Lib/pydoc.py
12
Lib/pydoc.py
|
@ -366,7 +366,7 @@ def safeimport(path, forceload=0, cache={}):
|
|||
class Doc:
|
||||
|
||||
PYTHONDOCS = os.environ.get("PYTHONDOCS",
|
||||
"http://docs.python.org/%d.%d/library"
|
||||
"https://docs.python.org/%d.%d/library"
|
||||
% sys.version_info[:2])
|
||||
|
||||
def document(self, object, name=None, *args):
|
||||
|
@ -395,7 +395,9 @@ class Doc:
|
|||
|
||||
docmodule = docclass = docroutine = docother = docproperty = docdata = fail
|
||||
|
||||
def getdocloc(self, object):
|
||||
def getdocloc(self, object,
|
||||
basedir=os.path.join(sys.base_exec_prefix, "lib",
|
||||
"python%d.%d" % sys.version_info[:2])):
|
||||
"""Return the location of module docs or None"""
|
||||
|
||||
try:
|
||||
|
@ -405,8 +407,6 @@ class Doc:
|
|||
|
||||
docloc = os.environ.get("PYTHONDOCS", self.PYTHONDOCS)
|
||||
|
||||
basedir = os.path.join(sys.base_exec_prefix, "lib",
|
||||
"python%d.%d" % sys.version_info[:2])
|
||||
if (isinstance(object, type(os)) and
|
||||
(object.__name__ in ('errno', 'exceptions', 'gc', 'imp',
|
||||
'marshal', 'posix', 'signal', 'sys',
|
||||
|
@ -415,9 +415,9 @@ class Doc:
|
|||
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__)
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue