Mini Shell

Direktori : /lib64/python3.6/site-packages/pyanaconda/__pycache__/
Upload File :
Current File : //lib64/python3.6/site-packages/pyanaconda/__pycache__/addons.cpython-36.opt-1.pyc

3

C��e� �@s�ddddgZddlZddlZddlmZddlmZddlmZdd	l	m
Z
e
e�Zd
Z
ddd�ZGd
d�de�ZGdd�de�ZGdd�de�ZdS)�AddonSection�
AddonRegistry�	AddonData�collect_addon_paths�N)�Section)�progress_message)�N_)�get_module_loggerZADDON_placeholder�guic	Csgggd�}�x|D]�}ytj|�}Wntk
r>g}YnXx�|D]�}tjj||d�}tjj|�r�|djd||f�tjd|�tjj|||d�}tjj|�r�|djd||f|f�tjd|�tjj||d�}tjj|�rF|djd	||f�tjd
|�qFWqW|S)a�This method looks into the directories present
       in toplevel_addon_paths and registers each subdirectory
       as a new addon identified by that subdirectory name.

       It then registers spokes, categories and data (ks)
       paths for the application to use. By default is looks
       for spokes and categories in <addon>/gui/ subdirectory
       but that can be changed using the ui_subdir argument.)�spokes�ks�
categoriesrz	%s.ks.%%sz0Loading ks section into module path for addon %srz%s.%s.spokes.%%sz,Loading spokes into module path for addon %sr
z%s.categories.%%sz0Loading categories into module path for addon %s)	�os�listdir�OSError�path�join�isdir�append�log�debug)	Ztoplevel_addon_pathsZ	ui_subdirZmodule_pathsrZdirectories�addon_idZ
addon_ks_pathZaddon_spoke_pathZaddon_category_path�r�/usr/lib64/python3.6/addons.pyr#s,

c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)rz�This class represents the ksdata.addons object and
       maintains the ids and data structures for loaded
       addons.

       FIXME: This class is deprecated and should be removed.

       It acts as a proxy during kickstart save.
    cCs
||_dS)N)�__dict__)�selfZ
dictionaryrrr�__init__VszAddonRegistry.__init__cCstjdd�|jj�d�S)NcSs|t|d�S)N�)�str)ZaccZid_addonrrr�<lambda>Zsz'AddonRegistry.__str__.<locals>.<lambda>�)�	functools�reducer�items)rrrr�__str__Ys
zAddonRegistry.__str__cCsDx>|jj�D]0}t|d�rttd�|j�|j||||�qWdS)z7This method calls execute on all the registered addons.�executezExecuting %s addonN)r�values�hasattrrr�namer%)r�storage�ksdata�users�payload�vrrrr%]s
zAddonRegistry.executecCs�i}x6|jj�D](\}}|jtks,|||<qtjd|�qW||_x<|jj�D].}t|d�rNtt	d�|j�|j
|||�qNWdS)z5This method calls setup on all the registered addons.z9Removing placeholder for addon %s. Addon wasn't imported!�setupzSetting up %s addonN)rr#r(�PLACEHOLDER_NAMEr�warningr&r'rrr.)rr)r*r,�d�kr-rrrr.ds


zAddonRegistry.setupN)�__name__�
__module__�__qualname__�__doc__rr$r%r.rrrrrLs
c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)ra�This is a common parent class for loading and storing
       3rd party data to kickstart. It is instantiated by
       kickstart parser and stored as ksdata.addons.<name>
       to be used in the user interfaces.

       FIXME: This class is deprecated and should be removed.

       The mandatory method handle_line receives all lines
       from the corresponding addon section in kickstart and
       the mandatory __str__ implementation is responsible for
       returning the proper kickstart text (to be placed into
       the %addon section) back.

       There is also a mandatory method execute, which should
       make all the described changes to the installed system.
    cCs||_d|_d|_dS)Nr )r(�content�header_args)rr(rrrr�szAddonData.__init__cCsd|j|j|jfS)Nz%%addon %s %s
%s%%end
)r(r8r7)rrrrr$�szAddonData.__str__cCstjd|j�dS)z�Make the changes to the install system.

           This method is called before the installation
           is started and directly from spokes. It must be possible
           to call it multiple times without breaking the environment.z#Addon %s doesn't have setup method!N)rr0r()rr)r*r,rrrr.�szAddonData.setupcCstjd|j�dS)z�Make the changes to the underlying system.

           This method is called only once in the post-install
           setup phase.
        z%Addon %s doesn't have execute method!N)rr0r()rr)r*r+r,rrrr%�szAddonData.executecCs|r|jdj|�7_dS)a�Process additional arguments to the %addon line.

           This function receives any arguments on the %addon line after the
           addon ID. For example, for the line:

               %addon com_example_foo --argument='example'

           This function would be called with args=["--argument='example'"].

           By default AddonData.handle_header just preserves the passed
           arguments by storing them and adding them to the __str__ output.

        � N)r8r)r�lineno�argsrrr�
handle_header�szAddonData.handle_headercCs|j|7_dS)zProcess one kickstart line.N)r7)r�linerrr�handle_line�szAddonData.handle_linecCsdS)zqNo additional data will come.

           Addon should check if all mandatory attributes were populated.
        Nr)rrrr�finalize�szAddonData.finalizeN)r3r4r5r6rr$r.r%r<r>r?rrrrruscs@eZdZdZdZdd�Zdd�Z�fdd�Z�fd	d
�Z�Z	S)rz_The section parser for %addon.

    FIXME: This class is deprecated and should be removed.
    z%addoncOstj|f|�|�d|_dS)N)rrr)rr;�kwargsrrrr�szAddonSection.__init__cCs2|js
dS|jsdSt|jj|j�}|j|�dS)N)�handlerr�getattr�addonsr>)rr=�addonrrr�
handleLine�szAddonSection.handleLinecsnt�j||�|d|_|jrFt|jj|j�rFt|jj|jtt��t	|jj|j�}|j
||dd��dS)z+Process the arguments to the %addon header.r�N)�super�handleHeaderrr'rArC�setattrrr/rBr<)rr:r;rD)�	__class__rrrH�s
zAddonSection.handleHeadercs&t�j�t|jj|j�}|j�dS)z,Let addon know no additional data will come.N)rGr?rBrArCr)rrD)rJrrr?�s
zAddonSection.finalize)
r3r4r5r6ZsectionOpenrrErHr?�
__classcell__rr)rJrr�s
)r
)�__all__rr!Zpykickstart.sectionsrZpyanaconda.progressrZpyanaconda.core.i18nrZpyanaconda.anaconda_loggersr	r3rr/r�objectrrrrrrr�<module>s
))H