Your IP : 18.188.211.246


Current Path : /usr/lib/python3.6/site-packages/dnf/cli/commands/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dnf/cli/commands/__pycache__/group.cpython-36.opt-1.pyc

3

��f�:�@s�ddlmZddlmZddlmZddlmZddlmZm	Z	ddl
ZddlZddl
ZddlZddlZejd�ZGdd	�d	ej�ZdS)
�)�absolute_import)�unicode_literals)�
CompsQuery)�commands)�_�ucdN�dnfcs�eZdZdZddddddd�Zd-eej��Zed
�Z	ddd�Z
d.Zd/Zdd�Z
�fdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zed%d&��Zd'd(�Zd)d*�Zd+d,�Z�ZS)0�GroupCommandz; Single sub-command interface for most groups interaction. �list�install�remove�info)Z	grouplistZgroupinstallZgroupupdateZgroupremoveZ
grouperaseZ	groupinfo�group�groups�grpz'display, or use, the groups information�upgrade)�updateZerase�summary�markcCsn|jj|jj�}|r<|jjdk	r4|jjjd|jj�||j_|jjdkrPd|j_|jj|jj|jj�|j_dS)Nrr)�direct_commands�get�optsZcommand�subcmd�args�insert�_CMD_ALIASES)�selfZdirect�r�/usr/lib/python3.6/group.py�
_canonical6szGroupCommand._canonicalcstt|�j|�d|_dS)NF)�superr	�__init__�_remark)r�cli)�	__class__rrr!CszGroupCommand.__init__cCs$td�}t|jj�s tjj|��dS)Nz4No group data available for configured repositories.)r�len�base�compsr�
exceptionsZ
CompsError)r�msgrrr�
_assert_compsGszGroupCommand._assert_compscsT�fdd�}�j�|dkr(�jjj}n�jjjdj|��}tjjt	tjj
||��S)Ncs�jjjj|j�}|S)N)r&�history�envr�id)r,Z	env_found)rrr�available_predMsz7GroupCommand._environment_lists.<locals>.available_pred�,)r*r&r'�environments�environments_by_pattern�joinr�utilZmapallr
�	partition)r�patternsr.�envsr)rr�_environment_listsLszGroupCommand._environment_listsc	s��fdd�}g}g}�j�|dkr0�jjj}n�jjjdj|��}x2|D]*}|}||�r^|}|sj|jrJ|j|�qJW||fS)Ncs�jjjj|j�}|rdSdS)NTF)r&r+rrr-)rZgroup_found)rrr�installed_predZsz1GroupCommand._group_lists.<locals>.installed_predr/)r*r&r'r�groups_by_patternr2�uservisible�append)	rr:r5r8�	installed�	availableZgrpsrZtgt_listr)rr�_group_listsYs
zGroupCommand._group_listscCs~xt|D]l}d}x&|jjj|�D]}|jj|�d}qWx&|jjj|�D]}|jj|�d}qFW|stjt	d�|�qWdgfS)NFTz!Warning: Group %s does not exist.r)
r&r'r1�outputZdisplay_groups_in_environmentr9Zdisplay_pkgs_in_groups�logger�errorr)r�userlistZstrngZ
group_matchedr,rrrr�_infoqs
zGroupCommand._infocs�d}d}d}|jjjp|jj�xz|r�|ddkr@d}|jd�q |ddkr\d}|jd�q |ddkrxd}|jd�q |ddkr�d�|jd�q Pq W|jjr�d}|jjr�d}|jjr�d}|s�d}d}|dk	�r@x\|D]T}|jj	}t
|j|��dk}t
|j|��dk}	|r�|	r�t
jtd	�d
|�d}q�W|�r@dgfS|j|�\}
}|j||�\}}
��fdd�}�fd
d�}|�s�|td�|�|�s�|td�|
�|�s
d�x,|D]$}|j�r��q�|td�|�d��q�Wd�x,|D]$}|j�s�q�|td�|�d��q�W|�rdgfSd�x,|
D]$}|j�r2�q"|td�|�d��q"Wd�x,|
D]$}|j�sd�qT|td�|�d��qTWdgfS)N�r�hiddenr<r=�idsTFzWarning: No groups match:z
   %scs`�st|�d|jdk	r|jntd�}�r:|d|j7}|jrN|d|j7}tdj|��dS)Nz   %sz<name-unset>z (%s)z [%s]z{})�print�ui_namerr-�	lang_only�format)�sectrr))�done�	print_idsrr�_out_grp�sz$GroupCommand._list.<locals>._out_grpcsT|rt|�xB|D]:}d|jdk	r(|jntd�}�rD|d|j7}t|�qWdS)Nz   %sz<name-unset>z (%s))rGrHrr-)rKr6�er))rMrr�_out_env�s
z$GroupCommand._list.<locals>._out_envzAvailable Environment Groups:zInstalled Environment Groups:zInstalled Groups:zInstalled Language Groups:zAvailable Groups:zAvailable Language Groups:)r&�conf�verboserrF�poprEr<r=r'r%r9r1r@rArr7r>rI)rrBr:Z
showinstalledZ
showavailableZerrsrr'Zin_groupZin_environmentZenv_instZ	env_availr<r=rNrPr)rLrMr�_list�s�


	







zGroupCommand._listc	Cs�t|jj|jjtjtjBtjtjB�}|jj�}|j	|�}|j
jrXt|jj
jdg�}nt|jj
j�}tjj|�}x|jD]}|j||�qzWx|jD]}|j||�q�WdS)N�optional)rr&r'r+�GROUPS�ENVIRONMENTSZ	AVAILABLE�	INSTALLED�_build_comps_solverrr�
with_optional�tuplerQ�group_package_types�libdnfZtransactionZlistToCompsPackageTyper0Z_environment_installrZ_group_install)	rr5�q�solver�res�typesZ	pkg_types�env_idZgroup_idrrr�
_mark_install�s


zGroupCommand._mark_installcCslt|jj|jjtjtjBtj�}|jj�}|j|�}x|j	D]}|j
|�q<Wx|jD]}|j|�qVWdS)N)
rr&r'r+rVrWrXrYrr0Z_environment_removerZ
_group_remove)rr5r^r_r`rbZgrp_idrrr�_mark_remove�s


