Skip to content

Commit 5d09e77

Browse files
committed
Nicer comments in prepare_distribution_metadata
Why: To improve readability and provide useful context on the "flow".
1 parent d22a5fa commit 5d09e77

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/pip/_internal/distributions/source.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,27 @@ def get_pkg_resources_distribution(self):
2424
return self.req.get_dist()
2525

2626
def prepare_distribution_metadata(self, finder, build_isolation):
27-
# Prepare for building. We need to:
28-
# 1. Load pyproject.toml (if it exists)
29-
# 2. Set up the build environment
27+
"""Generate metadata for this distribution
28+
"""
3029
assert self.req.source_dir
3130

31+
# Load pyproject.toml, to determine whether PEP 517 is to be used
3232
self.req.load_pyproject_toml()
33+
34+
# Set up the build isolation, if this requirement should be isolated
3335
should_isolate = self.req.use_pep517 and build_isolation
3436
if should_isolate:
3537
self._setup_isolation(finder)
3638

39+
# Generate metadata
3740
with indent_log():
3841
self.req.metadata_directory = generate_metadata(self.req)
3942

43+
# Act on the newly generated metadata, based on the name and version.
4044
if not self.req.name:
4145
self.req.move_to_correct_build_directory()
4246
else:
4347
self.req.warn_on_mismatching_name()
44-
4548
self.req.assert_source_matches_version()
4649

4750
def _setup_isolation(self, finder):

0 commit comments

Comments
 (0)