Ńņ
żÉŖWc           @   s`   d  d k  l  Z  d  d k l Z d  d k l Z d e f d     YZ d e f d     YZ d S(	   i’’’’(   t   InstallComponent(   t   InstallHelper(   t   InstallComponentBuildert   ComponentSelectionConfigc           B   s   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z e d    Z e d    Z e d    Z RS(   t   selectionItemst   BACKc         C   s   g  |  _  g  |  _ d  S(   N(   t   rootSelectiont   selectionConfigs(   t   self(    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt   __init__	   s    	c         C   s-   x& |  i  D] } | i | j o | Sq
 Wd  S(   N(   R   t   name(   R   R
   t   selectionConfig(    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt   getSelectionConfig   s    
 c         C   s   |  i  |  i  i S(   N(   R   R   t   displayName(   R   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt   getBackDisplayName   s    c         C   s   |  i  i |  d  S(   N(   R   t   append(   R   R   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt   appendSelectionConfig   s    c         C   s   t  i |  i |  i   S(   N(   R    t!   createRootInstallComponentForListt&   _constructInstallComponentsRecursivelyR   (   R   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt   constructInstallComponents   s    c         C   s   g  } xu | D]m } t  |  } |  i |  } | o8 | i o. x+ |  i | i  D] } | i |  qR Wn | i |  q W| S(   N(   R    R   t
   selectionsR   t   addSubComponentR   (   R   R   t   installComponentst   selectionItemt   installComponentR   t   childInstallComponent(    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyR      s      c         C   s   |  i    } t i   } xc | D][ } |  i |  } | o? | i p
 | i o | i |  i |   qz | i |  q q W| S(   N(   R   R    t   createEmptyInstallComponentR   t   availableComponentst   unAvailableComponentst   merget   _collectAvailableComponents(   R   t   selectedItemst   fullInstallComponentst   allAvailableComponentst
   selectItemR   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt*   collectAvailableComponentsForSelectedItems&   s     c         C   sd   t    } |  i   } | i o | i | i  S| i o& | i   i   i | i | i   Sd  S(   N(   R   R   R   t   buildInstallComponentsR   t   resolveLeavest   copyt	   substract(   R   R   t   builderR    (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyR   2   s    	

c         C   sg   t    } t i   } xK | D]C } |  i |  } | o' | i o | i | i | i   q q W| S(   N(   R   R    R   R   t   autoSelectComponentsR   R$   (   R   R   R(   t   allAutoSelectComponentsR"   R   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt+   collectAutoSelectComponentsForSelectedItems:   s    	 !c         C   sL   |  i    i   } |  i |  } |  i |  } | i |  i |  i   S(   N(   R   R%   R+   R#   R'   t'   removeNonLeafComponentIfNoSubcomponents(   R   R   R    R*   R!   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt5   collectAvailableComponentsExcludeAutoSelectComponentsC   s    c         C   si   t    } xY |  D]Q } | t  i j o |  | | _ q t |  } | i |  |  | i |  q W| S(   N(   R   t   ROOT_SELECTION_ITEMSR   t   ComponentSelectiont   convertFromConfigR   (   t   configt   componentSelectionConfigt	   selectiont   componentSelection(    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt   fromJsonI   s    	 c         C   sj   t    } xZ |  i   D]L } | i i | i  | i | i  } | o t  i | | | |  q q W| S(   sĄ   
            construct the selections via the installed component, aim to prompt to select for component deletion.
            @param installComponents        installComponents object
        (   R   t   getSubComponentsR   R   t   componentNameR   t   _handleChildComponents(   R   t   fullComponentSelectionConfigt   newComponentSelectionConfigR   R   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt   constructFromInstallComponentsU   s    	 c         C   s   | i    } |  i   o^ x[ |  i   D]I } | i | i  | i | i  } | o t i | | | |  q& q& Wn | i |  d S(   s8   
            handle child component recursively
        N(	   t   copyWithoutSelectiont   hasSubComponentR6   t   appendSelectionR7   R   R   R8   R   (   R   R   R:   R9   t   newSelectionConfigR   t   childSelectionConfig(    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyR8   c   s     "(   t   __name__t
   __module__R.   R   R	   R   R   R   R   R   R#   R   R+   R-   t   staticmethodR5   R;   R8   (    (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyR      s   											R/   c           B   sP   e  Z d  Z d Z d Z d Z d Z d Z d   Z d   Z	 d   Z
 d	   Z RS(
   R   R   t   singleSelectionR   R   R)   c         C   sC   | |  _  d |  _ g  |  _ t |  _ d  |  _ d  |  _ d  |  _ d  S(   Nt    (	   R
   R   R   t   FalseRD   t   NoneR   R   R)   (   R   R7   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyR	   y   s    						c         C   s   | i  |  i  o | |  i n d |  _ | i  |  i  o | |  i n g  |  _ | i  |  i  o | |  i n t |  _ | i  |  i  o | |  i n d  |  _
 | i  |  i  o | |  i n d  |  _ | i  |  i  o | |  i n d  |  _ d  S(   NRE   (   t   has_keyt   DISPLAY_NAMER   t
   SELECTIONSR   t   SINGLE_SELECTIONRF   RD   t   AVAILABLE_COMPONENTSRG   R   t   UNAVAILABLE_COMPONENTSR   t   AUTOSELECT_COMPONENTSR)   (   R   R1   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyR0      s    *****c         C   s   |  i  i |  d  S(   N(   R   R   (   R   R3   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyR>      s    c         C   sO   t  |  i  } |  i | _ |  i | _ |  i | _ |  i | _ |  i | _ | S(   N(   R/   R
   R   RD   R   R   R)   (   R   R4   (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyR<      s    (   RA   RB   RI   RJ   RK   RL   RM   RN   R	   R0   R>   R<   (    (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyR/   q   s   				N(   R    R   R   t   objectR   R/   (    (    (    sr   /home/jenkins/workspace/prepack-aio-release-4.2/prepack-aio/src/main/resources/scripts/ComponentSelectionConfig.pyt   <module>   s   l