Skip to content

Commit

Permalink
Fix docstrings and documentation references
Browse files Browse the repository at this point in the history
  • Loading branch information
alalazo committed May 5, 2022
1 parent af02110 commit 98a5f2f
Show file tree
Hide file tree
Showing 19 changed files with 88 additions and 90 deletions.
4 changes: 2 additions & 2 deletions lib/spack/docs/build_systems/cmakepackage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ Adding flags to cmake
To add additional flags to the ``cmake`` call, simply override the
``cmake_args`` function. The following example defines values for the flags
``WHATEVER``, ``ENABLE_BROKEN_FEATURE``, ``DETECT_HDF5``, and ``THREADS`` with
and without the :meth:`~spack.build_systems.cmake.CMakePackage.define` and
:meth:`~spack.build_systems.cmake.CMakePackage.define_from_variant` helper functions:
and without the :meth:`~spack.build_systems.cmake.CMakeWrapper.define` and
:meth:`~spack.build_systems.cmake.CMakeWrapper.define_from_variant` helper functions:

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion lib/spack/docs/developer_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Package-related modules
^^^^^^^^^^^^^^^^^^^^^^^

:mod:`spack.package`
Contains the :class:`~spack.package.Package` class, which
Contains the :class:`~spack.package.PackageBase` class, which
is the superclass for all packages in Spack. Methods on ``Package``
implement all phases of the :ref:`package lifecycle
<package-lifecycle>` and manage the build process.
Expand Down
6 changes: 3 additions & 3 deletions lib/spack/docs/packaging_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3022,7 +3022,7 @@ The classes that are currently provided by Spack are:
+----------------------------------------------------------+----------------------------------+
| **Base Class** | **Purpose** |
+==========================================================+==================================+
| :class:`~spack.package.Package` | General base class not |
| :class:`~spack.build_systems.generic.Package` | General base class not |
| | specialized for any build system |
+----------------------------------------------------------+----------------------------------+
| :class:`~spack.build_systems.makefile.MakefilePackage` | Specialized class for packages |
Expand Down Expand Up @@ -3118,7 +3118,7 @@ docs at :py:mod:`~.spack.build_systems`, or using the ``spack info`` command:
Typically, phases have default implementations that fit most of the common cases:

.. literalinclude:: _spack_root/lib/spack/spack/build_systems/autotools.py
:pyobject: AutotoolsPackage.configure
:pyobject: AutotoolsWrapper.configure
:linenos:

It is thus just sufficient for a packager to override a few
Expand Down Expand Up @@ -3153,7 +3153,7 @@ for the install phase is:
For those not used to Python instance methods, this is the
package itself. In this case it's an instance of ``Foo``, which
extends ``Package``. For API docs on Package objects, see
:py:class:`Package <spack.package.Package>`.
:py:class:`Package <spack.build_systems.generic.Package>`.

``spec``
This is the concrete spec object created by Spack from an
Expand Down
36 changes: 18 additions & 18 deletions lib/spack/spack/build_systems/autotools.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,30 @@
class AutotoolsPackage(spack.package.PackageBase):
"""Specialized class for packages built using GNU Autotools.
This class provides four phases that can be overridden:
There are four phases that can be overridden:
1. :py:meth:`~.AutotoolsPackage.autoreconf`
2. :py:meth:`~.AutotoolsPackage.configure`
3. :py:meth:`~.AutotoolsPackage.build`
4. :py:meth:`~.AutotoolsPackage.install`
1. :py:meth:`~.AutotoolsWrapper.autoreconf`
2. :py:meth:`~.AutotoolsWrapper.configure`
3. :py:meth:`~.AutotoolsWrapper.build`
4. :py:meth:`~.AutotoolsWrapper.install`
They all have sensible defaults and for many packages the only thing
necessary will be to override the helper method
:meth:`~spack.build_systems.autotools.AutotoolsPackage.configure_args`.
:meth:`~spack.build_systems.autotools.AutotoolsWrapper.configure_args`.
For a finer tuning you may also override:
+-----------------------------------------------+--------------------+
| **Method** | **Purpose** |
+===============================================+====================+
| :py:attr:`~.AutotoolsPackage.build_targets` | Specify ``make`` |
| :py:attr:`~.AutotoolsWrapper.build_targets` | Specify ``make`` |
| | targets for the |
| | build phase |
+-----------------------------------------------+--------------------+
| :py:attr:`~.AutotoolsPackage.install_targets` | Specify ``make`` |
| :py:attr:`~.AutotoolsWrapper.install_targets` | Specify ``make`` |
| | targets for the |
| | install phase |
+-----------------------------------------------+--------------------+
| :py:meth:`~.AutotoolsPackage.check` | Run build time |
| :py:meth:`~.AutotoolsWrapper.check` | Run build time |
| | tests if required |
+-----------------------------------------------+--------------------+
Expand Down Expand Up @@ -110,10 +110,10 @@ def patch_config_files(self):
#: (currently only for Arm/Clang/Fujitsu/NVHPC compilers)
patch_libtool = True

#: Targets for ``make`` during the :py:meth:`~.AutotoolsPackage.build`
#: Targets for ``make`` during the :py:meth:`~.AutotoolsWrapper.build`
#: phase
build_targets = [] # type: List[str]
#: Targets for ``make`` during the :py:meth:`~.AutotoolsPackage.install`
#: Targets for ``make`` during the :py:meth:`~.AutotoolsWrapper.install`
#: phase
install_targets = ['install']

Expand Down Expand Up @@ -399,7 +399,7 @@ def set_configure_or_die(self):
appropriately, otherwise raises an error.
:raises RuntimeError: if a configure script is not found in
:py:meth:`~AutotoolsPackage.configure_directory`
:py:meth:`~AutotoolsWrapper.configure_directory`
"""
# Check if a configure script is there. If not raise a RuntimeError.
if not os.path.exists(self.configure_abs_path):
Expand All @@ -421,7 +421,7 @@ def configure_args(self):

