kodi
Public Member Functions | Public Attributes | List of all members
lib.version_check.distro.distro.LinuxDistribution Class Reference
Inheritance diagram for lib.version_check.distro.distro.LinuxDistribution:
Inheritance graph
[legend]
Collaboration diagram for lib.version_check.distro.distro.LinuxDistribution:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, include_lsb=True, os_release_file='', distro_release_file='', include_uname=True)
 
def __repr__ (self)
 
def linux_distribution (self, full_distribution_name=True)
 
def id (self)
 
def name (self, pretty=False)
 
def version (self, pretty=False, best=False)
 
def version_parts (self, best=False)
 
def major_version (self, best=False)
 
def minor_version (self, best=False)
 
def build_number (self, best=False)
 
def like (self)
 
def codename (self)
 
def info (self, pretty=False, best=False)
 
def os_release_info (self)
 
def lsb_release_info (self)
 
def distro_release_info (self)
 
def uname_info (self)
 
def os_release_attr (self, attribute)
 
def lsb_release_attr (self, attribute)
 
def distro_release_attr (self, attribute)
 
def uname_attr (self, attribute)
 

Public Attributes

 os_release_file
 
 distro_release_file
 
 include_lsb
 
 include_uname
 

Detailed Description

Provides information about a OS distribution.

This package creates a private module-global instance of this class with
default initialization arguments, that is used by the
`consolidated accessor functions`_ and `single source accessor functions`_.
By using default initialization arguments, that module-global instance
returns data about the current OS distribution (i.e. the distro this
package runs on).

Normally, it is not necessary to create additional instances of this class.
However, in situations where control is needed over the exact data sources
that are used, instances of this class can be created with a specific
distro release file, or a specific os-release file, or without invoking the
lsb_release command.

Constructor & Destructor Documentation

◆ __init__()

def lib.version_check.distro.distro.LinuxDistribution.__init__ (   self,
  include_lsb = True,
  os_release_file = '',
  distro_release_file = '',
  include_uname = True 
)
The initialization method of this class gathers information from the
available data sources, and stores that in private instance attributes.
Subsequent access to the information items uses these private instance
attributes, so that the data sources are read only once.

Parameters:

* ``include_lsb`` (bool): Controls whether the
  `lsb_release command output`_ is included as a data source.

  If the lsb_release command is not available in the program execution
  path, the data source for the lsb_release command will be empty.

* ``os_release_file`` (string): The path name of the
  `os-release file`_ that is to be used as a data source.

  An empty string (the default) will cause the default path name to
  be used (see `os-release file`_ for details).

  If the specified or defaulted os-release file does not exist, the
  data source for the os-release file will be empty.

* ``distro_release_file`` (string): The path name of the
  `distro release file`_ that is to be used as a data source.

  An empty string (the default) will cause a default search algorithm
  to be used (see `distro release file`_ for details).

  If the specified distro release file does not exist, or if no default
  distro release file can be found, the data source for the distro
  release file will be empty.

* ``include_name`` (bool): Controls whether uname command output is
  included as a data source. If the uname command is not available in
  the program execution path the data source for the uname command will
  be empty.

Public instance attributes:

* ``os_release_file`` (string): The path name of the
  `os-release file`_ that is actually used as a data source. The
  empty string if no distro release file is used as a data source.

* ``distro_release_file`` (string): The path name of the
  `distro release file`_ that is actually used as a data source. The
  empty string if no distro release file is used as a data source.

* ``include_lsb`` (bool): The result of the ``include_lsb`` parameter.
  This controls whether the lsb information will be loaded.

* ``include_uname`` (bool): The result of the ``include_uname``
  parameter. This controls whether the uname information will
  be loaded.

Raises:

* :py:exc:`IOError`: Some I/O issue with an os-release file or distro
  release file.

* :py:exc:`subprocess.CalledProcessError`: The lsb_release command had
  some issue (other than not being available in the program execution
  path).

* :py:exc:`UnicodeError`: A data source has unexpected characters or
  uses an unexpected encoding.

Member Function Documentation

◆ __repr__()

def lib.version_check.distro.distro.LinuxDistribution.__repr__ (   self)
Return repr of all info

◆ build_number()

def lib.version_check.distro.distro.LinuxDistribution.build_number (   self,
  best = False 
)
Return the build number of the current distribution.

