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
```
This commit is contained in:
Michael Kuhn 2020-04-15 16:45:28 +02:00 committed by Todd Gamblin
parent d9630b572a
commit 277350ceed
2 changed files with 10 additions and 0 deletions

View File

@ -240,6 +240,7 @@ def update_package(self, pkg_name):
# 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 @@ def packages_with_tags(self, *tags):
index = self.tag_index
for t in tags:
t = t.lower()
v &= set(index[t])
return sorted(v)

View File

@ -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')