core.utilities module

Utility management.

There are now two separate 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 path 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 utilities.txt.

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

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


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


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


Loads autorun settings.


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


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


Opens the utilities folder.


Read metadata from the utilities directory.


Returns a sorted list of utility programs.


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


path – The file to read.


Saves autorun settings.


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).


Toggles autorun for the specified item.


item – the item to toggle autorun for.