Skip to content

Commit

Permalink
REF: Avoid if on Py>3.2, which is the only Python we support
Browse files Browse the repository at this point in the history
  • Loading branch information
kernc committed Jun 22, 2024
1 parent f7f053e commit da1ee93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 2 additions & 6 deletions pdoc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,8 @@ def main(_args=None):
pass # pdoc was not invoked while in a virtual environment
else:
from glob import glob
if sys.version_info >= (3, 11):
from sysconfig import get_path
libdir = get_path("platlib")
else:
from distutils.sysconfig import get_python_lib
libdir = get_python_lib(prefix=venv_dir)
from sysconfig import get_path
libdir = get_path("platlib")
sys.path.append(libdir)
# Resolve egg-links from `setup.py develop` or `pip install -e`
# XXX: Welcome a more canonical approach
Expand Down
8 changes: 2 additions & 6 deletions pdoc/html_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,12 +625,8 @@ def _project_relative_path(absolute_path):
Assumes the project's path is either the current working directory or
Python library installation.
"""
if sys.version_info >= (3, 11):
from sysconfig import get_path
libdir = get_path("platlib")
else:
from distutils.sysconfig import get_python_lib
libdir = get_python_lib()
from sysconfig import get_path
libdir = get_path("platlib")
for prefix_path in (_git_project_root() or os.getcwd(), libdir):
common_path = os.path.commonpath([prefix_path, absolute_path])
if os.path.samefile(common_path, prefix_path):
Expand Down

0 comments on commit da1ee93

Please sign in to comment.