summaryrefslogtreecommitdiff
path: root/lib/spack/docs/build_systems/pythonpackage.rst
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/docs/build_systems/pythonpackage.rst')
-rw-r--r--lib/spack/docs/build_systems/pythonpackage.rst62
1 files changed, 31 insertions, 31 deletions
diff --git a/lib/spack/docs/build_systems/pythonpackage.rst b/lib/spack/docs/build_systems/pythonpackage.rst
index 17295a457f..168ff5dc88 100644
--- a/lib/spack/docs/build_systems/pythonpackage.rst
+++ b/lib/spack/docs/build_systems/pythonpackage.rst
@@ -152,16 +152,16 @@ set. Once set, ``pypi`` will be used to define the ``homepage``,
.. code-block:: python
- homepage = 'https://pypi.org/project/setuptools/'
- url = 'https://pypi.org/packages/source/s/setuptools/setuptools-49.2.0.zip'
- list_url = 'https://pypi.org/simple/setuptools/'
+ homepage = "https://pypi.org/project/setuptools/"
+ url = "https://pypi.org/packages/source/s/setuptools/setuptools-49.2.0.zip"
+ list_url = "https://pypi.org/simple/setuptools/"
is equivalent to:
.. code-block:: python
- pypi = 'setuptools/setuptools-49.2.0.zip'
+ pypi = "setuptools/setuptools-49.2.0.zip"
If a package has a different homepage listed on PyPI, you can
@@ -208,7 +208,7 @@ dependencies to your package:
.. code-block:: python
- depends_on('py-setuptools@42:', type='build')
+ depends_on("py-setuptools@42:", type="build")
Note that ``py-wheel`` is already listed as a build dependency in the
@@ -232,7 +232,7 @@ Look for dependencies under the following keys:
* ``dependencies`` under ``[project]``
These packages are required for building and installation. You can
- add them with ``type=('build', 'run')``.
+ add them with ``type=("build", "run")``.
* ``[project.optional-dependencies]``
@@ -279,12 +279,12 @@ distutils library, and has almost the exact same API. In addition to
* ``setup_requires``
These packages are usually only needed at build-time, so you can
- add them with ``type='build'``.
+ add them with ``type="build"``.
* ``install_requires``
These packages are required for building and installation. You can
- add them with ``type=('build', 'run')``.
+ add them with ``type=("build", "run")``.
* ``extras_require``
@@ -296,7 +296,7 @@ distutils library, and has almost the exact same API. In addition to
These are packages that are required to run the unit tests for the
package. These dependencies can be specified using the
- ``type='test'`` dependency type. However, the PyPI tarballs rarely
+ ``type="test"`` dependency type. However, the PyPI tarballs rarely
contain unit tests, so there is usually no reason to add these.
See https://setuptools.pypa.io/en/latest/userguide/dependency_management.html
@@ -321,7 +321,7 @@ older versions of flit may use the following keys:
* ``requires`` under ``[tool.flit.metadata]``
These packages are required for building and installation. You can
- add them with ``type=('build', 'run')``.
+ add them with ``type=("build", "run")``.
* ``[tool.flit.metadata.requires-extra]``
@@ -434,12 +434,12 @@ the BLAS/LAPACK library you want pkg-config to search for:
.. code-block:: python
- depends_on('py-pip@22.1:', type='build')
+ depends_on("py-pip@22.1:", type="build")
def config_settings(self, spec, prefix):
return {
- 'blas': spec['blas'].libs.names[0],
- 'lapack': spec['lapack'].libs.names[0],
+ "blas": spec["blas"].libs.names[0],
+ "lapack": spec["lapack"].libs.names[0],
}
@@ -463,10 +463,10 @@ has an optional dependency on ``libyaml`` that can be enabled like so:
def global_options(self, spec, prefix):
options = []
- if '+libyaml' in spec:
- options.append('--with-libyaml')
+ if spec.satisfies("+libyaml"):
+ options.append("--with-libyaml")
else:
- options.append('--without-libyaml')
+ options.append("--without-libyaml")
return options
@@ -492,10 +492,10 @@ allows you to specify the directories to search for ``libyaml``:
def install_options(self, spec, prefix):
options = []
- if '+libyaml' in spec:
+ if spec.satisfies("+libyaml"):
options.extend([
- spec['libyaml'].libs.search_flags,
- spec['libyaml'].headers.include_flags,
+ spec["libyaml"].libs.search_flags,
+ spec["libyaml"].headers.include_flags,
])
return options
@@ -556,7 +556,7 @@ detected are wrong, you can provide the names yourself by overriding
.. code-block:: python
- import_modules = ['six']
+ import_modules = ["six"]
Sometimes the list of module names to import depends on how the
@@ -571,9 +571,9 @@ This can be expressed like so:
@property
def import_modules(self):
- modules = ['yaml']
- if '+libyaml' in self.spec:
- modules.append('yaml.cyaml')
+ modules = ["yaml"]
+ if self.spec.satisfies("+libyaml"):
+ modules.append("yaml.cyaml")
return modules
@@ -586,14 +586,14 @@ Instead of defining the ``import_modules`` explicitly, only the subset
of module names to be skipped can be defined by using ``skip_modules``.
If a defined module has submodules, they are skipped as well, e.g.,
in case the ``plotting`` modules should be excluded from the
-automatically detected ``import_modules`` ``['nilearn', 'nilearn.surface',
-'nilearn.plotting', 'nilearn.plotting.data']`` set:
+automatically detected ``import_modules`` ``["nilearn", "nilearn.surface",
+"nilearn.plotting", "nilearn.plotting.data"]`` set:
.. code-block:: python
- skip_modules = ['nilearn.plotting']
+ skip_modules = ["nilearn.plotting"]
-This will set ``import_modules`` to ``['nilearn', 'nilearn.surface']``
+This will set ``import_modules`` to ``["nilearn", "nilearn.surface"]``
Import tests can be run during the installation using ``spack install
--test=root`` or at any time after the installation using
@@ -612,11 +612,11 @@ after the ``install`` phase:
.. code-block:: python
- @run_after('install')
+ @run_after("install")
@on_package_attributes(run_tests=True)
def install_test(self):
- with working_dir('spack-test', create=True):
- python('-c', 'import numpy; numpy.test("full", verbose=2)')
+ with working_dir("spack-test", create=True):
+ python("-c", "import numpy; numpy.test('full', verbose=2)")
when testing is enabled during the installation (i.e., ``spack install
@@ -638,7 +638,7 @@ provides Python bindings in a ``python`` directory, you can use:
.. code-block:: python
- build_directory = 'python'
+ build_directory = "python"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^