package API v2.0: new repo layout (#49256)
This implements Package API v2.0, and is an opt-in feature for repos. It can be enabled with ```yaml repo: ... api: v2.0 ``` It differs from the current default v1.0 as follows: 1. Package names can only contain `-` as a separator. 2. Package names can only be lowercase. 3. Package directory names are valid Python module names. 4. The repo namespace and its directory name are the same. 5. The `packages` subdir, which is configurable, should be a directory name that is also a valid Python module name. 6. There is a one to one mapping between Spack package names and Python module names. 7. Import statements `import spack.pkg.namespace.package_module` in `package.py` files need to specify the canonical package module. To go from Spack package name to Python module name: - Replace `-` by `_` - Add a leading `_` if the package name starts with a digit To go from Python module name to Spack package name: - Strip leading `_` - Replace `_` by `-`.
This commit is contained in:
@@ -154,9 +154,7 @@ Package-related modules
|
||||
|
||||
:mod:`spack.util.naming`
|
||||
Contains functions for mapping between Spack package names,
|
||||
Python module names, and Python class names. Functions like
|
||||
:func:`~spack.util.naming.mod_to_class` handle mapping package
|
||||
module names to class names.
|
||||
Python module names, and Python class names.
|
||||
|
||||
:mod:`spack.directives`
|
||||
*Directives* are functions that can be called inside a package definition
|
||||
|
Reference in New Issue
Block a user