![]() |
Qucs-S S-parameter Viewer & RF Synthesis Tools
|
Public Member Functions | |
| None | __init__ (self, Optional[bool] include_lsb=None, str os_release_file="", str distro_release_file="", Optional[bool] include_uname=None, Optional[str] root_dir=None, Optional[bool] include_oslevel=None) |
| str | __repr__ (self) |
| Tuple[str, str, str] | linux_distribution (self, bool full_distribution_name=True) |
| str | id (self) |
| str | name (self, bool pretty=False) |
| str | version (self, bool pretty=False, bool best=False) |
| Tuple[str, str, str] | version_parts (self, bool best=False) |
| str | major_version (self, bool best=False) |
| str | minor_version (self, bool best=False) |
| str | build_number (self, bool best=False) |
| str | like (self) |
| str | codename (self) |
| InfoDict | info (self, bool pretty=False, bool best=False) |
| Dict[str, str] | os_release_info (self) |
| Dict[str, str] | lsb_release_info (self) |
| Dict[str, str] | distro_release_info (self) |
| Dict[str, str] | uname_info (self) |
| str | oslevel_info (self) |
| str | os_release_attr (self, str attribute) |
| str | lsb_release_attr (self, str attribute) |
| str | distro_release_attr (self, str attribute) |
| str | uname_attr (self, str attribute) |
Public Attributes | |
| root_dir | |
| etc_dir | |
| usr_lib_dir | |
| os_release_file | |
| distro_release_file | |
| include_lsb | |
| include_uname | |
| include_oslevel | |
Protected Member Functions | |
| Dict[str, str] | _os_release_info (self) |
| Dict[str, str] | _lsb_release_info (self) |
| Dict[str, str] | _uname_info (self) |
| str | _oslevel_info (self) |
| str | _debian_version (self) |
| Dict[str, str] | _distro_release_info (self) |
| Dict[str, str] | _parse_distro_release_file (self, str filepath) |
Static Protected Member Functions | |
| Dict[str, str] | _parse_os_release_content (TextIO lines) |
| Dict[str, str] | _parse_lsb_release_content (Iterable[str] lines) |
| Dict[str, str] | _parse_uname_content (Sequence[str] lines) |
| str | _to_str (bytes bytestring) |
| Dict[str, str] | _parse_distro_release_content (str line) |
Protected Attributes | |
| _debian_version | |
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.
| None pip._vendor.distro.distro.LinuxDistribution.__init__ | ( | self, | |
| Optional[bool] | include_lsb = None, |
||
| str | os_release_file = "", |
||
| str | distro_release_file = "", |
||
| Optional[bool] | include_uname = None, |
||
| Optional[str] | root_dir = None, |
||
| Optional[bool] | include_oslevel = None |
||
| ) |
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. * ``root_dir`` (string): The absolute path to the root directory to use to find distro-related information files. Note that ``include_*`` parameters must not be enabled in combination with ``root_dir``. * ``include_oslevel`` (bool): Controls whether (AIX) oslevel command output is included as a data source. If the oslevel command is not available in the program execution path the data source 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. * ``include_oslevel`` (bool): The result of the ``include_oslevel`` parameter. This controls whether (AIX) oslevel information will be loaded. * ``root_dir`` (string): The result of the ``root_dir`` parameter. The absolute path to the root directory to use to find distro-related information files. Raises: * :py:exc:`ValueError`: Initialization parameters combination is not supported. * :py:exc:`OSError`: Some I/O issue with an os-release file or distro release file. * :py:exc:`UnicodeError`: A data source has unexpected characters or uses an unexpected encoding.
| str pip._vendor.distro.distro.LinuxDistribution.__repr__ | ( | self | ) |
Return repr of all info
|
protected |
Get the information items from the specified distro release file.
Returns:
A dictionary containing all information items.
|
protected |
Get the information items from the lsb_release command output.
Returns:
A dictionary containing all information items.
|
protected |
Get the information items from the specified os-release file.
Returns:
A dictionary containing all information items.
|
staticprotected |
Parse a line from a distro release file.
Parameters:
* line: Line from the distro release file. Must be a unicode string
or a UTF-8 encoded byte string.
Returns:
A dictionary containing all information items.
|
protected |
Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items.
|
staticprotected |
Parse the output of the lsb_release command.
Parameters:
* lines: Iterable through the lines of the lsb_release output.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A dictionary containing all information items.
|
staticprotected |
Parse the lines of an os-release file.
Parameters:
* lines: Iterable through the lines in the os-release file.
Each line must be a unicode string or a UTF-8 encoded byte
string.
Returns:
A dictionary containing all information items.
| str pip._vendor.distro.distro.LinuxDistribution.build_number | ( | self, | |
| bool | best = False |
||
| ) |
Return the build number of the current distribution. For details, see :func:`distro.build_number`.
| str pip._vendor.distro.distro.LinuxDistribution.codename | ( | self | ) |
Return the codename of the OS distribution. For details, see :func:`distro.codename`.
| str pip._vendor.distro.distro.LinuxDistribution.distro_release_attr | ( | self, | |
| str | 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`.
| Dict[str, str] pip._vendor.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`.
| str pip._vendor.distro.distro.LinuxDistribution.id | ( | self | ) |
Return the distro ID of the OS distribution, as a string. For details, see :func:`distro.id`.
| InfoDict pip._vendor.distro.distro.LinuxDistribution.info | ( | self, | |
| bool | pretty = False, |
||
| bool | best = False |
||
| ) |
Return certain machine-readable information about the OS distribution. For details, see :func:`distro.info`.
| str pip._vendor.distro.distro.LinuxDistribution.like | ( | self | ) |
Return the IDs of distributions that are like the OS distribution. For details, see :func:`distro.like`.
| Tuple[str, str, str] pip._vendor.distro.distro.LinuxDistribution.linux_distribution | ( | self, | |
| bool | 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`.
| str pip._vendor.distro.distro.LinuxDistribution.lsb_release_attr | ( | self, | |
| str | 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`.
| Dict[str, str] pip._vendor.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`.
| str pip._vendor.distro.distro.LinuxDistribution.major_version | ( | self, | |
| bool | best = False |
||
| ) |
Return the major version number of the current distribution. For details, see :func:`distro.major_version`.
| str pip._vendor.distro.distro.LinuxDistribution.minor_version | ( | self, | |
| bool | best = False |
||
| ) |
Return the minor version number of the current distribution. For details, see :func:`distro.minor_version`.
| str pip._vendor.distro.distro.LinuxDistribution.name | ( | self, | |
| bool | pretty = False |
||
| ) |
Return the name of the OS distribution, as a string. For details, see :func:`distro.name`.
| str pip._vendor.distro.distro.LinuxDistribution.os_release_attr | ( | self, | |
| str | 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`.
| Dict[str, str] pip._vendor.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`.
| str pip._vendor.distro.distro.LinuxDistribution.oslevel_info | ( | self | ) |
Return AIX' oslevel command output.
| str pip._vendor.distro.distro.LinuxDistribution.uname_attr | ( | self, | |
| str | attribute | ||
| ) |
Return a single named information item from the uname command output data source of the OS distribution. For details, see :func:`distro.uname_attr`.
| Dict[str, str] pip._vendor.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`.
| str pip._vendor.distro.distro.LinuxDistribution.version | ( | self, | |
| bool | pretty = False, |
||
| bool | best = False |
||
| ) |
Return the version of the OS distribution, as a string. For details, see :func:`distro.version`.
| Tuple[str, str, str] pip._vendor.distro.distro.LinuxDistribution.version_parts | ( | self, | |
| bool | best = False |
||
| ) |
Return the version of the OS distribution, as a tuple of version numbers. For details, see :func:`distro.version_parts`.