File indexing completed on 2024-11-24 05:05:58
0001 import logging 0002 import os 0003 from typing import Optional 0004 0005 from pip._vendor.pep517.wrappers import Pep517HookCaller 0006 0007 from pip._internal.utils.subprocess import runner_with_spinner_message 0008 0009 logger = logging.getLogger(__name__) 0010 0011 0012 def build_wheel_pep517( 0013 name: str, 0014 backend: Pep517HookCaller, 0015 metadata_directory: str, 0016 tempd: str, 0017 ) -> Optional[str]: 0018 """Build one InstallRequirement using the PEP 517 build process. 0019 0020 Returns path to wheel if successfully built. Otherwise, returns None. 0021 """ 0022 assert metadata_directory is not None 0023 try: 0024 logger.debug("Destination directory: %s", tempd) 0025 0026 runner = runner_with_spinner_message( 0027 f"Building wheel for {name} (pyproject.toml)" 0028 ) 0029 with backend.subprocess_runner(runner): 0030 wheel_name = backend.build_wheel( 0031 tempd, 0032 metadata_directory=metadata_directory, 0033 ) 0034 except Exception: 0035 logger.error("Failed building wheel for %s", name) 0036 return None 0037 return os.path.join(tempd, wheel_name)