From 117a05ed502dc292a2e8ee5ff8c4cded55af1c61 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 2 Mar 2007 14:37:12 +0000 Subject: [PATCH] Bug #1628895: some better tries to find HTML documentation in pydoc. --- Lib/pydoc.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 94927d02706..bf4400f6d24 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1627,16 +1627,21 @@ class Helper: self.docdir = None execdir = os.path.dirname(sys.executable) homedir = os.environ.get('PYTHONHOME') + join = os.path.join for dir in [os.environ.get('PYTHONDOCS'), homedir and os.path.join(homedir, 'doc'), - os.path.join(execdir, 'doc'), - '/usr/doc/python-docs-' + split(sys.version)[0], - '/usr/doc/python-' + split(sys.version)[0], - '/usr/doc/python-docs-' + sys.version[:3], - '/usr/doc/python-' + sys.version[:3], - os.path.join(sys.prefix, 'Resources/English.lproj/Documentation')]: - if dir and os.path.isdir(os.path.join(dir, 'lib')): + join(execdir, 'doc'), # for Windows + join(sys.prefix, 'doc/python-docs-' + split(sys.version)[0]), + join(sys.prefix, 'doc/python-' + split(sys.version)[0]), + join(sys.prefix, 'doc/python-docs-' + sys.version[:3]), + join(sys.prefix, 'doc/python-' + sys.version[:3]), + join(sys.prefix, 'Resources/English.lproj/Documentation')]: + if dir and os.path.isdir(join(dir, 'lib')): self.docdir = dir + break + if dir and os.path.isdir(join(dir, 'html', 'lib')): + self.docdir = join(dir, 'html') + break def __repr__(self): if inspect.stack()[1][3] == '?':