3 ft`S @ s d dl mZ d dl mZ d dlZd dlmZ d dlZd dlZd dl m Z d dlmZ d dl mZ ejdZG d d d e jZdS ) )absolute_import)unicode_literalsN)chain)commands)OptionParser)_dnfc @ s e Zd ZdZejejejdZdZ de ej Ze dZedd Zd d Zdd 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({})installlocalinstallinz,install a package or packages on your systemc C s" | j ddtdtjtdd d S )Npackage+ZPACKAGEzPackage to install)nargsmetavaractionhelp)add_argumentr r ZParseSpecGroupFileCallback)parser r /usr/lib/python3.6/install.py set_argparser1 s zInstallCommand.set_argparserc C sH | j j}d|_d|_d|_d|_tj| j| j | j j sDtj| j dS )zVerify 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)clidemandsZsack_activationZavailable_reposZ resolvingZ root_userr Z_checkGPGKeybaseopts filenamesZ_checkEnabledRepo)selfr r r r configure7 s zInstallCommand.configurec C sP g }g }g }| j }| jj| j | jjdkrf| jjs>| jjrf| j| jj | jj j rftjj tdg }| jjo|| jjdkrTtjjrLy,tjjj| j}|j| jj| jj j d W n tjjk rH } zp|jrx|jD ]}|j| qW |jrx|jD ]}|jd| qW |j} | r8tjtjjj| d W Y d d }~X nX n| jj}| jjr|r| j| jj | jj j rtjj tdn| j }|r|r| j| | jj j rtjj tdn|r| jjdkr| j| | jjdkr| j |}t!|dks$t!|dks$|rL| jj j rLtjj"tddj#||dd S ) Nr zNothing to do.)strict@r zUnable to find a match )pkg_specZpackages)$_get_nevra_forms_from_commandr Z _populate_update_security_filterr command grp_specs pkg_specs_log_not_valid_rpm_file_pathsr confr r exceptionsErrorr ZWITH_MODULESmodulemodule_baseZ ModuleBaser Z MarkingErrorsZno_match_group_specsappendZerror_group_specsmodule_depsolv_errorsloggererrorZformat_modular_solver_errorsr _inform_not_a_valid_combination_install_files_install_groups_install_packageslenZPackagesNotAvailableErrorjoin) r err_pkgserrsZerror_module_specsnevra_formsZskipped_grp_specsr, eZe_specr. r r r runE sX .zInstallCommand.runc C s&