comparison lib/python3.8/site-packages/pip/_internal/operations/build/wheel.py @ 0:9e54283cc701 draft

"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
author guerler
date Mon, 27 Jul 2020 03:47:31 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:9e54283cc701
1 import logging
2 import os
3
4 from pip._internal.utils.subprocess import runner_with_spinner_message
5 from pip._internal.utils.typing import MYPY_CHECK_RUNNING
6
7 if MYPY_CHECK_RUNNING:
8 from typing import List, Optional
9 from pip._vendor.pep517.wrappers import Pep517HookCaller
10
11 logger = logging.getLogger(__name__)
12
13
14 def build_wheel_pep517(
15 name, # type: str
16 backend, # type: Pep517HookCaller
17 metadata_directory, # type: str
18 build_options, # type: List[str]
19 tempd, # type: str
20 ):
21 # type: (...) -> Optional[str]
22 """Build one InstallRequirement using the PEP 517 build process.
23
24 Returns path to wheel if successfully built. Otherwise, returns None.
25 """
26 assert metadata_directory is not None
27 if build_options:
28 # PEP 517 does not support --build-options
29 logger.error('Cannot build wheel for %s using PEP 517 when '
30 '--build-option is present' % (name,))
31 return None
32 try:
33 logger.debug('Destination directory: %s', tempd)
34
35 runner = runner_with_spinner_message(
36 'Building wheel for {} (PEP 517)'.format(name)
37 )
38 with backend.subprocess_runner(runner):
39 wheel_name = backend.build_wheel(
40 tempd,
41 metadata_directory=metadata_directory,
42 )
43 except Exception:
44 logger.error('Failed building wheel for %s', name)
45 return None
46 return os.path.join(tempd, wheel_name)