Skip to content

Rework spack.database.InstallStatuses into a flag - #47321

Merged
haampie merged 13 commits into
spack:developfrom
alalazo:maintainers/more-on-db-query
Nov 14, 2024
Merged

Rework spack.database.InstallStatuses into a flag#47321
haampie merged 13 commits into
spack:developfrom
alalazo:maintainers/more-on-db-query

Conversation

@alalazo

@alalazo alalazo commented Oct 30, 2024

Copy link
Copy Markdown
Member

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
Comment thread lib/spack/spack/cmd/find.py Outdated
Comment thread lib/spack/spack/enums.py Outdated
@alalazo
alalazo force-pushed the maintainers/more-on-db-query branch from a0dd35a to fd7a1f2 Compare November 4, 2024 08:51
Comment thread lib/spack/spack/binary_distribution.py Outdated
Comment thread lib/spack/spack/test/cmd/reindex.py Outdated
@alalazo
alalazo requested a review from haampie November 5, 2024 09:44
@alalazo
alalazo force-pushed the maintainers/more-on-db-query branch from 47de62f to dddf1b0 Compare November 13, 2024 13:59
Comment thread lib/spack/spack/cmd/__init__.py Outdated
@haampie
haampie merged commit fb46c7a into spack:develop Nov 14, 2024
@alalazo
alalazo deleted the maintainers/more-on-db-query branch November 14, 2024 17:10
fryeguy52 pushed a commit to fryeguy52/spack that referenced this pull request Dec 17, 2024
kshea21 pushed a commit to kshea21/spack that referenced this pull request Dec 26, 2024
nkoukpaizan pushed a commit to nkoukpaizan/spack that referenced this pull request Apr 4, 2025
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