%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/clselect/
Upload File :
Create Path :
Current File : //proc/227033/root/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyc

�
i�B^c@`s�ddlmZddlmZddlmZddlZddlZddlZddlmZddl	m
Z
ddlmZdd	l
mZdd
lmZe�ade
fd��YZdS(
i(tabsolute_import(tprint_function(tdivisionN(tmapi(tClSelect(tClSelectExcept(tclprint(tutilstClExtSelectcB`s:eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
ed
�Zed�Z
ed�Zd
�Zee�Zd�Zdd�Zee�Zd�Zee�Zd�Zee�Zd�Zd�Zd�Zd�Zed��Zed��Zed��Zed��ZRS(s)/etc/cl.selector/php.extensions.conflictss/opt/alttphpcC`s&tj||�g|_t|_dS(N(Rt__init__t
_conflictstFalset!_use_default_exts_from_native_php(tselftitem((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR
s	cC`s
||jkS(N(t_hidden_extensions(Rtext_name((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyt_is_disabled_extention&scC`si|j�}|j||�|j|j|j|f|j|dd�}|jdj|�tj�dS(sM
        Adds extensions to default list of extensions for a version
        tactiontenable_extentionss
N(	tget_all_alternatives_datat_check_alternativet_process_ini_filet
DEFAULTS_PATHt_itemt_add_extensionst_write_to_filetjoinR(Rtversiontext_listtalternativestdefaults_contents((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pytenable_extensions)scC`sc|j�}|j||�|j|j|j|f|j|�}|jdj|�|j�dS(s
        Replaces extensions to default list of extensions for a version.
        Writes/updates /etc/cl.selector/defaults.cfg file
        :param version: alt-php version to process
        :param ext_list: list extensions to set as defaults for the version
        s
N(RRRRRt_replace_extensionsRR(RRRRR ((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pytreplace_extensions7s	cC`si|j�}|j||�|j|j|j|f|j|dd�}|jdj|�|j�dS(s�
        Removes extensions from default list of extensions for a version
        :param version: alt-php version to process
        :param ext_list: comma separated extensions list to delete
        Rtdisable_extentionss
N(RRRRRt_del_extensionsRR(RRRRR ((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pytdisable_extensionsHscC`s�d}d}t�}t}|j�}|j||�|j|�}|j|�}y|j|�}	Wntjk
r�g}	nXtt	d�|��}
x�|	D]�}t}||kr�||kr�t
}nt|t
f|tf|dfg�}
t|
�j
|
�s�||krj|jrj||	krj|
j|tf�|
j|t
f�t
}|j|�q�|
j||f�|r�|j|�q�q�q�W|r�|j||�ntt|
dtjd���S(s�
        Returns list of extensions marking built-ins and enabled ones
        Also replaces mysqli->nd_mysqli in defaults.cfg for new installations according to LVEMAN-1399
        :param version: php version
        :return Tuple: (extension_name, extension_state)
            extension_state:
                None        -- built-in extension
                False/True  -- disabled/enabled extension
        tmysqlit	nd_mysqlicS`s
|dfS(N(tNone(ti((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyt<lambda>tttkeyiN(tlistRRRt_get_enabled_extensionst
_get_builtinst_load_extensions_listRtUnableToGetExtensionsRtTruetsetR)tintersectionR
tappendR#ttupletsortedtoperatort
itemgetter(RRtext_mysqli_nametext_nd_mysqli_nametext_list_to_writetis_need_to_write_defaultsRtenabled_extensionstas_built_int
as_extensionstall_extensionstexttstatustext_set((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pytlist_extensionsWs>
	

	'cC`s�yN|jjd|j|fd�}t|_ttd�|jd���SWn0tj	tj