def configure(self, spec, prefix):
"""Runs configure with the arguments specified in
:meth:`~spack.build_systems.autotools.AutotoolsPackage.configure_args`
:meth:`~spack.build_systems.autotools.AutotoolsWrapper.configure_args`
and an appropriately set prefix.
"""
options = getattr(self, 'configure_flag_args', [])
Expand All @@ -440,7 +440,7 @@ def setup_build_environment(self, env):

def build(self, spec, prefix):
"""Makes the build targets specified by
:py:attr:``~.AutotoolsPackage.build_targets``
:py:attr:``~.AutotoolsWrapper.build_targets``
"""
# See https://autotools.io/automake/silent.html
params = ['V=1']
Expand All @@ -450,7 +450,7 @@ def build(self, spec, prefix):

def install(self, spec, prefix):
"""Makes the install targets specified by
:py:attr:``~.AutotoolsPackage.install_targets``
:py:attr:``~.AutotoolsWrapper.install_targets``
"""
with working_dir(self.build_directory):
inspect.getmodule(self).make(*self.install_targets)
Expand All @@ -476,8 +476,8 @@ def _activate_or_not(
variant=None
):
"""This function contains the current implementation details of
:meth:`~spack.build_systems.autotools.AutotoolsPackage.with_or_without` and
:meth:`~spack.build_systems.autotools.AutotoolsPackage.enable_or_disable`.
:meth:`~spack.build_systems.autotools.AutotoolsWrapper.with_or_without` and
:meth:`~spack.build_systems.autotools.AutotoolsWrapper.enable_or_disable`.
Args:
name (str): name of the option that is being activated or not
Expand Down Expand Up @@ -631,7 +631,7 @@ def with_or_without(self, name, activation_value=None, variant=None):

def enable_or_disable(self, name, activation_value=None, variant=None):
"""Same as
:meth:`~spack.build_systems.autotools.AutotoolsPackage.with_or_without`
:meth:`~spack.build_systems.autotools.AutotoolsWrapper.with_or_without`
but substitute ``with`` with ``enable`` and ``without`` with ``disable``.
Args:
Expand Down
14 changes: 7 additions & 7 deletions lib/spack/spack/build_systems/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ class CMakePackage(PackageBase):
This class provides three phases that can be overridden:
1. :py:meth:`~.CMakePackage.cmake`
2. :py:meth:`~.CMakePackage.build`
3. :py:meth:`~.CMakePackage.install`
1. :py:meth:`~.CMakeWrapper.cmake`
2. :py:meth:`~.CMakeWrapper.build`
3. :py:meth:`~.CMakeWrapper.install`
They all have sensible defaults and for many packages the only thing
necessary will be to override :py:meth:`~.CMakePackage.cmake_args`.
necessary will be to override :py:meth:`~.CMakeWrapper.cmake_args`.
For a finer tuning you may also override:
+-----------------------------------------------+--------------------+
| **Method** | **Purpose** |
+===============================================+====================+
| :py:meth:`~.CMakePackage.root_cmakelists_dir` | Location of the |
| :py:meth:`~.CMakeWrapper.root_cmakelists_dir` | Location of the |
| | root CMakeLists.txt|
+-----------------------------------------------+--------------------+
| :py:meth:`~.CMakePackage.build_directory` | Directory where to |
| :py:meth:`~.CMakeWrapper.build_directory` | Directory where to |
| | build the package |
+-----------------------------------------------+--------------------+
Expand Down Expand Up @@ -288,7 +288,7 @@ def define_from_variant(self, cmake_var, variant=None):
of ``cmake_var``.
This utility function is similar to
:meth:`~spack.build_systems.autotools.AutotoolsPackage.with_or_without`.
:meth:`~spack.build_systems.autotools.AutotoolsWrapper.with_or_without`.
Examples:
Expand Down
26 changes: 13 additions & 13 deletions lib/spack/spack/build_systems/makefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ class MakefilePackage(spack.package.PackageBase):
This class provides three phases that can be overridden:
1. :py:meth:`~.MakefilePackage.edit`
2. :py:meth:`~.MakefilePackage.build`
3. :py:meth:`~.MakefilePackage.install`
1. :py:meth:`~.MakefileWrapper.edit`
2. :py:meth:`~.MakefileWrapper.build`
3. :py:meth:`~.MakefileWrapper.install`
It is usually necessary to override the :py:meth:`~.MakefilePackage.edit`
phase, while :py:meth:`~.MakefilePackage.build` and
:py:meth:`~.MakefilePackage.install` have sensible defaults.
It is usually necessary to override the :py:meth:`~.MakefileWrapper.edit`
phase, while :py:meth:`~.MakefileWrapper.build` and
:py:meth:`~.MakefileWrapper.install` have sensible defaults.
For a finer tuning you may override:
+-----------------------------------------------+--------------------+
| **Method** | **Purpose** |
+===============================================+====================+
| :py:attr:`~.MakefilePackage.build_targets` | Specify ``make`` |
| :py:attr:`~.MakefileWrapper.build_targets` | Specify ``make`` |
| | targets for the |
| | build phase |
+-----------------------------------------------+--------------------+
| :py:attr:`~.MakefilePackage.install_targets` | Specify ``make`` |
| :py:attr:`~.MakefileWrapper.install_targets` | Specify ``make`` |
| | targets for the |
| | install phase |
+-----------------------------------------------+--------------------+
| :py:meth:`~.MakefilePackage.build_directory` | Directory where the|
| :py:meth:`~.MakefileWrapper.build_directory` | Directory where the|
| | Makefile is located|
+-----------------------------------------------+--------------------+
"""
Expand All @@ -56,10 +56,10 @@ class MakefilePackage(spack.package.PackageBase):


class MakefileWrapper(spack.builder.BuildWrapper):
#: Targets for ``make`` during the :py:meth:`~.MakefilePackage.build`
#: Targets for ``make`` during the :py:meth:`~.MakefileWrapper.build`
#: phase
build_targets = [] # type: List[str]
#: Targets for ``make`` during the :py:meth:`~.MakefilePackage.install`
#: Targets for ``make`` during the :py:meth:`~.MakefileWrapper.install`
#: phase
install_targets = ['install']

Expand All @@ -84,14 +84,14 @@ def edit(self, spec, prefix):
tty.msg('Using default implementation: skipping edit phase.')

def build(self, spec, prefix):
"""Calls make, passing :py:attr:`~.MakefilePackage.build_targets`
"""Calls make, passing :py:attr:`~.MakefileWrapper.build_targets`
as targets.
"""
with working_dir(self.build_directory):
inspect.getmodule(self).make(*self.build_targets)

