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

Rework spack.database.InstallStatuses into a flag #47321

Merged
merged 13 commits into from
Nov 14, 2024

Conversation

alalazo
Copy link
Member

@alalazo alalazo commented Oct 30, 2024

In spack.database we use a custom enum-like class InstallStatuses for legacy reasons1.

In this PR we turn that class into an enum.Flag, which has some small benefits:

  • Flags are composable with |. That allows us to simplify the signature of a couple of methods
  • We can easily define a constant in the enum representing "any" status, and stop using the builtin any for that purpose

On top of that:

  • More type-hinting is added to query functions.
  • In spack find the --only-missing option is mutually exclusive with --only-deprecated. Both can't be mixed with --missing and --deprecated.

Footnotes

  1. This class was added when Spack still had to support Python 2.6

@spackbot-app spackbot-app bot added binary-packages commands core PR affects Spack core functionality shell-support tests General test capability(ies) labels Oct 30, 2024
lib/spack/spack/enums.py Outdated Show resolved Hide resolved
@alalazo alalazo force-pushed the maintainers/more-on-db-query branch from a0dd35a to fd7a1f2 Compare November 4, 2024 08:51
@alalazo alalazo requested a review from haampie November 5, 2024 09:44
@haampie haampie merged commit fb46c7a into spack:develop Nov 14, 2024
35 checks passed
@alalazo alalazo deleted the maintainers/more-on-db-query branch November 14, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary-packages commands core PR affects Spack core functionality refactoring shell-support tests General test capability(ies)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants