Bug #1628895: some better tries to find HTML documentation in pydoc.
This commit is contained in:
parent
7659a87e49
commit
117a05ed50
19
Lib/pydoc.py
19
Lib/pydoc.py
|
@ -1627,16 +1627,21 @@ class Helper:
|
||||||
self.docdir = None
|
self.docdir = None
|
||||||
execdir = os.path.dirname(sys.executable)
|
execdir = os.path.dirname(sys.executable)
|
||||||
homedir = os.environ.get('PYTHONHOME')
|
homedir = os.environ.get('PYTHONHOME')
|
||||||
|
join = os.path.join
|
||||||
for dir in [os.environ.get('PYTHONDOCS'),
|
for dir in [os.environ.get('PYTHONDOCS'),
|
||||||
homedir and os.path.join(homedir, 'doc'),
|
homedir and os.path.join(homedir, 'doc'),
|
||||||
os.path.join(execdir, 'doc'),
|
join(execdir, 'doc'), # for Windows
|
||||||
'/usr/doc/python-docs-' + split(sys.version)[0],
|
join(sys.prefix, 'doc/python-docs-' + split(sys.version)[0]),
|
||||||
'/usr/doc/python-' + split(sys.version)[0],
|
join(sys.prefix, 'doc/python-' + split(sys.version)[0]),
|
||||||
'/usr/doc/python-docs-' + sys.version[:3],
|
join(sys.prefix, 'doc/python-docs-' + sys.version[:3]),
|
||||||
'/usr/doc/python-' + sys.version[:3],
|
join(sys.prefix, 'doc/python-' + sys.version[:3]),
|
||||||
os.path.join(sys.prefix, 'Resources/English.lproj/Documentation')]:
|
join(sys.prefix, 'Resources/English.lproj/Documentation')]:
|
||||||
if dir and os.path.isdir(os.path.join(dir, 'lib')):
|
if dir and os.path.isdir(join(dir, 'lib')):
|
||||||
self.docdir = dir
|
self.docdir = dir
|
||||||
|
break
|
||||||
|
if dir and os.path.isdir(join(dir, 'html', 'lib')):
|
||||||
|
self.docdir = join(dir, 'html')
|
||||||
|
break
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
if inspect.stack()[1][3] == '?':
|
if inspect.stack()[1][3] == '?':
|
||||||
|
|
Loading…
Reference in New Issue