Consistent docs and usage of env mod methods (#3351)
This commit is contained in:

committed by
Todd Gamblin

parent
560d28ac7f
commit
dca4d2b15e
@@ -1523,23 +1523,23 @@ properties to be used by dependents.
|
||||
|
||||
The function declaration should look like this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
class Qt(Package):
|
||||
...
|
||||
def setup_dependent_environment(self, module, spec, dep_spec):
|
||||
"""Dependencies of Qt find it using the QTDIR environment variable."""
|
||||
os.environ['QTDIR'] = self.prefix
|
||||
.. literalinclude:: ../../../var/spack/repos/builtin/packages/qt/package.py
|
||||
:pyobject: Qt.setup_dependent_environment
|
||||
:linenos:
|
||||
|
||||
Here, the Qt package sets the ``QTDIR`` environment variable so that
|
||||
packages that depend on a particular Qt installation will find it.
|
||||
|
||||
The arguments to this function are:
|
||||
|
||||
* **module**: the module of the dependent package, where global
|
||||
properties can be assigned.
|
||||
* **spec**: the spec of the *dependency package* (the one the function is called on).
|
||||
* **dep_spec**: the spec of the dependent package (i.e. dep_spec depends on spec).
|
||||
* **spack_env**: List of environment modifications to be applied when
|
||||
the dependent package is built within Spack.
|
||||
* **run_env**: List of environment modifications to be applied when
|
||||
the dependent package is run outside of Spack. These are added to the
|
||||
resulting module file.
|
||||
* **dependent_spec**: The spec of the dependent package about to be
|
||||
built. This allows the extendee (self) to query the dependent's state.
|
||||
Note that *this* package's spec is available as ``self.spec``.
|
||||
|
||||
A good example of using these is in the Python package:
|
||||
|
||||
@@ -2805,11 +2805,8 @@ the one passed to install, only the MPI implementations all set some
|
||||
additional properties on it to help you out. E.g., in mvapich2, you'll
|
||||
find this:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def setup_dependent_package(self, module, dep_spec):
|
||||
self.spec.mpicc = join_path(self.prefix.bin, 'mpicc')
|
||||
# … etc …
|
||||
.. literalinclude:: ../../../var/spack/repos/builtin/packages/mvapich2/package.py
|
||||
:pyobject: Mvapich2.setup_dependent_package
|
||||
|
||||
That code allows the mvapich2 package to associate an ``mpicc`` property
|
||||
with the ``mvapich2`` node in the DAG, so that dependents can access it.
|
||||
|
Reference in New Issue
Block a user