# HG changeset patch # Parent be505d22dde8cd984ced09d607b3be187a93b808 Issue #15808: Update the filesystem paths used by IDLE to look for local copies of the Python HTML documentation set. diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -120,33 +120,35 @@ def __init__(self, flist=None, filename=None, key=None, root=None): if EditorWindow.help_url is None: - dochome = os.path.join(sys.base_prefix, 'Doc', 'index.html') + dp = [] if sys.platform.count('linux'): - # look for html docs in a couple of standard places + # look for html docs in various standard places + basepath = '/usr/share/doc/' # standard location + pyver = 'python%s.%s-doc' % sys.version_info[:2] + dp.append(os.path.join(basepath, pyver, 'html', 'index.html')) pyver = 'python-docs-' + '%s.%s.%s' % sys.version_info[:3] - if os.path.isdir('/var/www/html/python/'): # "python2" rpm - dochome = '/var/www/html/python/index.html' - else: - basepath = '/usr/share/doc/' # standard location - dochome = os.path.join(basepath, pyver, - 'Doc', 'index.html') + dp.append(os.path.join(basepath, pyver, 'html', 'index.html')) + dp.append(os.path.join(basepath, pyver, 'Doc', 'index.html')) + dp.append('/var/www/html/python/index.html') elif sys.platform[:3] == 'win': - chmfile = os.path.join(sys.base_prefix, 'Doc', - 'Python%s.chm' % _sphinx_version()) - if os.path.isfile(chmfile): - dochome = chmfile - elif macosxSupport.runningAsOSXApp(): + dp.append(os.path.join(sys.base_prefix, 'Doc', + 'Python%s.chm' % _sphinx_version())) + elif sys.platform == 'darwin': # documentation is stored inside the python framework - dochome = os.path.join(sys.base_prefix, - 'Resources/English.lproj/Documentation/index.html') - dochome = os.path.normpath(dochome) - if os.path.isfile(dochome): - EditorWindow.help_url = dochome - if sys.platform == 'darwin': - # Safari requires real file:-URLs - EditorWindow.help_url = 'file://' + EditorWindow.help_url + dp.append(os.path.join(sys.base_prefix, + 'Resources/English.lproj/Documentation/index.html')) + dp.append(os.path.join(sys.base_prefix, 'Doc', 'index.html')) + for dochome in dp: + dochome = os.path.normpath(dochome) + if os.path.isfile(dochome): + if sys.platform[:3] == 'win': + EditorWindow.help_url = dochome + else: + EditorWindow.help_url = 'file://' + dochome + break else: - EditorWindow.help_url = "http://docs.python.org/%d.%d" % sys.version_info[:2] + EditorWindow.help_url = ( + "http://docs.python.org/%d.%d" % sys.version_info[:2]) currentTheme=idleConf.CurrentTheme() self.flist = flist root = root or flist.root