Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure the sandbox distdir exists when creating dists via PEP517. (Cherry-pick of #16647) #16659

Merged
merged 1 commit into from Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/markdown/Python/python/python-distributions.md
Expand Up @@ -180,8 +180,8 @@ For each `python_source` target S, the distribution in which S's code is publish
1. A `python_distribution` that depends, directly or indirectly, on S.
2. Is S's closest filesystem ancestor among those satisfying 1.

If there are multiple such exported source files at the same degree of ancestry, the ownership
is ambiguous and an error is raised. If there is no `python_distribution` that depends on S
If there are multiple such exported source files at the same degree of ancestry, the ownership
is ambiguous and an error is raised. If there is no `python_distribution` that depends on S
and is its ancestor, then there is no owner and an error is raised.

This algorithm implies that all source files published by a distribution must be below it in the filesystem. It also guarantees that a source file is only published by a single distribution.
Expand Down
2 changes: 2 additions & 0 deletions src/python/pants/backend/python/util_rules/dists.py
Expand Up @@ -144,6 +144,7 @@ class DistBuildResult:
_BACKEND_SHIM_BOILERPLATE = """
# DO NOT EDIT THIS FILE -- AUTOGENERATED BY PANTS

import os
import {build_backend_module}

backend = {build_backend_object}
Expand All @@ -154,6 +155,7 @@ class DistBuildResult:
wheel_config_settings = {wheel_config_settings_str}
sdist_config_settings = {sdist_config_settings_str}

os.makedirs(dist_dir, exist_ok=True)
wheel_path = backend.build_wheel(dist_dir, wheel_config_settings) if build_wheel else None
sdist_path = backend.build_sdist(dist_dir, sdist_config_settings) if build_sdist else None

Expand Down