Skip to content

Commit 53cb9b8

Browse files
committed
REF: Avoid if on Py>3.2, which is the only Python we support
1 parent f7f053e commit 53cb9b8

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

pdoc/cli.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -500,17 +500,13 @@ def main(_args=None):
500500

501501
# Virtual environment handling for pdoc script run from system site
502502
try:
503-
venv_dir = os.environ['VIRTUAL_ENV']
503+
os.environ['VIRTUAL_ENV']
504504
except KeyError:
505505
pass # pdoc was not invoked while in a virtual environment
506506
else:
507507
from glob import glob
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)
508+
from sysconfig import get_path
509+
libdir = get_path("platlib")
514510
sys.path.append(libdir)
515511
# Resolve egg-links from `setup.py develop` or `pip install -e`
516512
# XXX: Welcome a more canonical approach

pdoc/html_helpers.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import inspect
55
import os
66
import re
7-
import sys
87
import subprocess
98
import textwrap
109
import traceback
@@ -625,12 +624,8 @@ def _project_relative_path(absolute_path):
625624
Assumes the project's path is either the current working directory or
626625
Python library installation.
627626
"""
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()
627+
from sysconfig import get_path
628+
libdir = get_path("platlib")
634629
for prefix_path in (_git_project_root() or os.getcwd(), libdir):
635630
common_path = os.path.commonpath([prefix_path, absolute_path])
636631
if os.path.samefile(common_path, prefix_path):

0 commit comments

Comments
 (0)