diff options
author | Michael Kuhn <michael.kuhn@informatik.uni-hamburg.de> | 2020-04-15 16:45:28 +0200 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2020-04-15 14:56:25 -0700 |
commit | 277350ceed86b8f28ffd1c3b0a4592f3a865ec19 (patch) | |
tree | b2529c7c69bded7cfec28c1ca3bde6a9406f2ccc /lib | |
parent | d9630b572ace19f17f05fdb9e7cf17d6b4300ac7 (diff) | |
download | spack-277350ceed86b8f28ffd1c3b0a4592f3a865ec19.tar.gz spack-277350ceed86b8f28ffd1c3b0a4592f3a865ec19.tar.bz2 spack-277350ceed86b8f28ffd1c3b0a4592f3a865ec19.tar.xz spack-277350ceed86b8f28ffd1c3b0a4592f3a865ec19.zip |
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
```
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/repo.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/test/cmd/list.py | 8 |
2 files changed, 10 insertions, 0 deletions
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') |