fk
r�t|_|jd�SXdS(sB
        Returns list of enabled extensions for a version
        s%s%stmodulescS`s
|j�S(N(tstrip(R*((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR+�R,t,tnativeN(
t_dhtgetRRR
R.RtsplittConfigParsertNoSectionErrort
NoOptionErrorR3R0(RRtdata((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR/�s		#	c
C`s||j|�}t|�dks1||dkr5|Sd}g}t�}|j|d�}	x7tt|��D]#}
||
jd�rp|
}PqpqpW|r�||||jd�dj�}|j	t
td�|jd����n|j	|�|j
|�}x*|D]"}|j|j|g|	��qWddjt|��}|rb|||<n
|j|�|j|�S(	s�
        Adds 'modules' option to section or extends it
        @param section_info: tuple (item and version)
        @param section: list
        @param data: list
        @return: list
        iiRGt=cS`s
|j�S(N(RH(R*((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR+�R,RIsmodules = %sN(t_make_section_headertlenR)R4t_compose_alt_pathtranget
startswithtfindRHtextendR.RRMt_check_for_conflictstupdatet_include_dependenciesRR8R6t_smooth_data(
Rtsection_infotsectionRQttracetsection_headertmidxRGtresolved_modulestalt_pathtidxtmodules_stringtmod((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR�s0"	%%

 

c`s�|j|�}t|�dks1||dkr5|Sd}|j|d�}x7tt|��D]#}||jd�ra|}PqaqaW|}	|r.t�}
|j|	�}	xb|	D]Z�|j�g|�}t|�dkrt	j
�fd�|D��n|
j
|�q�Wddjt|
��}nddjt|��}|rZ|||<n
|j
|�t	j�}	x*|	j�D]}
|
|kr�t	|
=q�q�W|j|�S(sK
        Adds 'modules' option to section or extends it
        @param section_info: tuple (item and version).
            Example: ('php', '5.2')
        @param section: list. Modules from /etc/cl.selecto/defaults.cfg for supplied php version
            Example: ['[php5.2]',
                      'modules = bcmath,dom,gd,imap,json,mcrypt,mysql,mysqli,phar,posix,sockets,uuid,wddx,xmlreader,zip',
                      '', '']
        @param data: list: Modules list to set from command line
        @:param trace: ????, Currently not using, always True
        @return: list
        iiRGc`s%i|]}|�kr�|�qS(((t.0t
dep_module(Rg(sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pys
<dictcomp>�s	smodules = %sRIN(RSRTR)RURVRWR4RZR\tdepend_modules_dictR[RR8R6tcopytkeysR](RR^R_RQR`RaRbRdReRGRctinclude_depRfRi((RgsE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR"�s8"	
 

cC`s�|j|�}t|�dks1||dkr5|Sd}|j|d�}x7tt|��D]#}||jd�ra|}PqaqaW|s�|S||||jd�dj�}	tt	d�|	j
d���}
|
j�}x`t|�D]R}||
kr	q�n|
j|g�}
|j
||
|�r6q�n|j|�q�Wt�}x*|D]"}|j|j|g|��qWWddjt|��}	|	||<|j|�S(	s�
        Deletes items in data list from section list
        @param section_info: tuple (item and version)
        @param section: list
        @param data: list of extension names to delete
        @return: list
        iiRGRRcS`s
|j�S(N(RH(R*((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR+R,RIsmodules = %sN(RSRTR)RURVRWRXRHR4RRMRkt
differencet_is_dependencytdiscardR[R\RR8R](RR^R_RQR`RaRbRdReRfRGRcRtrest_of_modulesttmpRg((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR%�s6"%!	
 
cC`sAx:|D]2}|j||�}||kr|t|<tSqWtS(s^
        Checks if module in modules dependent on ext and returns true or false
        @param ext: Module to check
        @param modules: set of names of installed modules
        @param alt_path: Path to alt-php ini dir: /opt/alt/phpXX/etc/php.d.all
        @return: bool. True if ext present in dependencies of any module in modules list
        (t_get_dependenciesRjR3R(tclsRCRGRdRgtdependencies((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyRos	

cC`s?tjj|jd|j|jdd�fdd|jf�S(s<
        Composes and returns path for alternatives
        s%s%st.R,tetcs%s.d.all(tostpathRtSYSTEM_ALT_PATHRtreplace(RR((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyRU's
	cC`s�t}t}|}x�|D]�}tjj|d|f�}y^t|�}	g}
g}x�|	D]�}|jd�s�|jd�r�|j||�}
|
|kr�|
|kr�|jd|
�t}q^n|
j	d|f�t}|
j
|�g}n|jd�p|jd�s^|r2|
j	|j��qH|j	|j��q^q^W|	j�|dk	r{||kr{|
||<n|r�|j|||�}nWqttfk
r�|j|�|SXqW|S(	s�
        Includes dependencies into extensions list and update data dict
        if present
        @param ext_list: list
        @param alt_path: string
        @param data: dict
        @return: list
        s%s.init	extensiontzend_extensionis	;---%s---t;s
N(RRxRyRtopenRWt_single_out_extensiontinsertR3R6RYtrstriptcloseR)R\tOSErrortIOErrortremove(RtRRdRQtfoundt
in_sectiontresult_ext_listRCtext_pathtft
file_contentstpending_contentstlineR((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR\1sD	


	


	cC`s�t�}tjj|d|f�}yet|�}xN|D]F}|jd�r;|j||�}||kr�|j|�q�q;q;W|SWntt	fk
r�|SXdS(s�
        Checks if an extension has dependencies and if so returns them
        Otherwise returns None
        @param ext: string
        @return: set
        s%s.iniR|N(
R4RxRyRRRWR�taddR�R�(RtRCRdRuR�R�R�R((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyRs_s	
cC`sidd6}d|kr9||jd�dj�}n ||jd�djd�}d|kr{||jd� }nd|kr�||jd� }n||kr�||}nT||kr�|}n?d	|kr
d
jtd�|jd	���|kr
|}n|S(s=
        Singles out and returns extension from line
        tsourceguardiantixedt/iRRs "Rvt-t_R,cS`s
|j�S(N(t
capitalize(R*((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR+�R,(trfindRHRXRRRM(RCR�tquirksR((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR�ts 
  
		cC`sf|js|j�nt�}x@|D]8}|j||�r&|j|�r&|j|�q&q&W|S(s?
        Removes from extensions list conflicting ones
        (Rt_load_conflicting_extensionsR4t_is_not_conflictingRR�(RRt	clean_setRC((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyRZ�s	
	
cC`sLxE|jD]:}||kr
t|j�j|��dkrDtSq
q
WtS(s;
        Checks extension against conflicting sets
        i(RRTRkR5RR3(RRCR�tconflict((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR��s
!cC`s�tj|j�}xo|j�D]a}d|kr7qnttd�|jd���}t|�dkrpqn|jj	|�qWdS(sU
        Loads conflicting extensions from file and saves'em as list of sets
        RIcS`s
|j�S(N(RH(R*((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR+�R,iN(
Rtread_file_as_stringtCONFLICTS_PATHt
splitlinesR4RRMRTRR6(Rt	conflictsR�tconflict_set((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR��s!cC`s�|j|�}yxg}xatj|�D]P}|jd�sCq(n||jd� }||jkrkq(n|j|�q(Wt|�SWn%tk
r�}t	j
||��nXdS(s`
        Loads alternative extensions list for a version
        @param version: string
        s.iniN(RURxtlistdirtendswithRXRR6R8R�RR2(RRRdtalt_extensionstfilenameR|te((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyR1�scC`sCx<|D]4\}}tjdidd6d||fd6�qWdS(sR
        Prints info
        @param ext: string
        @param data: list
        ttexttWARNRDs%s enabled as dependency (%s)tmessageN(Rt
print_diag(tdependens_infoR*RC((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyt_print_dependencies_info�s
cC`sK|s
gSt|�j|g�}g|D]}||kr)||f^q)S(sv
        Get array of dependenses [(ext, depending ext)]
        @param ext: string
        @param data: list
        (R4Rn(RCRQRtdiffR*((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pytget_dependencies_list�scC`st|�j|�S(N(R4Rn(t	init_listt
processed_set((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pytget_conflicts_info�scC`sC|r?x6|D]+}tjdidd6d|fd6�q
WndS(s~
        Prepares data for printing conflicts if any
        @param init_list: list
        @param processed_set: set
        R�R�RDs%s skipped as conflictingR�N(RR�(R�R*((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyt_print_conflicts_info�s

N(t__name__t
__module__R�RzR
RR!R#R&RFR/R3RR"R%RotclassmethodRUR)R\RsR�tstaticmethodRZR�R�R1R�R�R�R�(((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyRs:					;	"0$		
,				
	
	(t
__future__RRRRxR9RNtbuiltinsRtclselectRtclselectexceptRt
clselectprintRR,RtdictRjR(((sE/opt/alt/python27/lib/python2.7/site-packages/clselect/clextselect.pyt<module>s	

Zerion Mini Shell 1.0