summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/EditorWindow.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2009-04-23 02:36:01 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2009-04-23 02:36:01 (GMT)
commitf13447f3f75c7b56eec6a602b0b72a48fbbc5486 (patch)
tree3f4db5bc2b7d00a12478cb3565aacfa33a8ec48c /Lib/idlelib/EditorWindow.py
parent8100bd8431cae4b079ffc1f0c3e33ba019661994 (diff)
downloadcpython-f13447f3f75c7b56eec6a602b0b72a48fbbc5486.zip
cpython-f13447f3f75c7b56eec6a602b0b72a48fbbc5486.tar.gz
cpython-f13447f3f75c7b56eec6a602b0b72a48fbbc5486.tar.bz2
Produce correct version string to access the .chm
docs on Windows. Patch 5783 gpolo. Will port.
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r--Lib/idlelib/EditorWindow.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 6e1d6f6..da051ed 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -22,6 +22,16 @@ import macosxSupport
# The default tab setting for a Text widget, in average-width characters.
TK_TABWIDTH_DEFAULT = 8
+def _sphinx_version():
+ "Format sys.version_info to produce the Sphinx version string used to install the chm docs"
+ major, minor, micro, level, serial = sys.version_info
+ release = '%s%s' % (major, minor)
+ if micro:
+ release += '%s' % micro
+ if level != 'final':
+ release += '%s%s' % (level[0], serial)
+ return release
+
def _find_module(fullname, path=None):
"""Version of imp.find_module() that handles hierarchical module names"""
@@ -64,15 +74,13 @@ class EditorWindow(object):
'Doc', 'index.html')
elif sys.platform[:3] == 'win':
chmfile = os.path.join(sys.prefix, 'Doc',
- 'Python%d%d.chm' % sys.version_info[:2])
+ 'Python%s.chm' % _sphinx_version())
if os.path.isfile(chmfile):
dochome = chmfile
-
elif macosxSupport.runningAsOSXApp():
# documentation is stored inside the python framework
dochome = os.path.join(sys.prefix,
'Resources/English.lproj/Documentation/index.html')
-
dochome = os.path.normpath(dochome)
if os.path.isfile(dochome):
EditorWindow.help_url = dochome