summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/editor.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-08-11 21:35:36 (GMT)
committerGitHub <noreply@github.com>2022-08-11 21:35:36 (GMT)
commitbfaa071e1c84517ab8fdabc15bf934a67882c09f (patch)
treef0a3a31c1f138935ebb65e3860d7b347b4ca5342 /Lib/idlelib/editor.py
parent2579c4954f93e25652974f7d1a16b3c8d763cc36 (diff)
downloadcpython-bfaa071e1c84517ab8fdabc15bf934a67882c09f.zip
cpython-bfaa071e1c84517ab8fdabc15bf934a67882c09f.tar.gz
cpython-bfaa071e1c84517ab8fdabc15bf934a67882c09f.tar.bz2
gh-95841: IDLE - Revise Windows local doc url (GH-95845)
GH-91242 replaced the Windows chm help file with a copy of the html docs. This PR replaces the IDLE code that fetches the Windows local help url passed to os.startfile. Co-authored-by: Steve Dower (cherry picked from commit bdb2cf8e913c041f26e8976abe58414819b3e8ff) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Diffstat (limited to 'Lib/idlelib/editor.py')
-rw-r--r--Lib/idlelib/editor.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/Lib/idlelib/editor.py b/Lib/idlelib/editor.py
index 859a288..08d6aa2 100644
--- a/Lib/idlelib/editor.py
+++ b/Lib/idlelib/editor.py
@@ -86,10 +86,20 @@ class EditorWindow:
dochome = os.path.join(basepath, pyver,
'Doc', '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
+ import winreg # Windows only, block only executed once.
+ docfile = ''
+ KEY = (rf"Software\Python\PythonCore\{sys.winver}"
+ r"\Help\Main Python Documentation")
+ try:
+ docfile = winreg.QueryValue(winreg.HKEY_CURRENT_USER, KEY)
+ except FileNotFoundError:
+ try:
+ docfile = winreg.QueryValue(winreg.HKEY_LOCAL_MACHINE,
+ KEY)
+ except FileNotFoundError:
+ pass
+ if os.path.isfile(docfile):
+ dochome = docfile
elif sys.platform == 'darwin':
# documentation may be stored inside a python framework
dochome = os.path.join(sys.base_prefix,