From 277350ceed86b8f28ffd1c3b0a4592f3a865ec19 Mon Sep 17 00:00:00 2001 From: Michael Kuhn Date: Wed, 15 Apr 2020 16:45:28 +0200 Subject: Make tags case insensitive Currently, tags are case sensitive, which is unintuitive: ```console $ spack list -t hpc ==> 2 packages. nek5000 nektools $ spack list -t HPC ==> 1 packages. mfem $ spack list -t Hpc ==> 0 packages. ``` This change makes them case insensitive: ```console $ spack list -t hpc ==> 3 packages. mfem nek5000 nektools $ spack list -t HPC ==> 3 packages. mfem nek5000 nektools $ spack list -t Hpc ==> 3 packages. mfem nek5000 nektools ``` --- lib/spack/spack/repo.py | 2 ++ lib/spack/spack/test/cmd/list.py | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/spack/spack/repo.py b/lib/spack/spack/repo.py index 4a739189fc..764f1f9168 100644 --- a/lib/spack/spack/repo.py +++ b/lib/spack/spack/repo.py @@ -240,6 +240,7 @@ class TagIndex(Mapping): # Add it again under the appropriate tags for tag in getattr(package, 'tags', []): + tag = tag.lower() self._tag_dict[tag].append(package.name) @@ -1002,6 +1003,7 @@ class Repo(object): index = self.tag_index for t in tags: + t = t.lower() v &= set(index[t]) return sorted(v) diff --git a/lib/spack/spack/test/cmd/list.py b/lib/spack/spack/test/cmd/list.py index 5d18787bc7..17f5a1b493 100644 --- a/lib/spack/spack/test/cmd/list.py +++ b/lib/spack/spack/test/cmd/list.py @@ -37,6 +37,14 @@ def test_list_tags(): assert 'cloverleaf3d' in output assert 'hdf5' not in output + output = list('--tags', 'hpc') + assert 'nek5000' in output + assert 'mfem' in output + + output = list('--tags', 'HPC') + assert 'nek5000' in output + assert 'mfem' in output + def test_list_format_name_only(): output = list('--format', 'name_only') -- cgit v1.2.3-60-g2f50