Make builtin flag handlers available in package scope (#8668)
* Push default flag handlers into module scope * Preserve backwards compatibility of builtin flag handler names Ensure Spack continues to work for packages using the `Package.env_flags` idiom and equivalent. * update docs and tests to match * Update packages to match new syntax
This commit is contained in:
@@ -2689,13 +2689,13 @@ Here are the definitions of the three built-in flag handlers:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def inject_flags(self, name, flags):
|
||||
def inject_flags(pkg, name, flags):
|
||||
return (flags, None, None)
|
||||
|
||||
def env_flags(self, name, flags):
|
||||
def env_flags(pkg, name, flags):
|
||||
return (None, flags, None)
|
||||
|
||||
def build_system_flags(self, name, flags):
|
||||
def build_system_flags(pkg, name, flags):
|
||||
return (None, None, flags)
|
||||
|
||||
.. note::
|
||||
@@ -2708,10 +2708,7 @@ the built-in flag handlers,
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
flag_handler = <PackageClass>.env_flags
|
||||
|
||||
where ``<PackageClass>`` can be any of the subclasses of PackageBase
|
||||
discussed in :ref:`installation_procedure`,
|
||||
flag_handler = env_flags
|
||||
|
||||
or by implementing the flag_handler method. Suppose for a package
|
||||
``Foo`` we need to pass ``cflags``, ``cxxflags``, and ``cppflags``
|
||||
@@ -2737,7 +2734,7 @@ method of the ``EnvironmentModifications`` class to append values to a
|
||||
list of flags whenever the flag handler is ``env_flags``. If the
|
||||
package passes flags through the environment or the build system
|
||||
manually (in the install method, for example), we recommend using the
|
||||
default flag handler, or removind manual references and implementing a
|
||||
default flag handler, or removing manual references and implementing a
|
||||
custom flag handler method that adds the desired flags to export as
|
||||
environment variables or pass to the build system. Manual flag passing
|
||||
is likely to interfere with the ``env_flags`` and
|
||||
|
Reference in New Issue
Block a user