3 ft`]@slddlmZddlmZddlmZddlmZddlmZddl Z ddl Z e j dZ Gdd d ejZdS) )absolute_import)unicode_literals)commands) OptionParser)_Ndnfc@s8eZdZdZd ZedZeddZddZ d d Z d S) ReinstallCommandzSA class containing methods needed by the cli to execute the reinstall command. reinstallreizreinstall a packagecCs"|jddtdtjtdddS)Npackages+zPackage to reinstallZPACKAGE)nargshelpactionmetavar) add_argumentrrZParseSpecGroupFileCallback)parserr/usr/lib/python3.6/reinstall.py set_argparser(szReinstallCommand.set_argparsercCsH|jj}d|_d|_d|_d|_tj|j|j|j j sDtj |jdS)a Verify that conditions are met so that this command can run. These include that the program is being run by the root user, that there are enabled repositories with gpg keys, and that this command is called with appropriate arguments. TN) ZclidemandsZsack_activationZavailable_reposZ resolvingZ root_userrZ _checkGPGKeybaseopts filenamesZ_checkEnabledRepo)selfrrrr configure.szReinstallCommand.configurecCsd}xp|jj|jjd|jjjdD]P}y|jj|Wn6tjj k rlt j t d|jjj j|jYq"Xd}q"WxD|jjdd|jjDD]$}y|jj|Wntjjk r}zPx,|jD]"}t j t d|jj j|jPqWt j t d|jjj j|WYdd}~Xqtjjk r}z^xV|jD]L}d}|jjj|}|rdt d |}t d }t j ||jjj j||qLsz(ReinstallCommand.run..z(Package %s available, but not installed.z (from %s)z%Installed package %s%s not available.z!No packages marked for reinstall.)rZadd_remote_rpmsrroutputrZpackage_reinstallr exceptionsZ MarkingErrorloggerinforZtermZboldlocationZ pkg_specsZ grp_specsr ZPackagesNotInstalledErrorr nameZPackagesNotAvailableErrorhistoryZrepoError)rdoneZpkgZpkg_specerrZxmsgZpkgrepomsgrrrrun=sB $   "  zReinstallCommand.runN)r r ) __name__ __module__ __qualname____doc__aliasesrZsummary staticmethodrrr.rrrrr!s  r)Z __future__rrZdnf.clirZdnf.cli.option_parserrZdnf.i18nrZdnf.exceptionsrZloggingZ getLoggerr%ZCommandrrrrrs