From 9da34554dac39d13d6c77d00b1acb1e18179a707 Mon Sep 17 00:00:00 2001 From: Stu Hood Date: Tue, 22 Feb 2022 15:40:30 -0800 Subject: [PATCH] Shortcircuit source subsetting if there are no distributions. # Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels] --- src/python/pants/backend/python/util_rules/local_dists.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/python/pants/backend/python/util_rules/local_dists.py b/src/python/pants/backend/python/util_rules/local_dists.py index c31324e3607..ca4df67668c 100644 --- a/src/python/pants/backend/python/util_rules/local_dists.py +++ b/src/python/pants/backend/python/util_rules/local_dists.py @@ -178,6 +178,12 @@ async def build_local_dists( ), ) + if not wheels: + # The source calculations below are not (always) cheap, so we skip them if no wheels were + # produced. See https://github.com/pantsbuild/pants/issues/14561 for one possible approach + # to sharing the cost of these calculations. + return LocalDistsPex(dists_pex, request.sources) + # We check source roots in reverse lexicographic order, # so we'll find the innermost root that matches. source_roots = sorted(request.sources.source_roots, reverse=True)