/
lib
/
python3.9
/
site-packages
/
virtualenv
/
util
/
path
/
Upload File
HOME
from pathlib import Path from subprocess import check_output, CalledProcessError def get_system_wheels_paths(interpreter): # ensurepip wheels # We need subprocess here to check ensurepip with the Python we are creating # a new virtual environment for executable = interpreter.executable try: ensurepip_path = check_output((executable, "-u", "-c", 'import ensurepip; print(ensurepip.__path__[0])'), universal_newlines=True) ensurepip_path = Path(ensurepip_path.strip()) / "_bundled" except CalledProcessError: pass else: if ensurepip_path.is_dir(): yield ensurepip_path # Standard wheels path # The EL 9 main Python has just 3 (this is the %{python3_pkgversion} RPM macro) if interpreter.version_info[:2] == (3, 9): python3_pkgversion = "3" else: python3_pkgversion = "{0.major}.{0.minor}".format(interpreter.version_info) wheels_dir = Path(f"/usr/share/python{python3_pkgversion}-wheels") if wheels_dir.exists(): yield wheels_dir