ok

Mini Shell

Direktori : /lib/python3.6/site-packages/dnf/cli/commands/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/dnf/cli/commands/__pycache__/install.cpython-36.pyc

3

�ft`S�@s�ddlmZddlmZddlZddlmZddlZddlZddl	m
Z
ddlmZddl
mZejd�ZGd	d
�d
e
j�ZdS)�)�absolute_import)�unicode_literalsN)�chain)�commands)�OptionParser)�_�dnfc@s�eZdZdZejejejd�ZdZ	de
ej��Ze
d�Zedd	��Zd
d�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)�InstallCommandzUA class containing methods needed by the cli to execute the
    install command.
    )z	install-nz
install-naz
install-nevrazalternative-for({})�install�localinstall�inz,install a package or packages on your systemcCs"|jddtd�tjtd�d�dS)N�package�+ZPACKAGEzPackage to install)�nargs�metavar�action�help)�add_argumentrrZParseSpecGroupFileCallback)�parser�r�/usr/lib/python3.6/install.py�
set_argparser1szInstallCommand.set_argparsercCsH|jj}d|_d|_d|_d|_tj|j|j�|j	j
sDtj|j�dS)z�Verify that conditions are met so that this command can run.
        That there are enabled repositories with gpg keys, and that
        this command is called with appropriate arguments.
        TN)�cli�demandsZsack_activationZavailable_reposZ	resolvingZ	root_userrZ_checkGPGKey�base�opts�	filenamesZ_checkEnabledRepo)�selfrrrr�	configure7szInstallCommand.configurec
CsPg}g}g}|j�}|jj|j�|jjdkrf|jjs>|jjrf|j|jj�|jj	j
rftjj
td���g}|jjo||jjdk�rTtjj�rLy,tjjj|j�}|j|jj|jj	j
d�Wn�tjjk
�rH}zp|jr�x|jD]}|j|�q�W|j�rx|jD]}|jd|�q�W|j}	|	�r8tjtjjj|	d��WYdd}~XnXn|jj}|jj�r�|�r�|j|jj�|jj	j
�r�tjj
td���n|j�}|�r�|�r�|j|�|jj	j
�r�tjj
td���n|�r�|jjdk�r�|j|�|jjdk�r|j |�}t!|�dk�s$t!|�dk�s$|�rL|jj	j
�rLtjj"td�dj#|�|d��dS)	NrzNothing to do.)�strict�@rzUnable to find a match� )�pkg_specZpackages)$�_get_nevra_forms_from_commandrZ _populate_update_security_filterr�command�	grp_specs�	pkg_specs�_log_not_valid_rpm_file_pathsr�confrr�
exceptions�ErrorrZWITH_MODULES�module�module_baseZ
ModuleBaser
Z
MarkingErrorsZno_match_group_specs�appendZerror_group_specs�module_depsolv_errors�logger�errorZformat_modular_solver_errorsr�_inform_not_a_valid_combination�_install_files�_install_groups�_install_packages�lenZPackagesNotAvailableError�join)
r�err_pkgs�errsZerror_module_specs�nevra_formsZskipped_grp_specsr,�eZe_specr.rrr�runEsX

 


.zInstallCommand.runcCs&|jj|jkr|j|jjgSgSdS)N)rr$r9)rrrrr#zsz,InstallCommand._get_nevra_forms_from_commandcCsJtdd�|�}x6t|jj|�D]$}td�}tj||jjj	j
|��qWdS)NcSsd|S)Nr r)�grrr�<lambda>�sz>InstallCommand._log_not_valid_rpm_file_paths.<locals>.<lambda>zNot a valid rpm file path: %s)�maprrr&rr/�infor�output�term�bold)rr%Zgroup_names�pkg�msgrrrr'�sz,InstallCommand._log_not_valid_rpm_file_pathscCs2x,|D]$}td�}tj||jjjj|��qWdS)NzNot a valid form: %s)rr/Zwarningrr@rArB)r�formsZformrDrrrr1�s
z.InstallCommand._inform_not_a_valid_combinationcCs�g}|jjj}x~|jj|jj||jjjd�D]^}y|jj||d�Wq,t	j
jk
r�td�}t
j||jjjj|j��|j|�Yq,Xq,W|S)N)r�progress)rzNo match for argument: %s)rr(rZadd_remote_rpmsrrr@rFZpackage_installrr)�MarkingErrorrr/r?rArB�locationr-)rr7rrCrDrrrr2�s
zInstallCommand._install_filescCsPy&|jj|t|jjj�|jjjd�Wn$tjjk
rJ|jjjrF�YnXdS)N)r)	rZenv_group_install�tupler(Zgroup_package_typesrrr)r*)rr%rrrr3�s
zInstallCommand._install_groupscCsV|jjj�j|jj|�d�}|rRtd�}tj|j|dj	t
tdd�|D������dS)N)Zprovidesz/There are following alternatives for "{0}": {1}z, cSsg|]
}|j�qSr)�name)�.0Zaltrrr�
<listcomp>�sz7InstallCommand._report_alternatives.<locals>.<listcomp>)rZsack�queryZfilterm�alternatives_provide�formatrr/r?r6�sorted�set)rr"rMrDrrr�_report_alternatives�sz#InstallCommand._report_alternativescCs�g}|jjj}x�|jjD]�}y|jj|||d�Wqtjjk
r�}zJdj	|j
|jjjj
|��}tj|�|jj|�|j|�|j|�WYdd}~XqXqW|S)N)rrEz{}: {})rr(rrr&r
rr)rGrO�valuer@rArBr/r?Z_report_icase_hintrRr-)rr9r8rr"r:rDrrrr4�s


 z InstallCommand._install_packagesN)r
rr)�__name__�
__module__�__qualname__�__doc__�hawkeyZ	FORM_NAMEZFORM_NAZ
FORM_NEVRAr9rNrI�keys�aliasesrZsummary�staticmethodrrr;r#r'r1r2r3rRr4rrrrr	%s"
5		r	)Z
__future__rrZlogging�	itertoolsrrXZdnf.exceptionsrZdnf.clirZdnf.cli.option_parserrZdnf.i18nrZ	getLoggerr/ZCommandr	rrrr�<module>s


Zerion Mini Shell 1.0