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:
parent
d9630b572a
commit
277350ceed
@ -240,6 +240,7 @@ def update_package(self, pkg_name):
|
|||||||
|
|
||||||
# Add it again under the appropriate tags
|
# Add it again under the appropriate tags
|
||||||
for tag in getattr(package, 'tags', []):
|
for tag in getattr(package, 'tags', []):
|
||||||
|
tag = tag.lower()
|
||||||
self._tag_dict[tag].append(package.name)
|
self._tag_dict[tag].append(package.name)
|
||||||
|
|
||||||
|
|
||||||
@ -1002,6 +1003,7 @@ def packages_with_tags(self, *tags):
|
|||||||
index = self.tag_index
|
index = self.tag_index
|
||||||
|
|
||||||
for t in tags:
|
for t in tags:
|
||||||
|
t = t.lower()
|
||||||
v &= set(index[t])
|
v &= set(index[t])
|
||||||
|
|
||||||
return sorted(v)
|
return sorted(v)
|
||||||
|
@ -37,6 +37,14 @@ def test_list_tags():
|
|||||||
assert 'cloverleaf3d' in output
|
assert 'cloverleaf3d' in output
|
||||||
assert 'hdf5' not 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():
|
def test_list_format_name_only():
|
||||||
output = list('--format', 'name_only')
|
output = list('--format', 'name_only')
|
||||||
|
Loading…
Reference in New Issue
Block a user