Macro helper module

class rebasehelper.helpers.macro_helper.MacroHelper[source]

Class for working with RPM macros

MACROS_WHITELIST = ['_bindir', '_datadir', '_includedir', '_infodir', '_initdir', '_libdir', '_libexecdir', '_localstatedir', '_mandir', '_sbindir', '_sharedstatedir', '_sysconfdir', 'python2_sitelib', 'python3_sitelib']
static dump()[source]

Gets list of all defined macros.

Returns:All defined macros.
Return type:list
static expand(s, default=None, suppress_errors=False)[source]
classmethod expand_macros(macros)[source]

Expands values of multiple macros.

Parameters:macros (list) – List of macros to be expanded, macros are represented as dicts.
Returns:List of macros with expanded values.
Return type:list
static filter(macros, **kwargs)[source]

Finds all macros satisfying certain conditions.

Parameters:
  • macros (list) – Macros to be filtered.
  • **kwargs – Filters to be used.
Returns:

Macros satisfying the conditions.

Return type:

list

classmethod purge_macro(macro: str) → None[source]
static substitute_path_with_macros(path, macros)[source]

Substitutes parts of a path with macros.

Parameters:
  • path (str) – Path to be changed.
  • macros (list) – Macros which can be used as a substitution.
Returns:

Path expressed using macros.

Return type:

str