SPPAS 4.22

https://sppas.org/

Module sppas.preinstall

Class sppasInstallerDeps

Description

Main class to manage the installation of external features.

sppasInstallerDeps is a wrapper of an Installer Object.

It allows to:

  • launch the installation process
  • get information, which are important for the users, about the pre-installation
  • configure parameters to get a personalized installation
Example
 >>> installer = sppasInstallerDeps()

See if a feature is available or not:

Example
 >>> installer.available("feature_id")
 >>> True

Customize what is enabled or not:

Example
 >>> installer.enable("feature_id")
 >>> False
 >>> installer.enable("feature_id", True)
 >>> True

Launch the installation process:

Example
 >>> errors = installer.install("feature_id")
 >>> assert len(errors) == 0
 >>> assert installer.available("feature_id") is True

Constructor

Instantiate the appropriate installer depending on the OS.

Parameters
  • progress: (ProcessProgressTerminal|None) The installation progress
Raises
  • OSError: Not supported OS for the automatic installer
View Source
def __init__(self, progress=None):
    """Instantiate the appropriate installer depending on the OS.

    :param progress: (ProcessProgressTerminal|None) The installation progress
    :raises: OSError: Not supported OS for the automatic installer

    """
    system = sys.platform
    logging.info('Operating system: {}'.format(system))
    system_installer = sppasGuessInstaller.guess(system)
    if system_installer is None:
        raise sppasSystemOSError('system')
    self.__installer = system_installer()
    logging.info('System installer: {}'.format(self.__installer.__class__.__name__))
    if progress is not None:
        self.__installer.set_progress(progress)

Public functions

set_progress

View Source
def set_progress(self, progress=None):
    self.__installer.set_progress(progress)

features_ids

Return the list of feature identifiers.

Parameters
  • feat_type: (str) Only return features of the given type.
Returns
  • (list)
View Source
def features_ids(self, feat_type=None):
    """Return the list of feature identifiers.

        :param feat_type: (str) Only return features of the given type.
        :return: (list)

        """
    return self.__installer.get_fids(feat_type)

feature_type

Return the feature type: deps, lang, annot.

Parameters
  • feat_id: (str) Identifier of a feature
Returns
  • (str) or None
View Source
def feature_type(self, feat_id):
    """Return the feature type: deps, lang, annot.

        :param feat_id: (str) Identifier of a feature
        :return: (str) or None

        """
    return self.__installer.feature_type(feat_id)

brief

Return the brief description of the feature.

Parameters
  • feat_id: (str) Identifier of a feature
View Source
def brief(self, feat_id):
    """Return the brief description of the feature.

        :param feat_id: (str) Identifier of a feature

        """
    return self.__installer.brief(feat_id)

description

Return the description of the feature.

Parameters
  • feat_id: (str) Identifier of a feature
View Source
def description(self, feat_id):
    """Return the description of the feature.

        :param feat_id: (str) Identifier of a feature

        """
    return self.__installer.description(feat_id)

available

Return True if the feature is available.

Parameters
  • feat_id: (str) Identifier of a feature
View Source
def available(self, feat_id):
    """Return True if the feature is available.

        :param feat_id: (str) Identifier of a feature

        """
    return self.__installer.available(feat_id)

enable

Return True if the feature is enabled and/or set it.

Parameters
  • fid: (str) Identifier of a feature
  • value: (bool | None) Enable of disable the feature.
View Source
def enable(self, fid, value=None):
    """Return True if the feature is enabled and/or set it.

        :param fid: (str) Identifier of a feature
        :param value: (bool | None) Enable of disable the feature.

        """
    if value is None:
        return self.__installer.enable(fid)
    return self.__installer.enable(fid, value)

install

Launch the installation process.

Returns
  • errors: (str) errors happening during installation.
Parameters
  • feat_type
View Source
def install(self, feat_type=None):
    """Launch the installation process.

        :return: errors: (str) errors happening during installation.

        """
    errors = self.__installer.install(feat_type)
    return errors