File tree 2 files changed +14
-5
lines changed
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):
505
505
pass # pdoc was not invoked while in a virtual environment
506
506
else :
507
507
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 )
510
514
sys .path .append (libdir )
511
515
# Resolve egg-links from `setup.py develop` or `pip install -e`
512
516
# XXX: Welcome a more canonical approach
Original file line number Diff line number Diff line change 4
4
import inspect
5
5
import os
6
6
import re
7
+ import sys
7
8
import subprocess
8
9
import textwrap
9
10
import traceback
@@ -624,9 +625,13 @@ def _project_relative_path(absolute_path):
624
625
Assumes the project's path is either the current working directory or
625
626
Python library installation.
626
627
"""
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 ):
630
635
common_path = os .path .commonpath ([prefix_path , absolute_path ])
631
636
if os .path .samefile (common_path , prefix_path ):
632
637
# absolute_path is a descendant of prefix_path
You can’t perform that action at this time.
0 commit comments