mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-95841: IDLE - Revise Windows local doc url (GH-95845) (#95905)
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: Terry Jan Reedy <tjreedy@udel.edu>
Co-authored-by: Steve Dower
Approved by Steve Dower, #95845 (review), 2nd subblock.
(cherry picked from commit bdb2cf8e91
)
This commit is contained in:
parent
24dd1429e5
commit
577dbc3c49
1 changed files with 14 additions and 4 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue