stouputils.installer.common module#
Common functions used by the Linux and Windows installers modules.
- prompt_for_path(prompt_message: str, default_path: str) str [source]#
Prompt the user to override a default path.
- Parameters:
prompt_message (str) – The message to display to the user.
default_path (str) – The default path to suggest.
- Returns:
The path entered by the user, or the default path if they pressed Enter.
- Return type:
str
- ask_install_type(ask_global: int, default_local_path: str, default_global_path: str | None) Literal['g', 'l'] [source]#
Determine the installation type (global ‘g’ or local ‘l’) based on user input.
- Parameters:
ask_global (int) – 0 = ask, 1 = force global, 2 = force local.
default_local_path (str) – The default local path.
default_global_path (str | None) – The default global path (if applicable).
- Returns:
‘g’ for global install, ‘l’ for local install.
- Return type:
Literal[“g”, “l”]
Examples
> # Ask the user while providing default paths > install_choice: str = ask_install_type(0, f"{os.getcwd()}/MyProgram", "C:\Program Files\MyProgram") g > # Don't ask, force global > install_choice: str = ask_install_type(1, ...) g > # Don't ask, force local > install_choice: str = ask_install_type(2, ...) l