From a28931b63923e0690b480b0c968e051b0c4c90fd Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 8 Jan 2024 15:37:40 -0800 Subject: [PATCH] Give easy instructions for small modifications to the default components. * Rename _LEAPP_DEFAULT_COMPONENTS to GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS (More descriptive name and no longer private) * Add instructions for modifying the default value of the component parameter to the get_leapp_packages and get_leapp_deps_packages docstrings --- repos/system_upgrade/common/libraries/rpms.py | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/repos/system_upgrade/common/libraries/rpms.py b/repos/system_upgrade/common/libraries/rpms.py index 968cab94ea..e9c7b7d7ec 100644 --- a/repos/system_upgrade/common/libraries/rpms.py +++ b/repos/system_upgrade/common/libraries/rpms.py @@ -37,9 +37,9 @@ class LeappComponents(object): } } -_LEAPP_DEFAULT_COMPONENTS = frozenset((LeappComponents.FRAMEWORK, - LeappComponents.REPOSITORY, - LeappComponents.TOOLS)) +GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS = frozenset((LeappComponents.FRAMEWORK, + LeappComponents.REPOSITORY, + LeappComponents.TOOLS)) def get_installed_rpms(): @@ -203,7 +203,7 @@ def _get_leapp_packages_of_type(major_version, component, type_='pkgs'): return sorted(res) -def get_leapp_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONENTS): +def get_leapp_packages(major_version=None, component=GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS): """ Get list of leapp packages. @@ -212,6 +212,15 @@ def get_leapp_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONENTS): :param component: a list or a single enum value specifying leapp components (use enum :class: LeappComponents) If defined then only packages related to the specific component(s) will be returned. + The default set of components is in `GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS` and + simple modifications of the default can be achieved with code like: + + .. code-block:: python + get_leapp_packages( + component=GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS.difference( + [LeappComponents.TOOLS] + )) + :raises ValueError: if a requested component or major_version doesn't exist. .. note:: @@ -224,7 +233,7 @@ def get_leapp_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONENTS): return _get_leapp_packages_of_type(major_version, component, type_="pkgs") -def get_leapp_dep_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONENTS): +def get_leapp_dep_packages(major_version=None, component=GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS): """ Get list of leapp dep metapackages. @@ -233,6 +242,14 @@ def get_leapp_dep_packages(major_version=None, component=_LEAPP_DEFAULT_COMPONEN :param component: a list or a single enum value specifying leapp components (use enum :class: LeappComponents) If defined then only packages related to the specific component(s) will be returned. + The default set of components is in `GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS` and + simple modifications of the default can be achieved with code like: + + .. code-block:: python + get_leapp_packages( + component=GET_LEAPP_PACKAGES_DEFAULT_COMPONENTS.difference( + [LeappComponents.TOOLS] + )) :raises ValueError: if a requested component or major_version doesn't exist. """ return _get_leapp_packages_of_type(major_version, component, type_="deps")