mirror of
https://github.com/python/cpython.git
synced 2025-09-06 17:02:26 +00:00
bpo-21016: pydoc and trace use sysconfig (GH-18476)
bpo-21016, bpo-1294959: The pydoc and trace modules now use the sysconfig module to get the path to the Python standard library, to support uncommon installation path like /usr/lib64/python3.9/ on Fedora. Co-Authored-By: Jan Matějek <jmatejek@suse.com>
This commit is contained in:
parent
8c579b1cc8
commit
4fac7ed43e
3 changed files with 9 additions and 6 deletions
|
@ -66,6 +66,7 @@ import pkgutil
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import sysconfig
|
||||||
import time
|
import time
|
||||||
import tokenize
|
import tokenize
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
|
@ -392,9 +393,7 @@ class Doc:
|
||||||
|
|
||||||
docmodule = docclass = docroutine = docother = docproperty = docdata = fail
|
docmodule = docclass = docroutine = docother = docproperty = docdata = fail
|
||||||
|
|
||||||
def getdocloc(self, object,
|
def getdocloc(self, object, basedir=sysconfig.get_path('stdlib')):
|
||||||
basedir=os.path.join(sys.base_exec_prefix, "lib",
|
|
||||||
"python%d.%d" % sys.version_info[:2])):
|
|
||||||
"""Return the location of module docs or None"""
|
"""Return the location of module docs or None"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -52,6 +52,7 @@ __all__ = ['Trace', 'CoverageResults']
|
||||||
import linecache
|
import linecache
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import sysconfig
|
||||||
import token
|
import token
|
||||||
import tokenize
|
import tokenize
|
||||||
import inspect
|
import inspect
|
||||||
|
@ -660,9 +661,8 @@ def main():
|
||||||
opts = parser.parse_args()
|
opts = parser.parse_args()
|
||||||
|
|
||||||
if opts.ignore_dir:
|
if opts.ignore_dir:
|
||||||
rel_path = 'lib', 'python{0.major}.{0.minor}'.format(sys.version_info)
|
_prefix = sysconfig.get_path("stdlib")
|
||||||
_prefix = os.path.join(sys.base_prefix, *rel_path)
|
_exec_prefix = sysconfig.get_path("platstdlib")
|
||||||
_exec_prefix = os.path.join(sys.base_exec_prefix, *rel_path)
|
|
||||||
|
|
||||||
def parse_ignore_dir(s):
|
def parse_ignore_dir(s):
|
||||||
s = os.path.expanduser(os.path.expandvars(s))
|
s = os.path.expanduser(os.path.expandvars(s))
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
The :mod:`pydoc` and :mod:`trace` modules now use the :mod:`sysconfig`
|
||||||
|
module to get the path to the Python standard library, to support uncommon
|
||||||
|
installation path like ``/usr/lib64/python3.9/`` on Fedora.
|
||||||
|
Patch by Jan Matějek.
|
Loading…
Add table
Add a link
Reference in a new issue