Skip to content

Fixups for spack info#51450

Merged
alalazo merged 2 commits intodevelopfrom
fixups-for-spack-info
Oct 21, 2025
Merged

Fixups for spack info#51450
alalazo merged 2 commits intodevelopfrom
fixups-for-spack-info

Conversation

@tgamblin
Copy link
Copy Markdown
Member

These commits add some cleanup items requested by @alalazo on #51137.

I noticed that in 3.13, argparse actually added a deprecated=True option to arguments, but we can't use that yet since 3.13 is too new. I added a DeprecatedStoreTrueAction to spack.cmd.common.arguments here that we can use to deprecate arguments (and I suppose we can generalize it for other actions later). It does more than the deprecated=True, e.g.:

    # deprecated for the more generic --by-name, but still here until we can remove it
    subparser.add_argument(
        "--variants-by-name",
        dest="by_name",
        action=arguments.DeprecatedStoreTrueAction,
        help=argparse.SUPPRESS,
        removed_in="a future Spack release",
        instructions="use --by-name instead",
    )

and prints:

> spack info --variants-by-name
==> Warning: --variants-by-name is deprecated and will be removed in a future Spack release.
  use --by-name instead

@tgamblin tgamblin requested a review from alalazo October 20, 2025 17:45
@tgamblin tgamblin force-pushed the fixups-for-spack-info branch from 68e7246 to 234a6d3 Compare October 20, 2025 22:49
- [x] add a `DeprecatedStoreTrueAction` to our common arguments code
- [x] use it in `spack info`
- [x] update the test for `spack info` to ensure the warning

Signed-off-by: Todd Gamblin <[email protected]>
- [x] document max_name_len argument to _print_definition
- [x] remove unused type variables
- [x] make a comment a bit more future-proof

Signed-off-by: Todd Gamblin <[email protected]>
@tgamblin tgamblin force-pushed the fixups-for-spack-info branch from 234a6d3 to 353e909 Compare October 21, 2025 05:34
@alalazo alalazo enabled auto-merge (squash) October 21, 2025 07:09
@alalazo alalazo self-assigned this Oct 21, 2025
@alalazo alalazo disabled auto-merge October 21, 2025 07:09
@alalazo alalazo enabled auto-merge (squash) October 21, 2025 07:11
@alalazo alalazo merged commit 7c5a96f into develop Oct 21, 2025
33 checks passed
@alalazo alalazo deleted the fixups-for-spack-info branch October 21, 2025 07:33
@tgamblin tgamblin added this to the v1.1.0 milestone Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants