mod eb_easyblock

module eb_easyblock

Which easyblock class EasyBuild will look for, given a software name.

An easyconfig that names no easyblock is not asking for a default. There is no default: EasyBuild derives a class name from the software name, tries to import it, and stops with No software-specific easyblock ‘<class>’ found for <name> when it cannot. So the derived name is the difference between a recipe that installs and a recipe that refuses to start, and it is worth being able to compute without a Python interpreter to hand.

The rule mirrors easybuild.tools.filetools: encode_class_name is EASYBLOCK_CLASS_PREFIX followed by encode_string, and encode_string substitutes each character through a fixed map, passing anything unmapped through unchanged.

Two properties of that map are easy to get wrong. _ is itself escaped, to _underscore_, which is what keeps the encoding reversible. And the substitution is per character with no collapsing, so a doubled separator doubles: c++ becomes EB_c_plus__plus_.

Variables

const EASYBLOCK_CLASS_PREFIX: &str

Prefix EasyBuild puts on a derived easyblock class name.

EASYBLOCK_CLASS_PREFIX in easybuild.tools.filetools.

const STRING_ENCODING_CHARMAP: &[(&str, &str)]

Substitutions applied to a software name.

STRING_ENCODING_CHARMAP in easybuild.tools.filetools. The keys are the dict keys as Python stores them. r'\'' and r'\\' are the two-character strings \' and \\, not the apostrophe and the backslash. encode_string looks each character up on its own, so those two keys are never selected and ' and \ pass through. Characters absent from this table pass through as well, so letters and digits survive intact.

const STRING_ENCODING_CHARMAP_COUNT: usize

How many substitutions the table carries, for a coverage assertion.

Functions

fn charmap_document() -> serde_json::Value

The encoding table as the JSON document recipe easyblock --charmap prints.

fn decode_class_name(class_name: &str) -> String

Recover the software name from an encoded class name.

decode_class_name in easybuild.tools.filetools. A name without the prefix is returned unchanged, since it was never encoded.

fn decode_string(encoded: &str) -> String

Reverse the encoding map.

Longest-match first, because _underscore_ and _ share a prefix and taking the shorter one first would strand the rest of the token.

fn defined_classes(source: &str, path: &str) -> Result<Vec<EasyblockClass>, String>

Classes an easyblock module defines, read from its syntax tree.

EasyBuild imports the module and looks a class up by name, so only top-level class statements count. The file is parsed, never executed. extra_options keys are the string keys of the dict literals in that method’s body, which is how every easyblock in the framework declares them.

fn easyblock_letter_dir(filename: &str) -> String

The directory EasyBuild’s own easyblocks package keeps a module in.

easybuild/easyblocks/<letter>/<module>.py, with the letter taken from the module filename; --include-easyblocks does not need the layout, but an easyblocks PR does, and a bundle that already has it can be diffed against one.

fn encode_class_name(name: &str) -> String

The easyblock class name EasyBuild derives for name.

This says what EasyBuild will look for, not that it exists. A name that has no such class is the case where EasyBuild stops rather than falling back to a generic easyblock.

fn encode_string(name: &str) -> String

Substitute a software name through the encoding map.

encode_string in easybuild.tools.filetools.

fn index_easyblocks(roots: &[&std::path::Path]) -> Result<std::collections::BTreeMap<String, (std::path::PathBuf, EasyblockClass)>, String>

Where each easyblock class is defined, across trees of .py files.

Roots are searched in order and the first definition of a name wins, which is the precedence --include-easyblocks gives files over the installed package. A file that does not parse is reported rather than skipped: an easyblock EasyBuild cannot import is a build failure waiting to happen.

Structs and Unions

struct EasyblockClass

A class an easyblock module defines at top level.

name: String

Class name, e.g. EB_SeisSol.

bases: Vec<String>

Base classes as written, e.g. CMakeMake.

extra_options: Vec<String>

Easyconfig parameters the class adds in extra_options, in source order.