zGroupCommand._mark_removecCs*|d|jkr"|d|dd�fSd|fS)NrrDr)�
_MARK_CMDS)r�extcmdsrrr�_mark_subcmdszGroupCommand._mark_subcmdcCs d}t|�dkr*|ddkr*d}|jd�|jjr6d}|s>d}|j||�\}}dd�}d}x|D]}|jrlq`|d7}q`W|td�|�d}x|D]}|js�q�|d7}q�W|td�|�d}x|D]}|jr�q�|d7}q�W|td	�|�d}x|D]}|j�s�q�|d7}q�W|td
�|�dgfS)NrDrrEcSs|sdStjd||�dS)Nz%s %u)r@r
)rKZnumrrrrNsz'GroupCommand._summary.<locals>._out_grpzInstalled Groups:zInstalled Language Groups:FzAvailable Groups:zAvailable Language Groups:)r%rSrrEr>rIr)rrBr:r<r=rNrLrrrr�_summary
sH




zGroupCommand._summaryc
Cs�|jddtd�d�|j�}|jddtd�d�|jddtd�d�|jd	dtd
�d�|jddtd�d�|jd
ddtd�jtjddjtjdd���d�|jdddtd�d�dS)Nz--with-optional�
store_truez$include optional packages from group)�action�helpz--hiddenzshow also hidden groupsz--installedzshow only installed groupsz--availablezshow only available groupsz--idszshow also ID of groupsr�?ZCOMMANDz'available subcommands: {} (default), {}rz, rD)�nargs�metavarrkr�*ZCOMMAND_ARGzargument for group subcommand)�add_argumentrZadd_mutually_exclusive_grouprJr	�_GROUP_SUBCOMMANDSr2)�parserZ	grpparserrrr�
set_argparser<s"

zGroupCommand.set_argparsercCs�|j�|jj}|jj}||jkrBtjtd�dj|j��t	j
j�|d
krf|rf|j
jj
|�t	j
j�|j
j}d|_|dkr�d|_d|_|dkr�d|_d	|_nd|_|dkr�tj|j�|dkr�tj|j|j
�dS)
Nz$Invalid groups sub-command, use: %s.z, rrrr
TrF)rrrr
)rrrr)rr)rrrrrqr@Zcriticalrr2rr#ZCliErrorZ	optparserZ
print_help�demandsZsack_activationZ	root_userZ	resolvingZ
allow_erasingZavailable_reposrZ_checkEnabledRepor&Z_checkGPGKey)r�cmdrrtrrr�	configurePs.

zGroupCommand.configurecCs�|jj}|jj}|dkr"|j|�S|dkr4|j|�S|dkrF|j|�S|dkrx|j|�\}}|dkrn|j|�S|j|�S|dk�r$|jj	r�t
|jjj
dg�}nt
|jjj
�}d|_y|jj|||jjj�Stjjk
�r"}z6td	�}tj||jjjj|��tjjtd
���WYdd}~XnX|dk�r:|jj|�S|dk�r�x<|D]4}y|jj|g�Wntjjk
�rzYnX�qJWdS)Nrr
r
rrrrUTzNo package %s available.z)Unable to find a mandatory group package.r)rrrrhrTrCrgrdrcrZr[r&rQr\r"Zenv_group_install�strictrr(ZMarkingErrorrr@r
r?ZtermZboldZPackagesNotAvailableErrorZenv_group_upgradeZenv_group_remove�Error)rrurfrrarOr)�argrrr�runosD









zGroupCommand.runcCsf|js
dS|jj}|jj}|j}x@|jjj�j�j|d�D]$}|j	j
|�}|j||j||��q:WdS)N)�name)
r"r&Z_goalr+Z
group_membersZsackZqueryr<ZfiltermZrpmZ
get_reasonZ
set_reasonZgroup_reason)rZgoalr+�namesZpkg�reasonrrr�run_transaction�szGroupCommand.run_transaction)rrr)rr)rr
r
rrrr)�__name__�
__module__�__qualname__�__doc__rr[�keys�aliasesrrrrerqrr!r*r7r>rCrTrcrdrgrh�staticmethodrsrvrzr~�
__classcell__rr)r$rr	$s8

h
/*r	)Z
__future__rrZ	dnf.compsrZdnf.clirZdnf.i18nrrZlibdnf.transactionr]rZdnf.exceptionsZdnf.utilZloggingZ	getLoggerr@ZCommandr	rrrr�<module>s


?>