Added blacklisting of implicit modules in docs + regression tests
fixes #4400 The feature requested in #4400 was already part of the module file configuration, but it was neither tested nor documented. This commit takes care of adding a few lines in the documentation and a regression test.
This commit is contained in:
parent
ff83003eaf
commit
7a49ba56b6
@ -555,6 +555,26 @@ you'll see that now the module for ``gcc@7.2.0`` has reappeared:
|
|||||||
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".
|
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".
|
||||||
|
|
||||||
|
|
||||||
|
An additional possibility that you can leverage to unclutter the environment
|
||||||
|
is that of preventing the generation of module files for implicitly installed
|
||||||
|
packages. In this case all one needs to do is to add the following line:
|
||||||
|
|
||||||
|
.. code-block:: yaml
|
||||||
|
:emphasize-lines: 3
|
||||||
|
|
||||||
|
modules:
|
||||||
|
tcl:
|
||||||
|
blacklist_implicits: true
|
||||||
|
whitelist:
|
||||||
|
- gcc
|
||||||
|
blacklist:
|
||||||
|
- '%gcc@5.4.0'
|
||||||
|
all:
|
||||||
|
filter:
|
||||||
|
environment_blacklist: ['CPATH', 'LIBRARY_PATH']
|
||||||
|
|
||||||
|
to ``modules.yaml`` and regenerate the module file tree as above.
|
||||||
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
Change module file naming
|
Change module file naming
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -121,6 +121,10 @@
|
|||||||
'$ref': '#/definitions/array_of_strings'},
|
'$ref': '#/definitions/array_of_strings'},
|
||||||
'blacklist': {
|
'blacklist': {
|
||||||
'$ref': '#/definitions/array_of_strings'},
|
'$ref': '#/definitions/array_of_strings'},
|
||||||
|
'blacklist_implicits': {
|
||||||
|
'type': 'boolean',
|
||||||
|
'default': False
|
||||||
|
},
|
||||||
'naming_scheme': {
|
'naming_scheme': {
|
||||||
'type': 'string' # Can we be more specific here?
|
'type': 'string' # Can we be more specific here?
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ def _populate(mock_db):
|
|||||||
def _install(spec):
|
def _install(spec):
|
||||||
s = spack.spec.Spec(spec).concretized()
|
s = spack.spec.Spec(spec).concretized()
|
||||||
pkg = spack.repo.get(s)
|
pkg = spack.repo.get(s)
|
||||||
pkg.do_install(fake=True)
|
pkg.do_install(fake=True, explicit=True)
|
||||||
|
|
||||||
# Transaction used to avoid repeated writes.
|
# Transaction used to avoid repeated writes.
|
||||||
with mock_db.write_transaction():
|
with mock_db.write_transaction():
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
enable:
|
||||||
|
- tcl
|
||||||
|
tcl:
|
||||||
|
blacklist_implicits: true
|
||||||
|
all:
|
||||||
|
autoload: 'direct'
|
@ -274,3 +274,24 @@ def test_extend_context(
|
|||||||
|
|
||||||
short_description = 'module-whatis "This package updates the context for TCL modulefiles."' # NOQA: ignore=E501
|
short_description = 'module-whatis "This package updates the context for TCL modulefiles."' # NOQA: ignore=E501
|
||||||
assert short_description in content
|
assert short_description in content
|
||||||
|
|
||||||
|
@pytest.mark.regression('4400')
|
||||||
|
@pytest.mark.db
|
||||||
|
def test_blacklist_implicits(
|
||||||
|
self, modulefile_content, module_configuration, database
|
||||||
|
):
|
||||||
|
module_configuration('blacklist_implicits')
|
||||||
|
|
||||||
|
# mpileaks has been installed explicitly when setting up
|
||||||
|
# the tests database
|
||||||
|
mpileaks_specs = database.query('mpileaks')
|
||||||
|
for item in mpileaks_specs:
|
||||||
|
writer = writer_cls(item)
|
||||||
|
assert not writer.conf.blacklisted
|
||||||
|
|
||||||
|
# callpath is a dependency of mpileaks, and has been pulled
|
||||||
|
# in implicitly
|
||||||
|
callpath_specs = database.query('callpath')
|
||||||
|
for item in callpath_specs:
|
||||||
|
writer = writer_cls(item)
|
||||||
|
assert writer.conf.blacklisted
|
||||||
|
Loading…
Reference in New Issue
Block a user