|
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) |
|
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.
def __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_uname`` (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.