comparison lib/python3.8/site-packages/pip/_internal/operations/build/metadata.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 """Metadata generation logic for source distributions.
2 """
3
4 import logging
5 import os
6
7 from pip._internal.utils.subprocess import runner_with_spinner_message
8 from pip._internal.utils.temp_dir import TempDirectory
9 from pip._internal.utils.typing import MYPY_CHECK_RUNNING
10
11 if MYPY_CHECK_RUNNING:
12 from pip._internal.build_env import BuildEnvironment
13 from pip._vendor.pep517.wrappers import Pep517HookCaller
14
15 logger = logging.getLogger(__name__)
16
17
18 def generate_metadata(build_env, backend):
19 # type: (BuildEnvironment, Pep517HookCaller) -> str
20 """Generate metadata using mechanisms described in PEP 517.
21
22 Returns the generated metadata directory.
23 """
24 metadata_tmpdir = TempDirectory(
25 kind="modern-metadata", globally_managed=True
26 )
27
28 metadata_dir = metadata_tmpdir.path
29
30 with build_env:
31 # Note that Pep517HookCaller implements a fallback for
32 # prepare_metadata_for_build_wheel, so we don't have to
33 # consider the possibility that this hook doesn't exist.
34 runner = runner_with_spinner_message("Preparing wheel metadata")
35 with backend.subprocess_runner(runner):
36 distinfo_dir = backend.prepare_metadata_for_build_wheel(
37 metadata_dir
38 )
39
40 return os.path.join(metadata_dir, distinfo_dir)