Caution

This API is not finalised, and may change in a patch version.

installer.scripts

Provides the ability to generate executable launcher scripts, that are based on simple_launcher. A description of how these scripts work is available in simple_launcher’s README.

class installer.scripts.InvalidScript

Raised if the user provides incorrect script section or kind.

classmethod __new__(*args, **kwargs)
__init__(*args, **kwargs)
class installer.scripts.Script

Describes a script based on an entry point declaration.

name: str

Name of the script.

module: str

Module path, to load the entry point from.

attr: str

Final attribute access, for the entry point.

section: ScriptSection

Denotes the “entry point section” where this was specified. Valid values are "gui" and "console".

__init__(name, module, attr, section)
Parameters:
  • name (str)

  • module (str)

  • attr (str)

  • section (ScriptSection)

Return type:

None

generate(executable, kind)

Generate a launcher for this script.

Parameters:
  • executable (str) – Path to the executable to invoke.

  • kind (str) – Which launcher template should be used. Valid values are "posix", "win-ia32", "win-amd64" and "win-arm".

Raises:

InvalidScript – if no appropriate template is available.

Returns:

The name and contents of the launcher file.

Return type:

tuple[str, bytes]