Skip to content

Commit

Permalink
Removed remove_lib_flags function since there seems to be no real use…
Browse files Browse the repository at this point in the history
… case for it.
  • Loading branch information
hiker committed Jan 29, 2025
1 parent 3a07639 commit ee743b8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 37 deletions.
14 changes: 1 addition & 13 deletions Documentation/source/advanced_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,19 +217,7 @@ the application only needs to specify the name of the libraries required, e.g.:
link_exe(state, libs=["yaxt", "xios"])
The linker will then use the specified options. Library definitions can
also be removed:

.. code-block::
:linenos:
tr = ToolRepository()
linker = tr.get_tool(Category.LINKER, "linker-ifort")
linker.remove_lib_flags("yaxt")
Note that if a linker has no information for the specified library name, i.e.
the definition was never added, no error will be raised when removing it.
The linker will then use the specified options.

A linker object also allows to define options that should always be added,
either as options before any library details, or at the very end. For example:
Expand Down
10 changes: 0 additions & 10 deletions source/fab/tools/linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,6 @@ def add_lib_flags(self, lib: str, flags: List[str],
# Make a copy to avoid modifying the caller's list
self._lib_flags[lib] = flags[:]

def remove_lib_flags(self, lib: str):
'''Remove any flags configured for a standard library
:param lib: the library name
'''
try:
del self._lib_flags[lib]
except KeyError:
pass

def add_pre_lib_flags(self, flags: List[str]):
'''Add a set of flags to use before any library-specific flags
Expand Down
14 changes: 0 additions & 14 deletions tests/unit_tests/tools/test_linker.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,6 @@ def test_linker_add_lib_flags_overwrite_silent(mock_linker):
assert result == ["-t", "-b"]


def test_linker_remove_lib_flags(mock_linker):
"""Linker should provide a way to remove the flags for a library"""
mock_linker.remove_lib_flags("netcdf")

with pytest.raises(RuntimeError) as err:
mock_linker.get_lib_flags("netcdf")
assert "Unknown library name: 'netcdf'" in str(err.value)


def test_linker_remove_lib_flags_unknown(mock_linker):
"""Linker should silently allow removing flags for unknown library"""
mock_linker.remove_lib_flags("unknown")


# ====================
# Linking:
# ====================
Expand Down

0 comments on commit ee743b8

Please sign in to comment.