File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -505,8 +505,12 @@ def main(_args=None):
505505 pass # pdoc was not invoked while in a virtual environment
506506 else :
507507 from glob import glob
508- from distutils .sysconfig import get_python_lib
509- libdir = get_python_lib (prefix = venv_dir )
508+ if sys .version_info >= (3 , 11 ):
509+ from sysconfig import get_path
510+ libdir = get_path ("platlib" )
511+ else :
512+ from distutils .sysconfig import get_python_lib
513+ libdir = get_python_lib (prefix = venv_dir )
510514 sys .path .append (libdir )
511515 # Resolve egg-links from `setup.py develop` or `pip install -e`
512516 # XXX: Welcome a more canonical approach
Original file line number Diff line number Diff line change 44import inspect
55import os
66import re
7+ import sys
78import subprocess
89import textwrap
910import traceback
@@ -624,9 +625,13 @@ def _project_relative_path(absolute_path):
624625 Assumes the project's path is either the current working directory or
625626 Python library installation.
626627 """
627- from distutils .sysconfig import get_python_lib
628- for prefix_path in (_git_project_root () or os .getcwd (),
629- get_python_lib ()):
628+ if sys .version_info >= (3 , 11 ):
629+ from sysconfig import get_path
630+ libdir = get_path ("platlib" )
631+ else :
632+ from distutils .sysconfig import get_python_lib
633+ libdir = get_python_lib ()
634+ for prefix_path in (_git_project_root () or os .getcwd (), libdir ):
630635 common_path = os .path .commonpath ([prefix_path , absolute_path ])
631636 if os .path .samefile (common_path , prefix_path ):
632637 # absolute_path is a descendant of prefix_path
You can’t perform that action at this time.
0 commit comments