installation_instruction.helpers
Attributes
Functions
|
Checks if the given URL might be a remote git repository. |
|
Clones a git repository to a temporary directory. |
|
Checks if the file install.cfg is in the folder. |
Replaces `&& ` with a newline character. |
|
|
Parses error message of error given by using jinja macro RAISE_JINJA_MACRO_STRING. If no error message is found returns None. |
Replaces eol and whitespaces of a string with a single whitespace. |
|
|
Extracts part before and after the delimiter "------" or more. |
|
Returns jinja2.Template. |
Module Contents
- installation_instruction.helpers.CONFIG_FILE_NAME = 'install.cfg'
- installation_instruction.helpers.ALLOWED_GIT_URL_PREFIXES = ['http://', 'https://', 'git://', 'ssh://', 'ftp://', 'ftps://']
- installation_instruction.helpers._is_remote_git_repository(url: str) bool
Checks if the given URL might be a remote git repository.
todo: Make this more robust. Check if it is actually a valid git repository by calling it.
- Parameters:
url (str) – URL to be checked.
- Returns:
True if the URL is a remote git repository, else False.
- Return type:
bool
- installation_instruction.helpers._clone_git_repo(url: str) tempfile.TemporaryDirectory
Clones a git repository to a temporary directory.
- Parameters:
url (str) – URL of the remote git repository.
- Returns:
TemporaryDirectory object with git repo.
- Return type:
tempfile.TemporaryDirectory
- installation_instruction.helpers._config_file_is_in_folder(dir_path: str) str | None
Checks if the file install.cfg is in the folder.
- Parameters:
dir_path (str) – Path to the folder.
- Returns:
Path to the install.cfg file if it exists, else None.
- Return type:
str or None
- installation_instruction.helpers._make_pretty_print_line_breaks(string: str) str
Replaces `&& ` with a newline character.
- Parameters:
string (str) – String to be processed.
- Returns:
String with `&& ` replaced with newline character.
- Return type:
str
- installation_instruction.helpers._get_error_message_from_string(string: str) str | None
Parses error message of error given by using jinja macro RAISE_JINJA_MACRO_STRING. If no error message is found returns None.
- Parameters:
string (str) – This is the raw error string where an error message might be.
- Returns:
Error message if found else None.
- Rtpye:
str or None
- installation_instruction.helpers._replace_whitespace_in_string(string: str) str
Replaces eol and whitespaces of a string with a single whitespace.
- Parameters:
string (str) – String to be processed.
- Returns:
String where whitespace and eol is replaced with one whitespace and whitspace before and after are stripped.
- Return type:
str
- installation_instruction.helpers._split_string_at_delimiter(string: str) tuple[str, str]
Extracts part before and after the delimiter “——” or more.
- Parameters:
string (str) – The string with a delimiter.
- Raises:
Exception – If no delimiter is found.
- Returns:
Returns a tuple with the part before and after the delimiter.
- Return type:
tuple[str, str]
- installation_instruction.helpers._load_template_from_string(string: str) jinja2.Template
Returns jinja2.Template.
- Parameters:
string (str) – String to be processed.
- Returns:
jinja2 Template object.
- Return type:
jinja2.Template