def install(self, spec, prefix):
"""Calls make, passing :py:attr:`~.MakefilePackage.install_targets`
"""Calls make, passing :py:attr:`~.MakefileWrapper.install_targets`
as targets.
"""
with working_dir(self.build_directory):
Expand Down
12 changes: 6 additions & 6 deletions lib/spack/spack/build_systems/meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@ class MesonPackage(spack.package.PackageBase):
This class provides three phases that can be overridden:
1. :py:meth:`~.MesonPackage.meson`
2. :py:meth:`~.MesonPackage.build`
3. :py:meth:`~.MesonPackage.install`
1. :py:meth:`~.MesonWrapper.meson`
2. :py:meth:`~.MesonWrapper.build`
3. :py:meth:`~.MesonWrapper.install`
They all have sensible defaults and for many packages the only thing
necessary will be to override :py:meth:`~.MesonPackage.meson_args`.
necessary will be to override :py:meth:`~.MesonWrapper.meson_args`.
For a finer tuning you may also override:
+-----------------------------------------------+--------------------+
| **Method** | **Purpose** |
+===============================================+====================+
| :py:meth:`~.MesonPackage.root_mesonlists_dir` | Location of the |
| :py:meth:`~.MesonWrapper.root_mesonlists_dir` | Location of the |
| | root MesonLists.txt|
+-----------------------------------------------+--------------------+
| :py:meth:`~.MesonPackage.build_directory` | Directory where to |
| :py:meth:`~.MesonWrapper.build_directory` | Directory where to |
| | build the package |
+-----------------------------------------------+--------------------+
Expand Down
2 changes: 1 addition & 1 deletion lib/spack/spack/build_systems/octave.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class OctavePackage(PackageBase):
This class provides the following phases that can be overridden:
1. :py:meth:`~.OctavePackage.install`
1. :py:meth:`~.OctaveBuilder.PackageWrapper.install`
"""
# To be used in UI queries that require to know which
Expand Down
20 changes: 10 additions & 10 deletions lib/spack/spack/build_systems/perl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ class PerlPackage(PackageBase):
This class provides four phases that can be overridden if required:
1. :py:meth:`~.PerlPackage.configure`
2. :py:meth:`~.PerlPackage.build`
3. :py:meth:`~.PerlPackage.check`
4. :py:meth:`~.PerlPackage.install`
1. :py:meth:`~.PerlWrapper.configure`
2. :py:meth:`~.PerlWrapper.build`
3. :py:meth:`~.PerlWrapper.check`
4. :py:meth:`~.PerlWrapper.install`
The default methods use, in order of preference:
(1) Makefile.PL,
(2) Build.PL.
Some packages may need to override
:py:meth:`~.PerlPackage.configure_args`,
:py:meth:`~.PerlWrapper.configure_args`,
which produces a list of arguments for
:py:meth:`~.PerlPackage.configure`.
:py:meth:`~.PerlWrapper.configure`.
Arguments should not include the installation base directory.
"""
#: This attribute is used in UI queries that need to know the build
Expand All @@ -49,10 +49,10 @@ class PerlPackage(PackageBase):
extends('perl', when='buildsystem=perlbuild')


class PerlBuildWrapper(spack.builder.BuildWrapper):
class PerlWrapper(spack.builder.BuildWrapper):
def configure_args(self):
"""Produces a list containing the arguments that must be passed to
:py:meth:`~.PerlPackage.configure`. Arguments should not include
:py:meth:`~.PerlWrapper.configure`. Arguments should not include
the installation base directory, which is prepended automatically.
:return: list of arguments for Makefile.PL or Build.PL
Expand All @@ -62,7 +62,7 @@ def configure_args(self):
def configure(self, spec, prefix):
"""Runs Makefile.PL or Build.PL with arguments consisting of
an appropriate installation base directory followed by the
list returned by :py:meth:`~.PerlPackage.configure_args`.
list returned by :py:meth:`~.PerlWrapper.configure_args`.
:raise RuntimeError: if neither Makefile.PL or Build.PL exist
"""
Expand Down Expand Up @@ -119,4 +119,4 @@ class PerlBuilder(spack.builder.Builder):
#: Phases of a Perl package
phases = ('configure', 'build', 'install')

