core.utilities module

Utility management.

There are now two seperate metadata systems:

  • the manifest system, which applies to each dir with a manifest (and subdirs)

  • the global system, which applies to everything else

Utilities are uniformly and uniquely identified by the relative path from LNP/Utilities/ to the executable file.

Metadata for each is found by looking back up the pach for a manifest, and in the global metadata if one is not found.

Utilities are found by walking down from the base dir.

For each dir, if a manifest is found it and all it’s subdirs are only analysed by the manifest system. See the README for how this works, and note that it is more structured as well as more powerful, slightly decreasing flexibility - for example mandating only one executable per platform, but specifying requirements for DFHack or a terminal.

Otherwise, each file (and on OSX, dir) is matched against standard patterns and user include patterns. Any matches that do not also match a user exclude pattern are added to the list of identified utilities. This global config is found in some combination of include.txt, exclude.txt, and uilities.txt.

core.utilities.any_match(filename, include, exclude)[source]

Return True if at least one pattern matches the filename, or False.

core.utilities.get_title(path)[source]

Returns a title for the given utility. If an non-blank override exists, it will be used; otherwise, the filename will be manipulated according to PyLNP.json settings.

core.utilities.get_tooltip(path)[source]

Returns the tooltip for the given utility, or an empty string.

core.utilities.load_autorun()[source]

Loads autorun settings.

core.utilities.manifest_for(path)[source]

Returns the JsonConfiguration from manifest for the given utility, or None if no manifest exists.

core.utilities.open_readme(path)[source]

Opens the readme associated with the utility <path>, if one exists. Returns False if no readme was found; otherwise True.

core.utilities.open_utils()[source]

Opens the utilities folder.

core.utilities.read_metadata()[source]

Read metadata from the utilities directory.

core.utilities.read_utilities()[source]

Returns a sorted list of utility programs.

core.utilities.read_utility_lists(path)[source]

Reads a list of filenames/tags from a utility list (e.g. include.txt).

Parameters

path – The file to read.

core.utilities.save_autorun()[source]

Saves autorun settings.

core.utilities.scan_manifest_dir(root)[source]

Yields the configured utility (or utilities) from root and subdirs.

core.utilities.scan_normal_dir(root, dirnames, filenames)[source]

Yields candidate utilities in the given root directory.

Allow for an include list of filenames that will be treated as valid utilities. Useful for e.g. Linux, where executables rarely have extensions. Also accepts glob patterns for filename (not path).

core.utilities.toggle_autorun(item)[source]

Toggles autorun for the specified item.

Parameters

item – the item to toggle autorun for.