Mini Shell

Direktori : /usr/lib64/python3.6/site-packages/pyanaconda/payload/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/pyanaconda/payload/__pycache__/utils.cpython-36.pyc

3

C��e�@s�ddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZee�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd%dd�Zdd�Zdd �Zd!d"�Zd#d$�ZdS)&�N)�LooseVersion)�get_module_logger)�DEVICE_TREE)�STORAGE)�
DeviceData)�PayloadSetupErrorcCstjt�}|j|�pdS)z�Get the device matching the provided device specification.

    :param str dev_spec: a string describing a block device
    :return: a device name or None
    N)r�	get_proxyrZ
ResolveDevice)Zdev_spec�device_tree�r
�/usr/lib64/python3.6/utils.py�resolve_device"s
rcCs,|dkrdStjt�}tj|j|��}|jS)z\Return a device path.

    :param device_name: a device name
    :return: a device path
    N)rrrrZfrom_structureZ
GetDeviceData�path)�device_namer	Zdevice_datar
r
r�get_device_path,s

rcCstjt�}|j|�dS)zFOpen, or set up, a device.

    :param device_name: a device name
    N)rrrZSetupDevice)rr	r
r
r�setup_device:s
rcCstjt�}|j||d�dS)z�Mount a filesystem on the device.

    :param device_name: a device name
    :param str mount_point: a path to the mount point
    ZroN)rrrZMountDevice)r�mount_pointr	r
r
r�mount_deviceCs
rcCs>|s$t|�}t|�}|sdS|d}tjt�}|j||�dS)z�Unmount a filesystem on the device.

    FIXME: Always specify the mount point.

    :param device_name: a device name
    :param str mount_point: a path to the mount point or None
    N����)r�get_mount_pathsrrrZ
UnmountDevice)rr�device_pathZmount_pathsr	r
r
r�unmount_deviceMs
rcCstjt�}|j|�dS)zJClose, or tear down, a device.

    :param device_name: a device name
    N)rrrZTeardownDevice)rr	r
r
r�teardown_devicebs
rcCstjt�}|j�S)zeGet mount points in the device tree.

    :return: a dictionary of mount points and device names
    )rrrZGetMountPoints)r	r
r
r�get_mount_pointsks
rcCstjj|�rtjj|�SdS)z�Given a mount point, return the device node path mounted there.

    :param str mount_point: a mount point
    :return: a device path or None
    N)�osr
�ismount�blivet�utilZget_mount_device)rr
r
r�get_mount_device_pathtsrcCstjj|�S)z�Given a device node path, return a list of all active mount points.

    :param device_path: a device path
    :return: a list of mount points
    )rrr)rr
r
rr�srFcCsVytjj|�Wn@tk
rP}z$tjt|��tjd�|r@�WYdd}~XnXdS)zzUnmount a filesystem.

    :param str mount_point: a mount point
    :param raise_exc: raise an exception if it fails
    z&umount failed -- mounting on top of itN)rrZumount�OSError�log�error�str�info)rZ	raise_exc�er
r
r�unmount�s
r%cCsHytjj||||d�Stk
rB}ztt|���WYdd}~XnXdS)z�Mount a filesystem.

    :param str device_path: a device path
    :param str mount_point: a mount point
    :param str fstype: a filesystem type
    :param str options: mount options
    )�fstype�optionsN)rr�mountrrr")rrr&r'r$r
r
rr(�sr(cCstjjd�S)zDoes the hardware support X86?� )r�archZis_x86r
r
r
r�arch_is_x86�sr+cCs
tjj�S)zDoes the hardware support ARM?)rr*Zis_armr
r
r
r�arch_is_arm�sr,cCs t|�}t|�}||k||kS)z#Compare two version number strings.)r)Zv1Zv2Z
first_versionZsecond_versionr
r
r�version_cmp�sr-)F) rZblivet.utilrZblivet.archZdistutils.versionrZpyanaconda.anaconda_loggersrZ+pyanaconda.modules.common.constants.objectsrZ,pyanaconda.modules.common.constants.servicesrZ,pyanaconda.modules.common.structures.storagerZpyanaconda.payload.errorsr�__name__r rrrrrrrrrr%r(r+r,r-r
r
r
r�<module>s.