PackageWrapper = PerlBuildWrapper
PackageWrapper = PerlWrapper
10 changes: 5 additions & 5 deletions lib/spack/spack/build_systems/qmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class QMakePackage(spack.package.PackageBase):
This class provides three phases that can be overridden:
1. :py:meth:`~.QMakePackage.qmake`
2. :py:meth:`~.QMakePackage.build`
3. :py:meth:`~.QMakePackage.install`
1. :py:meth:`~.QMakeBuilder.PackageWrapper.qmake`
2. :py:meth:`~.QMakeBuilder.PackageWrapper.build`
3. :py:meth:`~.QMakeBuilder.PackageWrapper.install`
They all have sensible defaults and for many packages the only thing
necessary will be to override :py:meth:`~.QMakePackage.qmake_args`.
necessary will be to override :py:meth:`~.QMakeBuilder.PackageWrapper.qmake_args`.
"""
#: This attribute is used in UI queries that need to know the build
#: system base class
Expand All @@ -42,7 +42,7 @@ class QMakePackage(spack.package.PackageBase):
class QMakeBuilder(spack.builder.Builder):
phases = ('qmake', 'build', 'install')

class QMakeWrapper(spack.builder.BuildWrapper):
class PackageWrapper(spack.builder.BuildWrapper):
#: Callback names for build-time test
build_time_test_callbacks = ['check']

Expand Down
4 changes: 2 additions & 2 deletions lib/spack/spack/build_systems/ruby.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class RubyPackage(spack.package.PackageBase):
This class provides two phases that can be overridden if required:
#. :py:meth:`~.RubyPackage.build`
#. :py:meth:`~.RubyPackage.install`
#. :py:meth:`~.RubyBuilder.PackageWrapper.build`
#. :py:meth:`~.RubyBuilder.PackageWrapper.install`
"""

maintainers = ['Kerilk']
Expand Down

0 comments on commit 98a5f2f

Please sign in to comment.