From be490ad2818ba7b11e7ebc2c0ae74b0b4bf9bd4c Mon Sep 17 00:00:00 2001 From: Danny McClanahan <1305167+cosmicexplorer@users.noreply.github.com> Date: Wed, 12 Feb 2020 10:21:46 -0800 Subject: [PATCH] bump deprecation version --- src/python/pants/engine/legacy/graph.py | 9 +++++---- src/python/pants/rules/core/list_targets.py | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/python/pants/engine/legacy/graph.py b/src/python/pants/engine/legacy/graph.py index ec32cc84889f..5a43b8b4e2b6 100644 --- a/src/python/pants/engine/legacy/graph.py +++ b/src/python/pants/engine/legacy/graph.py @@ -629,11 +629,12 @@ async def hydrated_targets(addresses: Addresses) -> HydratedTargets: targets = await MultiGet(Get[HydratedTarget](Address, a) for a in addresses) return HydratedTargets(targets) -def transitive_fingerprinted_targets(addresses: Addresses) -> FingerprintedTargetCollection: +@rule +async def transitive_fingerprinted_targets(addresses: Addresses) -> FingerprintedTargetCollection: """Traverse BuildFileAddresses to obtain fingerprint information for the target set.""" - root_transitive_hydrated_targets = yield [Get(TransitiveHydratedTarget, Address, a) - for a in addresses] + root_transitive_hydrated_targets = await MultiGet(Get(TransitiveHydratedTarget, Address, a) + for a in addresses) transitive_hydrated_targets = tuple( (tht, True) for tht in root_transitive_hydrated_targets @@ -661,7 +662,7 @@ def lookup_fingerprint(tht): for tht, was_root in transitive_hydrated_targets ] - yield FingerprintedTargetCollection(tuple(fingerprinted_targets)) + return FingerprintedTargetCollection(tuple(fingerprinted_targets)) @dataclass(frozen=True) diff --git a/src/python/pants/rules/core/list_targets.py b/src/python/pants/rules/core/list_targets.py index 37e0ab0d6fb0..0ecbf29797a4 100644 --- a/src/python/pants/rules/core/list_targets.py +++ b/src/python/pants/rules/core/list_targets.py @@ -28,7 +28,7 @@ class OutputFormat(Enum): def register_options(cls, register): super().register_options(register) register('--provides', type=bool, - removal_version='1.24.0.dev2', + removal_version='1.28.0.dev2', removal_hint='Use --output-format=provides instead!', help='List only targets that provide an artifact, displaying the columns specified by ' '--provides-columns.') @@ -37,7 +37,7 @@ def register_options(cls, register): 'address, artifact_id, repo_name, repo_url, push_db_basedir') register('--documented', type=bool, - removal_version='1.24.0.dev2', + removal_version='1.28.0.dev2', removal_hint='Use --output-format=documented instead!', help='Print only targets that are documented with a description.') @@ -108,19 +108,19 @@ async def list_targets(console: Console, list_options: ListOptions, addresses: A elif documented: output_format = List.OutputFormat.documented - # TODO: a .resolve_for_enum_variant() which allows `yield Get()` within it somehow! + # TODO: a match() method for Enums which allows `await Get()` within it somehow! if output_format == List.OutputFormat.provides: # To get provides clauses, we need hydrated targets. - collection = yield Get(HydratedTargets, Specs, specs) + collection = await Get[HydratedTargets](Specs, specs) print_fn = _make_provides_print_fn(provides_columns) elif output_format == List.OutputFormat.documented: # To get documentation, we need hydrated targets. - collection = yield Get(HydratedTargets, Specs, specs) + collection = await Get[HydratedTargets](Specs, specs) print_fn = _print_documented_target elif output_format == List.OutputFormat.json: # To get fingerprints of each target and its dependencies, we have to request that information # specifically. - collection = yield Get(FingerprintedTargetCollection, Specs, specs) + collection = await Get[FingerprintedTargetCollection](Specs, specs) print_fn = _print_fingerprinted_target else: assert output_format == List.OutputFormat.address_specs