Mini Shell

Direktori : /lib/python3.6/site-packages/blivet/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/blivet/__pycache__/arch.cpython-36.opt-1.pyc

3

{)c[%�@s�ddlmZddlZddlmZddlZejd�ZdZdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zd-dd�Zd.dd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�ZdS)/�)�absolute_importN�)�log_exception_infoZblivetz /sys/class/dmi/id/chassis_vendorcCs�t�s
dSddddddddddd	d
ddddddd
dd�}d}d}tdd��B}x:|D]2}d|krn|jd�d}qRd|krR|jd�d}qRWWdQRXx@||fD]4}|dkr�q�x$|j�D]}|d|kr�|dSq�Wq�Wtjd||�dS)zP
    :return: The PPC machine type, or None if not PPC.
    :rtype: string

    N�PMac�pSeries�Pegasos�Efika�iSeries�PRePZAPUS�GeminiZANS�BRIQ�Teron�PS3�PowerNV)ZMacZBookZCHRPzCHRP IBMrrr	rr
ZAmigarZShinerrr
ZAmigaOneZMaple�CellZMomentumrrz
/proc/cpuinfo�r�machine�:r�platformrz-Unknown PowerPC machine type: %s platform: %s)�is_ppc�open�split�items�log�warning)Zppc_typerr�f�line�part�_type�r�/usr/lib/python3.6/arch.py�get_ppc_machine-sL
r!c
Csht�s
dSt�dkrdStdd��2}x*|D]"}d|kr*|jd�d}|j�Sq*WWdQRXtjd�dS)	zc
    :return: The powermac machine type, or None if not PPC or a powermac.
    :rtype: string

    Nrz
/proc/cpuinforrrrzNo Power Mac machine id)rr!rr�striprr)rrrrrr �get_ppc_mac_idds


r#c
Cs�dddg}t�sdSt�dkr"dSd}tdd��,}x$|D]}d|kr8|jd	�d
}Pq8WWdQRX|dkrxtjd�dSx|D]}||kr~|Sq~Wtjd|�dS)
z\
    :return: The PPC generation, or None if not PPC or a powermac.
    :rtype: string

    ZOldWorld�NewWorldZNuBusNrz
/proc/cpuinforzpmac-generationrrzUnable to find pmac-generationz Unknown Power Mac generation: %s)rr!rrrr)Zpmac_gen�genrrrrrr �get_ppc_mac_genys&




r&c
CsPt�s
dSt�dkrdStdd��$}x|D]}d|j�kr*dSq*WWdQRXdS)zg
    :return: True if the hardware is an i_book or PowerBook, False otherwise.
    :rtype: string

    Frz
/proc/cpuinforZbookTN)rr!r�lower)rrrrr �get_ppc_mac_book�s

r(cCstj�ddkS)z_
    :return: True if the hardware supports Aarch64, False otherwise.
    :rtype: boolean

    ��aarch64)�os�unamerrrr �
is_aarch64�sr-c
Cs>t�s
dStdd�� }x|D]}d|krdSqWWdQRXdS)zc
    :return: True if the hardware is the Cell platform, False otherwise.
    :rtype: boolean

    Fz
/proc/cpuinforrTN)rr)rrrrr �is_cell�s
r.cCsXt�sd}nHtjjt�sd}n6ytt�j�}d|j�k}Wntk
rRd}YnX|S)zj
    :return: True if the hardware is an Intel-based Apple Mac, False otherwise.
    :rtype: boolean

    FZapple)	�is_x86r+�path�isfile�DMI_CHASSIS_VENDORr�readr'�UnicodeDecodeError)ZmactelZbufrrr �	is_mactel�s
r5cCstjjd�rdSdSdS)z[
    :return: True if the hardware supports EFI, False otherwise.
    :rtype: boolean

    z/sys/firmware/efiTFN)r+r0�existsrrrr �is_efi�sr7cCs�tj�d}|dkrR|jd�r(|jd�sL|jd�sL|jd�sL|dksL|dkr�d	SnR|d
krt|jd�r�|jd�r�d	Sn0|dkr�|jd�s�|jd�s�|dks�|dkr�d	SdS)
z�:return: True if the hardware supports X86, False otherwise.
    :rtype: boolean
    :param bits: The number of bits used to define a memory address.
    :type bits: int

    r)N�iZ86ZathlonZamd�x86_64Zia32eT� �@F)r+r,�
startswith�endswith)�bits�archrrr r/�sr/cCsPtj�d}|dkr"|d
krLdSn*|dkr8|dkrLdSn|dkrL|dkrLdSd	S)z�
    :return: True if the hardware supports PPC, False otherwise.
    :rtype: boolean
    :param bits: The number of bits used to define a memory address.
    :type bits: int

    r)N�ppc�ppc64�ppc64leTr:r;F)r@rArB)rArB)r+r,)r>r?rrr r
srcCstj�djd�S)z_
    :return: True if the hardware supports s390(x), False otherwise.
    :rtype: boolean

    r)Zs390)r+r,r<rrrr �is_s390!srCcCstj�ddkS)z\
    :return: True if the hardware supports IA64, False otherwise.
    :rtype: boolean

    r)Zia64)r+r,rrrr �is_ia64*srDcCstj�djd�S)z]
    :return: True if the hardware supports Alpha, False otherwise.
    :rtype: boolean

    r)�alpha)r+r,r<rrrr �is_alpha3srFcCstj�djd�S)z[
    :return: True if the hardware supports ARM, False otherwise.
    :rtype: boolean

    r)�arm)r+r,r<rrrr �is_arm<srHcCst�ot�dkot�dkS)Nrr$)rr!r&rrrr �is_pmacEsrIcCst�ot�dkS)Nr	r)r	r)rr!rrrr �is_ipseriesIsrJcCst�ot�dkS)Nr)rr!rrrr �
is_powernvMsrKcCsntdd�rdStdd�rdStdd�r*dStdd�r@tj�dSt�rJdSt�rTd	St�r^d
Stj�dSdS)z@
    :return: The hardware architecture
    :rtype: string

    r:)r>Zi386r;r9r@r)r*rErGN)r/rr+r,r-rFrHrrrr �get_archQs



rLcCsRy,ddl}|j�d}|jdd�\}}t|�Stk
rLttjd�dSXdS)a# Return an integer representing the length
        of the "word" used by the current architecture
        -> it is usually either 32 or 64

        :return: number of bits for the current architecture
        or None if the number could not be determined
        :rtype: integer or None
    rN�bitrz'architecture word size detection failed)rZarchitecturer�int�	Exceptionrr�error)rZnbitsZ_restrrr �num_bitsjs	rQ)N)N)Z
__future__rr+Zstorage_logrZloggingZ	getLoggerrr2r!r#r&r(r-r.r5r7r/rrCrDrFrHrIrJrKrLrQrrrr �<module> s0
7"