diff options
Diffstat (limited to 'lib/spack/docs/packaging_guide.rst')
-rw-r--r-- | lib/spack/docs/packaging_guide.rst | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst index 2ceb4ce051..fb1d5edcab 100644 --- a/lib/spack/docs/packaging_guide.rst +++ b/lib/spack/docs/packaging_guide.rst @@ -2722,67 +2722,6 @@ extensions; as a consequence python extension packages (those inheriting from ``PythonPackage``) likewise override ``add_files_to_view`` in order to rewrite shebang lines which point to the Python interpreter. -^^^^^^^^^^^^^^^^^^^^^^^^^ -Activation & deactivation -^^^^^^^^^^^^^^^^^^^^^^^^^ - -Adding an extension to a view is referred to as an activation. If the view is -maintained in the Spack installation prefix of the extendee this is called a -global activation. Activations may involve updating some centralized state -that is maintained by the extendee package, so there can be additional work -for adding extensions compared with non-extension packages. - -Spack's ``Package`` class has default ``activate`` and ``deactivate`` -implementations that handle symbolically linking extensions' prefixes -into a specified view. Extendable packages can override these methods -to add custom activate/deactivate logic of their own. For example, -the ``activate`` and ``deactivate`` methods in the Python class handle -symbolic linking of extensions, but they also handle details surrounding -Python's ``.pth`` files, and other aspects of Python packaging. - -Spack's extensions mechanism is designed to be extensible, so that -other packages (like Ruby, R, Perl, etc.) can provide their own -custom extension management logic, as they may not handle modules the -same way that Python does. - -Let's look at Python's activate function: - -.. literalinclude:: _spack_root/var/spack/repos/builtin/packages/python/package.py - :pyobject: Python.activate - :linenos: - -This function is called on the *extendee* (Python). It first calls -``activate`` in the superclass, which handles symlinking the -extension package's prefix into the specified view. It then does -some special handling of the ``easy-install.pth`` file, part of -Python's setuptools. - -Deactivate behaves similarly to activate, but it unlinks files: - -.. literalinclude:: _spack_root/var/spack/repos/builtin/packages/python/package.py - :pyobject: Python.deactivate - :linenos: - -Both of these methods call some custom functions in the Python -package. See the source for Spack's Python package for details. - -^^^^^^^^^^^^^^^^^^^^ -Activation arguments -^^^^^^^^^^^^^^^^^^^^ - -You may have noticed that the ``activate`` function defined above -takes keyword arguments. These are the keyword arguments from -``extends()``, and they are passed to both activate and deactivate. - -This capability allows an extension to customize its own activation by -passing arguments to the extendee. Extendees can likewise implement -custom ``activate()`` and ``deactivate()`` functions to suit their -needs. - -The only keyword argument supported by default is the ``ignore`` -argument, which can take a regex, list of regexes, or a predicate to -determine which files *not* to symlink during activation. - .. _virtual-dependencies: -------------------- |