For details, see :func:`distro.build_number`.

◆ codename()

def lib.version_check.distro.distro.LinuxDistribution.codename (   self)
Return the codename of the OS distribution.

For details, see :func:`distro.codename`.

◆ distro_release_attr()

def lib.version_check.distro.distro.LinuxDistribution.distro_release_attr (   self,
  attribute 
)
Return a single named information item from the distro release file
data source of the OS distribution.

For details, see :func:`distro.distro_release_attr`.

◆ distro_release_info()

def lib.version_check.distro.distro.LinuxDistribution.distro_release_info (   self)
Return a dictionary containing key-value pairs for the information
items from the distro release file data source of the OS
distribution.

For details, see :func:`distro.distro_release_info`.

◆ id()

def lib.version_check.distro.distro.LinuxDistribution.id (   self)
Return the distro ID of the OS distribution, as a string.

For details, see :func:`distro.id`.

◆ info()

def lib.version_check.distro.distro.LinuxDistribution.info (   self,
  pretty = False,
  best = False 
)
Return certain machine-readable information about the OS
distribution.

For details, see :func:`distro.info`.

◆ like()

def lib.version_check.distro.distro.LinuxDistribution.like (   self)
Return the IDs of distributions that are like the OS distribution.

For details, see :func:`distro.like`.

◆ linux_distribution()

def lib.version_check.distro.distro.LinuxDistribution.linux_distribution (   self,
  full_distribution_name = True 
)
Return information about the OS distribution that is compatible
with Python's :func:`platform.linux_distribution`, supporting a subset
of its parameters.

For details, see :func:`distro.linux_distribution`.

◆ lsb_release_attr()

def lib.version_check.distro.distro.LinuxDistribution.lsb_release_attr (   self,
  attribute 
)
Return a single named information item from the lsb_release command
output data source of the OS distribution.

For details, see :func:`distro.lsb_release_attr`.

◆ lsb_release_info()

def lib.version_check.distro.distro.LinuxDistribution.lsb_release_info (   self)
Return a dictionary containing key-value pairs for the information
items from the lsb_release command data source of the OS
distribution.

For details, see :func:`distro.lsb_release_info`.

◆ major_version()

def lib.version_check.distro.distro.LinuxDistribution.major_version (   self,
  best = False 
)
Return the major version number of the current distribution.

For details, see :func:`distro.major_version`.

◆ minor_version()

def lib.version_check.distro.distro.LinuxDistribution.minor_version (   self,
  best = False 
)
Return the minor version number of the current distribution.

For details, see :func:`distro.minor_version`.

◆ name()

def lib.version_check.distro.distro.LinuxDistribution.name (   self,
  pretty = False 
)
Return the name of the OS distribution, as a string.

For details, see :func:`distro.name`.

◆ os_release_attr()

def lib.version_check.distro.distro.LinuxDistribution.os_release_attr (   self,
  attribute 
)
Return a single named information item from the os-release file data
source of the OS distribution.

For details, see :func:`distro.os_release_attr`.

◆ os_release_info()

def lib.version_check.distro.distro.LinuxDistribution.os_release_info (   self)
Return a dictionary containing key-value pairs for the information
items from the os-release file data source of the OS distribution.

For details, see :func:`distro.os_release_info`.

◆ uname_attr()

def lib.version_check.distro.distro.LinuxDistribution.uname_attr (   self,
  attribute 
)
Return a single named information item from the uname command
output data source of the OS distribution.

For details, see :func:`distro.uname_release_attr`.

◆ uname_info()

def lib.version_check.distro.distro.LinuxDistribution.uname_info (   self)
Return a dictionary containing key-value pairs for the information
items from the uname command data source of the OS distribution.

For details, see :func:`distro.uname_info`.

◆ version()

def lib.version_check.distro.distro.LinuxDistribution.version (   self,
  pretty = False,
  best = False 
)
Return the version of the OS distribution, as a string.

For details, see :func:`distro.version`.

◆ version_parts()

def lib.version_check.distro.distro.LinuxDistribution.version_parts (   self,
  best = False 
)
Return the version of the OS distribution, as a tuple of version
numbers.

For details, see :func:`distro.version_parts`.

The documentation for this class was generated from the following file: