Skip to content

depends_on can specify matching dependencies #10255

@benzwick

Description

@benzwick

It would be nice to have a simple way to specify matching dependencies for related packages. For example, petsc4py always depends on a matching version of petsc:

    depends_on('[email protected]:3.10.99+mpi', when='@3.10:3.10.99')
    depends_on('[email protected]:3.9.99+mpi', when='@3.9:3.9.99')
    depends_on('[email protected]:3.8.99+mpi', when='@3.8:3.8.99')
    depends_on('[email protected]:3.7.99+mpi', when='@3.7:3.7.99')
    depends_on('[email protected]:3.6.99+mpi', when='@3.6:3.6.99')

The above lines could then be replaced by the single line:

    depends_on('petsc+mpi', match="3.10")

or perhaps:

    depends_on('petsc+mpi', match="@3.10:3.10.99")

where the "3.10" would be extrapolated to all available versions e.g. 3.6.1 petsc4py would match with 3.6.3 petsc (similar to how the URL is currently extrapolated from the url field in the package).

Matching dependencies would make it easier to fix issues like this:

It would also prevent updates of one package (in this case petsc to 3.11) breaking the installation of another package (petsc4py) because the dependent package (petsc4py) may not yet have been updated with:

depends_on('[email protected]:3.11.99+mpi', when='@3.11:3.11.99')

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA feature is missing in Spack

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions