Spade
Mini Shell
| Directory:~$ /proc/self/root/lib/python2.7/site-packages/ |
| [Home] [System Details] [Kill Me] |
�
C`�^c@sdZddlZddlZddlZddlZddlZddlZddlZddlZej j
dd�ZdZidd6Z
idd6dd 6d
d6d
d6d
d
6Zid
d6Zejd�Zejd�ZdddeddfZed�Zd�Zed�Zeed�Zed�Zed�Zed�Zed�Zd�Zd�Zeed
�Z
d!�Z!d"�Z"d#�Z#d$�Z$d%�Z%d&�Z&d'�Z'd(�Z(d)e)fd*��YZ*d+e)fd,��YZ+e+�Z,d-�Z-e.d.kre-�ndS(/s
The ``distro`` package (``distro`` stands for Linux Distribution) provides
information about the Linux distribution it runs on, such as a reliable
machine-readable distro ID, or version information.
It is the recommended replacement for Python's original
:py:func:`platform.linux_distribution` function, but it provides much more
functionality. An alternative implementation became necessary because
Python
3.5 deprecated this function, and Python 3.8 will remove it altogether.
Its predecessor function :py:func:`platform.dist` was already
deprecated since Python 2.6 and will also be removed in Python 3.8.
Still, there are many cases in which access to OS distribution information
is needed. See `Python issue 1322
<https://bugs.python.org/issue1322>`_ for
more information.
i����NtUNIXCONFDIRs/etcs
os-releasetoracletoltenterpriseenterpriseastenterpriseenterpriseservertrheltredhatenterpriseworkstationtredhatenterpriseservertredhatenterprisecomputenodetredhatsA(?:[^)]*\)(.*)\()?
*(?:STL )?([\d.+\-a-z]*\d) *(?:esaeler
*)?(.+)s(\w+)[-_](release|version)$tdebian_versionslsb-releasesoem-releasessystem-releases
plesk-releasecCs
tj|�S(s
Return information about the current OS distribution as a tuple
``(id_name, version, codename)`` with items as follows:
* ``id_name``: If *full_distribution_name* is false, the result of
:func:`distro.id`. Otherwise, the result of :func:`distro.name`.
* ``version``: The result of :func:`distro.version`.
* ``codename``: The result of :func:`distro.codename`.
The interface of this function is compatible with the original
:py:func:`platform.linux_distribution` function, supporting a subset of
its parameters.
The data it returns may not exactly be the same, because it uses more
data
sources than the original function, and that may lead to different data
if
the OS distribution is not consistent across multiple data sources it
provides (there are indeed such distributions ...).
Another reason for differences is the fact that the :func:`distro.id`
method normalizes the distro ID string to a reliable machine-readable
value
for a number of popular OS distributions.
(t_distrotlinux_distribution(tfull_distribution_name((s*/usr/lib/python2.7/site-packages/distro.pyRdscCs
tj�S(sD
Return the distro ID of the current distribution, as a
machine-readable string.
For a number of OS distributions, the returned distro ID value is
*reliable*, in the sense that it is documented and that it does not
change
across releases of the distribution.
This package maintains the following reliable distro ID values:
============== =========================================
Distro ID Distribution
============== =========================================
"ubuntu" Ubuntu
"debian" Debian
"rhel" RedHat Enterprise Linux
"centos" CentOS
"fedora" Fedora
"sles" SUSE Linux Enterprise Server
"opensuse" openSUSE
"amazon" Amazon Linux
"arch" Arch Linux
"cloudlinux" CloudLinux OS
"exherbo" Exherbo Linux
"gentoo" GenToo Linux
"ibm_powerkvm" IBM PowerKVM
"kvmibm" KVM for IBM z Systems
"linuxmint" Linux Mint
"mageia" Mageia
"mandriva" Mandriva Linux
"parallels" Parallels
"pidora" Pidora
"raspbian" Raspbian
"oracle" Oracle Linux (and Oracle Enterprise Linux)
"scientific" Scientific Linux
"slackware" Slackware
"xenserver" XenServer
"openbsd" OpenBSD
"netbsd" NetBSD
"freebsd" FreeBSD
"midnightbsd" MidnightBSD
============== =========================================
If you have a need to get distros for reliable IDs added into this set,
or if you find that the :func:`distro.id` function returns a different
distro ID for one of the listed distros, please create an issue in the
`distro issue tracker`_.
**Lookup hierarchy and transformations:**
First, the ID is obtained from the following sources, in the specified
order. The first available and non-empty value is used:
* the value of the "ID" attribute of the os-release file,
* the value of the "Distributor ID" attribute returned by the
lsb_release
command,
* the first part of the file name of the distro release file,
The so determined ID value then passes the following transformations,
before it is returned by this method:
* it is translated to lower case,
* blanks (which should not be there anyway) are translated to
underscores,
* a normalization of the ID is performed, based upon
`normalization tables`_. The purpose of this normalization is to
ensure
that the ID is as reliable as possible, even across incompatible
changes
in the OS distributions. A common reason for an incompatible change
is
the addition of an os-release file, or the addition of the
lsb_release
command, with ID values that differ from what was previously
determined
from the distro release file name.
(Rtid(((s*/usr/lib/python2.7/site-packages/distro.pyR�sLcCs
tj|�S(sk
Return the name of the current OS distribution, as a human-readable
string.
If *pretty* is false, the name is returned without version or codename.
(e.g. "CentOS Linux")
If *pretty* is true, the version and codename are appended.
(e.g. "CentOS Linux 7.1.1503 (Core)")
**Lookup hierarchy:**
The name is obtained from the following sources, in the specified
order.
The first available and non-empty value is used:
* If *pretty* is false:
- the value of the "NAME" attribute of the os-release file,
- the value of the "Distributor ID" attribute returned by
the lsb_release
command,
- the value of the "<name>" field of the distro
release file.
* If *pretty* is true:
- the value of the "PRETTY_NAME" attribute of the
os-release file,
- the value of the "Description" attribute returned by the
lsb_release
command,
- the value of the "<name>" field of the distro
release file, appended
with the value of the pretty version
("<version_id>" and "<codename>"
fields) of the distro release file, if available.
(Rtname(tpretty((s*/usr/lib/python2.7/site-packages/distro.pyR�s$cCstj||�S(sv
Return the version of the current OS distribution, as a human-readable
string.
If *pretty* is false, the version is returned without codename (e.g.
"7.0").
If *pretty* is true, the codename in parenthesis is appended, if the
codename is non-empty (e.g. "7.0 (Maipo)").
Some distributions provide version numbers with different precisions in
the different sources of distribution information. Examining the
different
sources in a fixed priority order does not always yield the most
precise
version (e.g. for Debian 8.2, or CentOS 7.1).
The *best* parameter can be used to control the approach for the
returned
version:
If *best* is false, the first non-empty version number in priority
order of
the examined sources is returned.
If *best* is true, the most precise version number out of all examined
sources is returned.
**Lookup hierarchy:**
In all cases, the version number is obtained from the following
sources.
If *best* is false, this order represents the priority order:
* the value of the "VERSION_ID" attribute of the os-release
file,
* the value of the "Release" attribute returned by the
lsb_release
command,
* the version number parsed from the "<version_id>"
field of the first line
of the distro release file,
* the version number parsed from the "PRETTY_NAME" attribute
of the
os-release file, if it follows the format of the distro release
files.
* the version number parsed from the "Description" attribute
returned by
the lsb_release command, if it follows the format of the distro
release
files.
(Rtversion(Rtbest((s*/usr/lib/python2.7/site-packages/distro.pyR�s)cCs
tj|�S(s�
Return the version of the current OS distribution as a tuple
``(major, minor, build_number)`` with items as follows:
* ``major``: The result of :func:`distro.major_version`.
* ``minor``: The result of :func:`distro.minor_version`.
* ``build_number``: The result of :func:`distro.build_number`.
For a description of the *best* parameter, see the
:func:`distro.version`
method.
(Rt
version_parts(R((s*/usr/lib/python2.7/site-packages/distro.pyR"scCs
tj|�S(s5
Return the major version of the current OS distribution, as a string,
if provided.
Otherwise, the empty string is returned. The major version is the first
part of the dot-separated version string.
For a description of the *best* parameter, see the
:func:`distro.version`
method.
(Rt
major_version(R((s*/usr/lib/python2.7/site-packages/distro.pyR3s
cCs
tj|�S(s6
Return the minor version of the current OS distribution, as a string,
if provided.
Otherwise, the empty string is returned. The minor version is the
second
part of the dot-separated version string.
For a description of the *best* parameter, see the
:func:`distro.version`
method.
(Rt
minor_version(R((s*/usr/lib/python2.7/site-packages/distro.pyR@s
cCs
tj|�S(s3
Return the build number of the current OS distribution, as a string,
if provided.
Otherwise, the empty string is returned. The build number is the third
part
of the dot-separated version string.
For a description of the *best* parameter, see the
:func:`distro.version`
method.
(Rtbuild_number(R((s*/usr/lib/python2.7/site-packages/distro.pyRMs
cCs
tj�S(s
Return a space-separated list of distro IDs of distributions that are
closely related to the current OS distribution in regards to packaging
and programming interfaces, for example distributions the current
distribution is a derivative from.
**Lookup hierarchy:**
This information item is only provided by the os-release file.
For details, see the description of the "ID_LIKE" attribute
in the
`os-release man page
<http://www.freedesktop.org/software/systemd/man/os-release.html>`_.
(Rtlike(((s*/usr/lib/python2.7/site-packages/distro.pyRZscCs
tj�S(s�
Return the codename for the release of the current OS distribution,
as a string.
If the distribution does not have a codename, an empty string is
returned.
Note that the returned codename is not always really a codename. For
example, openSUSE returns "x86_64". This function does not
handle such
cases in any special way and just returns the string it finds, if any.
**Lookup hierarchy:**
* the codename within the "VERSION" attribute of the
os-release file, if
provided,
* the value of the "Codename" attribute returned by the
lsb_release
command,
* the value of the "<codename>" field of the distro
release file.
(Rtcodename(((s*/usr/lib/python2.7/site-packages/distro.pyRkscCstj||�S(s�
Return certain machine-readable information items about the current OS
distribution in a dictionary, as shown in the following example:
.. sourcecode:: python
{
'id': 'rhel',
'version': '7.0',
'version_parts': {
'major': '7',
'minor': '0',
'build_number': ''
},
'like': 'fedora',
'codename': 'Maipo'
}
The dictionary structure and keys are always the same, regardless of
which
information items are available in the underlying data sources. The
values
for the various keys are as follows:
* ``id``: The result of :func:`distro.id`.
* ``version``: The result of :func:`distro.version`.
* ``version_parts -> major``: The result of
:func:`distro.major_version`.
* ``version_parts -> minor``: The result of
:func:`distro.minor_version`.
* ``version_parts -> build_number``: The result of
:func:`distro.build_number`.
* ``like``: The result of :func:`distro.like`.
* ``codename``: The result of :func:`distro.codename`.
For a description of the *pretty* and *best* parameters, see the
:func:`distro.version` method.
(Rtinfo(RR((s*/usr/lib/python2.7/site-packages/distro.pyR�s)cCs
tj�S(s�
Return a dictionary containing key-value pairs for the information
items
from the os-release file data source of the current OS distribution.
See `os-release file`_ for details about these information items.
(Rtos_release_info(((s*/usr/lib/python2.7/site-packages/distro.pyR�scCs
tj�S(s�
Return a dictionary containing key-value pairs for the information
items
from the lsb_release command data source of the current OS
distribution.
See `lsb_release command output`_ for details about these information
items.
(Rtlsb_release_info(((s*/usr/lib/python2.7/site-packages/distro.pyR�scCs
tj�S(s�
Return a dictionary containing key-value pairs for the information
items
from the distro release file data source of the current OS
distribution.
See `distro release file`_ for details about these information items.
(Rtdistro_release_info(((s*/usr/lib/python2.7/site-packages/distro.pyR�scCs
tj�S(s�
Return a dictionary containing key-value pairs for the information
items
from the distro release file data source of the current OS
distribution.
(Rt
uname_info(((s*/usr/lib/python2.7/site-packages/distro.pyR�scCs
tj|�S(s�
Return a single named information item from the os-release file data
source
of the current OS distribution.
Parameters:
* ``attribute`` (string): Key of the information item.
Returns:
* (string): Value of the information item, if the item exists.
The empty string, if the item does not exist.
See `os-release file`_ for details about these information items.
(Rtos_release_attr(t attribute((s*/usr/lib/python2.7/site-packages/distro.pyR�scCs
tj|�S(s�
Return a single named information item from the lsb_release command
output
data source of the current OS distribution.
Parameters:
* ``attribute`` (string): Key of the information item.
Returns:
* (string): Value of the information item, if the item exists.
The empty string, if the item does not exist.
See `lsb_release command output`_ for details about these information
items.
(Rtlsb_release_attr(R((s*/usr/lib/python2.7/site-packages/distro.pyR
�scCs
tj|�S(s�
Return a single named information item from the distro release file
data source of the current OS distribution.
Parameters:
* ``attribute`` (string): Key of the information item.
Returns:
* (string): Value of the information item, if the item exists.
The empty string, if the item does not exist.
See `distro release file`_ for details about these information items.
(Rtdistro_release_attr(R((s*/usr/lib/python2.7/site-packages/distro.pyR!�scCs
tj|�S(sZ
Return a single named information item from the distro release file
data source of the current OS distribution.
Parameters:
* ``attribute`` (string): Key of the information item.
Returns:
* (string): Value of the information item, if the item exists.
The empty string, if the item does not exist.
(Rt
uname_attr(R((s*/usr/lib/python2.7/site-packages/distro.pyR"stcached_propertycBs
eZdZd�Zd�ZRS(s�A version of @property which caches the value.
On access, it calls the
underlying function and sets the value in `__dict__` so future accesses
will not re-call the property.
cCs|j|_||_dS(N(t__name__t_fnamet_f(tselftf((s*/usr/lib/python2.7/site-packages/distro.pyt__init__&scCs!|j|�}|j|j<|S(N(R&t__dict__R%(R'tobjtownertret((s*/usr/lib/python2.7/site-packages/distro.pyt__get__*s(R$t
__module__t__doc__R)R.(((s*/usr/lib/python2.7/site-packages/distro.pyR#!s tLinuxDistributioncBs�eZdZedded�Zd�Zed�Zd�Zed�Z eed�Z
ed�Zed �Zed
�Z
ed�Zd�Zd
�Zeed�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed��Zed��Zed��Zed��Zed��Z
ed��Z!ed��Z"ed��Z#d�Z$ed ��Z%RS(!s
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.
tcCsC|ptjjtt�|_|p'd|_||_||_dS(sp
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.
R2N( tostpathtjoint_UNIXCONFDIRt_OS_RELEASE_BASENAMEtos_release_filetdistro_release_filetinclude_lsbt
include_uname(R'R:R8R9R;((s*/usr/lib/python2.7/site-packages/distro.pyR)Bs
H cCsdjd|�S(s Return repr of all info
seLinuxDistribution(os_release_file={self.os_release_file!r},
distro_release_file={self.distro_release_file!r},
include_lsb={self.include_lsb!r}, include_uname={self.include_uname!r},
_os_release_info={self._os_release_info!r},
_lsb_release_info={self._lsb_release_info!r},
_distro_release_info={self._distro_release_info!r},
_uname_info={self._uname_info!r})R'(tformat(R'((s*/usr/lib/python2.7/site-packages/distro.pyt__repr__�s cCs1|r|j�n |j�|j�|j�fS(s�
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`.
(RRRR(R'R
((s*/usr/lib/python2.7/site-packages/distro.pyR�s cCs�d�}|jd�}|r+||t�S|jd�}|rM||t�S|jd�}|ro||t�S|jd�}|r�||t�SdS(soReturn
the distro ID of the OS distribution, as a string.
For details, see :func:`distro.id`.
cSs(|j�jdd�}|j||�S(Nt
t_(tlowertreplacetget(t distro_idttable((s*/usr/lib/python2.7/site-packages/distro.pyt normalize�sRtdistributor_idR2(RtNORMALIZED_OS_IDR
tNORMALIZED_LSB_IDR!tNORMALIZED_DISTRO_IDR"(R'RERC((s*/usr/lib/python2.7/site-packages/distro.pyR�s
cCs�|jd�p9|jd�p9|jd�p9|jd�}|r�|jd�p]|jd�}|s�|jd�p�|jd�}|jdt�}|r�|d|}q�q�n|p�dS(su
Return the name of the OS distribution, as a string.
For details, see :func:`distro.name`.
RRFtpretty_nametdescriptionRR>R2(RR
R!R"RtTrue(R'RRR((s*/usr/lib/python2.7/site-packages/distro.pyR�scCs)|jd�|jd�|jd�|j|jd��jdd�|j|jd��jdd�|jd�g}d}|r�xk|D]9}|jd�|jd�ks�|dkr�|}q�q�Wn'x$|D]}|dkr�|}Pq�q�W|r%|r%|j�r%dj||j��}n|S(s{
Return the version of the OS distribution, as a string.
For details, see :func:`distro.version`.
t
version_idtreleaseRJR2RKt.s {0} ({1})( RR
R!t_parse_distro_release_contentRBR"tcountRR<(R'RRtversionsRtv((s*/usr/lib/python2.7/site-packages/distro.pyR�s(
*
cCsq|jd|�}|rmtjd�}|j|�}|rm|j�\}}}||p]d|pfdfSndS(s�
Return the version of the OS distribution, as a tuple of version
numbers.
For details, see :func:`distro.version_parts`.
Rs(\d+)\.?(\d+)?\.?(\d+)?R2(R2R2R2(Rtretcompiletmatchtgroups(R'Rtversion_strt
version_regextmatchestmajortminorR((s*/usr/lib/python2.7/site-packages/distro.pyR�scCs|j|�dS(s�
Return the major version number of the current distribution.
For details, see :func:`distro.major_version`.
i(R(R'R((s*/usr/lib/python2.7/site-packages/distro.pyRscCs|j|�dS(s�
Return the minor version number of the current distribution.
For details, see :func:`distro.minor_version`.
i(R(R'R((s*/usr/lib/python2.7/site-packages/distro.pyRscCs|j|�dS(s}
Return the build number of the current distribution.
For details, see :func:`distro.build_number`.
i(R(R'R((s*/usr/lib/python2.7/site-packages/distro.pyRscCs|jd�pdS(s�
Return the IDs of distributions that are like the OS distribution.
For details, see :func:`distro.like`.
tid_likeR2(R(R'((s*/usr/lib/python2.7/site-packages/distro.pyR'scCsFy|jdSWn0tk
rA|jd�p@|jd�p@dSXdS(sp
Return the codename of the OS distribution.
For details, see :func:`distro.codename`.
RR2N(t_os_release_infotKeyErrorR
R!(R'((s*/usr/lib/python2.7/site-packages/distro.pyR/s
cCsstd|j�d|j||�dtd|j|�d|j|�d|j|��d|j�d|j��S( s�
Return certain machine-readable information about the OS
distribution.
For details, see :func:`distro.info`.
RRRR[R\RRR(tdictRRRRRRR(R'RR((s*/usr/lib/python2.7/site-packages/distro.pyR>scCs|jS(s�
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`.
(R^(R'((s*/usr/lib/python2.7/site-packages/distro.pyRQscCs|jS(s�
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`.
(t_lsb_release_info(R'((s*/usr/lib/python2.7/site-packages/distro.pyRZscCs|jS(s�
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`.
(t_distro_release_info(R'((s*/usr/lib/python2.7/site-packages/distro.pyRdscCs|jS(s�
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`.
(t_uname_info(R'((s*/usr/lib/python2.7/site-packages/distro.pyRnscCs|jj|d�S(s�
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`.
R2(R^RB(R'R((s*/usr/lib/python2.7/site-packages/distro.pyRwscCs|jj|d�S(s�
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`.
R2(RaRB(R'R((s*/usr/lib/python2.7/site-packages/distro.pyR
�scCs|jj|d�S(s�
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`.
R2(RbRB(R'R((s*/usr/lib/python2.7/site-packages/distro.pyR!�scCs|jj|d�S(s�
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`.
R2(RcRB(R'R((s*/usr/lib/python2.7/site-packages/distro.pyR"�scCsAtjj|j�r=t|j��}|j|�SWdQXniS(s�
Get the information items from the specified os-release file.
Returns:
A dictionary containing all information items.
N(R3R4tisfileR8topent_parse_os_release_content(R'trelease_file((s*/usr/lib/python2.7/site-packages/distro.pyR^�scCsai}tj|dt�}t|_tjddkrat|jt�ra|jjd�|_nt |�}xE|D]=}d|krt|j
dd�\}}|||j�<qtqtWd|kr�|d|d<n�d |kr�|d |d<nnd
|kr]tj
d|d
�}|r]|j�}|jd�}|jd
�}|j�}||d<q]n|S(sD
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.
tposixiis
iso-8859-1t=itversion_codenameRtubuntu_codenameRs(\(\D+\))|,(\s+)?\D+s()t,(tshlexRLtwhitespace_splittsystversion_infot
isinstancet wordcharstbytestdecodetlisttsplitR@RTtsearchtgrouptstrip(tlinestpropstlexerttokensttokentkRSR((s*/usr/lib/python2.7/site-packages/distro.pyRf�s0 %
c Cs~|js
iSttjd��;}yd}tj|d|�}Wntk
rUiSXWdQX|j|�j�}|j |�S(s�
Get the information items from the lsb_release command output.
Returns:
A dictionary containing all information items.
twtlsb_releases-atstderrN(R�s-a(
R:ReR3tdevnullt
subprocesstcheck_outputtOSErrort_to_strt
splitlinest_parse_lsb_release_content(R'R�tcmdtstdouttcontent((s*/usr/lib/python2.7/site-packages/distro.pyRa�s
cCs�i}xy|D]q}|jd�jdd�}t|�dkrFq
n|\}}|ji|j�|jdd�j�6�q
W|S(sM
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.
s
t:iiR>R?(RyRvtlentupdateRAR@(RzR{tlinetkvRRS((s*/usr/lib/python2.7/site-packages/distro.pyR��s
0c Csqttjd��;}yd}tj|d|�}Wntk
rHiSXWdQX|j|�j�}|j|�S(NR�tunames-rsR�(sunames-rs( ReR3R�R�R�R�R�R�t_parse_uname_content(R'R�R�R�R�((s*/usr/lib/python2.7/site-packages/distro.pyRcs
cCsui}tjd|dj��}|rq|j�\}}|dkrJiS|j�|d<||d<||d<n|S(Ns^([^\s]+)\s+([\d\.]+)itLinuxRRRN(RTRwRyRWR@(RzR{RVRR((s*/usr/lib/python2.7/site-packages/distro.pyR�s
cCsvtj�}|dkrdn|}tjddkrVt|t�rr|j|�Snt|t�rr|j|�S|S(Ntasciisutf-8ii(RotgetfilesystemencodingRpRqRsRttunicodetencode(ttexttencoding((s*/usr/lib/python2.7/site-packages/distro.pyR�0s
cCs�|jr�|j|j�}tjj|j�}tj|�}d|krnd|dj�krnd|d<n|r�|jd�|d<n|Sytj t
�}|j�WnDtk
r�ddddd d
ddd
ddddddg}nXx�|D]�}|t
krq�ntj|�}|r�tjjt
|�}|j|�}d|kr�||_|jd�|d<d|dj�kr�d|d<n|Sq�q�WiSdS(s�
Get the information items from the specified distro release file.
Returns:
A dictionary containing all information items.
Rt
cloudlinuxRisSuSE-releasesarch-releasesbase-releasescentos-releasesfedora-releasesgentoo-releasesmageia-releasesmandrake-releasesmandriva-releasesmandrivalinux-releasesmanjaro-releasesoracle-releasesredhat-releases
sl-releasesslackware-versionN(R9t_parse_distro_release_fileR3R4tbasenamet
_DISTRO_RELEASE_BASENAME_PATTERNRVR@RxtlistdirR6tsortR�t
_DISTRO_RELEASE_IGNORE_BASENAMESR5(R'tdistro_infoR�RVt basenamestfilepath((s*/usr/lib/python2.7/site-packages/distro.pyRb>sX
cCsKy,t|��}|j|j��SWdQXWnttfk
rFiSXdS(s�
Parse a distro release file.
Parameters:
* filepath: Path name of the distro release file.
Returns:
A dictionary containing all information items.
N(ReRPtreadlineR�tIOError(R'R�tfp((s*/usr/lib/python2.7/site-packages/distro.pyR��s
cCs�tj|j�ddd��}i}|r�|jd�ddd�|d<|jd�r�|jd�ddd�|d<n|jd�r�|jd�ddd�|d<q�n|r�|j�|d<n|S( s
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.
Ni����iRiRMiR(t(_DISTRO_RELEASE_CONTENT_REVERSED_PATTERNRVRyRx(R�RZR�((s*/usr/lib/python2.7/site-packages/distro.pyRP�s
#&(&R$R/R0RLR)R=RRtFalseRRRRRRRRRRRRRRR
R!R"R#R^tstaticmethodRfRaR�RcR�R�RbR�RP(((s*/usr/lib/python2.7/site-packages/distro.pyR10sFJ "
AD cCs�tjt�}|jtj�|jtjtj��t j
dd�}|jdddddd�|j�}|j
r�|jt
jt�d d
dt��nQ|jdtd
t��td
t�}|jd|�t�}|jd|�dS(NRKsOS
distro info tools--jsons-jthelps!Output in machine readable
formattactiont
store_truetindentit sort_keyssName: %sRsVersion: %ssCodename:
%s(tloggingt getLoggerR$tsetLeveltDEBUGt
addHandlert
StreamHandlerRoR�targparsetArgumentParsertadd_argumentt
parse_argstjsonRtdumpsRLRRR(tloggertparsertargstdistribution_versiontdistribution_codename((s*/usr/lib/python2.7/site-packages/distro.pytmain�s" ( t__main__(/R0R3RTRoR�RmR�R�R�tenvironRBR6R7RGRHRIRUR�R�R�RLRRR�RRRRRRRRRRRRRRR
R!R"tobjectR#R1RR�R$(((s*/usr/lib/python2.7/site-packages/distro.pyt<module>sr
O',
,
���