3 ft`f@sPdZddlmZddlmZddlmZddlmZddlmZddl m Z ddl m Z dd l mZdd l mZdd lZdd lZdd l Zdd lZdd l Zdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZdd lZejd Zd dZddZ eee fddZ!ddZ"ddZ#ddZ$d ddZ%e&dkrLe%ej'dd ddd S)!z4 Entrance point for the yum command line interface. )print_function)absolute_import)unicode_literals)Conf)Cli) OptionParser)ucd)show_lock_owner)_NdnfcCs&tjtjjdddtjt|dS)NT)exc_info)loggerlogr loggingSUBDEBUGcriticalr)er/usr/lib/python3.6/main.py ex_IOError2srcCs6tjtjjddd|jdk r2tjtdt|dS)Nr T)r z Error: %sr) rrr rrvaluerr r)rrrrex_Error8s rcCsy6tjjtjjj|}t||||SQRXWntjjk rr}ztj |j t |j dSd}~XnLtjj k r}ztj |j dSd}~Xntjjk r}zdSd}~Xntjjk r}zt|Sd}~Xntjk r$}ztj tdt|dSd}~Xntjjk r\}ztj tdt|dSd}~Xnbtk r}zt|Sd}~Xn>tk r}z tj djt|jtddSd}~XnXdS)Nrz Error: %sz{}: {}z Terminated.)r Zi18nZ setup_stdoutcliZBaseCli_main exceptionsZProcessLockErrorrrrr pid LockError DepsolveErrorErrorrhawkey Exceptionr rlibdnferrorIOErrorrKeyboardInterruptformattype__name__)argsZ conf_class cli_classZoption_parser_classbaserrrrmain?s4    r.cCsb|jj||}y|jttt||Wn(ttfk rV}zt|Sd}~XnXt ||S)z2Run the dnf program from a command line interface.N) Z_loggingZ _presetupZ configurelistmaprr&OSErrorrcli_run)r-r+r,Z option_parserrrrrrr\s rc,Csy td}WnFtk rR}z*|jtjkrBtjtdtjdWYdd}~Xn X|j y |j Wn@t j j k rYn(ttfk r}zt|Sd}~XnX|jjryt||}Wnt j jk r}zt|d}|jj r|jjddr|tdjd7}|jjjrN|s<|td jd 7}n|td jd 7}|jjjr|jjjd }|t jjkr|s|td jd7}n|tdjd7}|rtjdj|WYdd}~XnX|r|S|jj |jj!S)N.z8No read/execute access in current directory, moving to //r T)Z availablez?try to add '{}' to command line to replace conflicting packagesz--allowerasingz.try to add '{}' to skip uninstallable packagesz --skip-brokenz' or '{}' to skip uninstallable packagesbestz7try to add '{}' to use not only best candidate packagesz--nobestz0 or '{}' to use not only best candidate packagesz({}))"openr&errnoZEACCESrrr oschdircloseZrunr rrr1rdemands resolvingr r allow_erasingZ_goalZproblem_conflictsr(r-Zconfstrictr5Z _get_priorityZPRIO_MAINCONFIGinfocommandZrun_transactionZsuccess_exit_status)rr-frretmsgZpriorrrr2msT             r2cCs |jdkr&|j|jjtjtd|jjg}|jj dk rN|j |jj y|j |dWnt j jk r}ztjt|dSd}~Xnvt jjk r}z$x|jj|D]}tj|qWdSd}~Xn4tk r}zt|Sd}~XnXtjtddS)z9Perform the depsolve, download and RPM transaction stage.NzDependencies resolved.)Zdisplayrz Complete!r)Z transactionZresolver;r=rr?r r@Z run_resolvedZtransaction_displayappendZdo_transactionr rZCliErrorr%rrZTransactionCheckErrorZget_error_outputrr&r)rr-ZdisplaysexcerrrCrrrrr<s(   r<FcCst|}|rtj||S)apCall one of the multiple main() functions based on environment variables. :param args: command line arguments passed into yum :param exit_code: if *exit_code* is True, this function will exit python with its exit code when it has finished executing. Otherwise, it will return its exit code. :return: the exit code from dnf.yum execution )r.sysexit)r+ exit_codeZerrcoderrr user_mains  rJ__main__rT)rI)F)(__doc__Z __future__rrrZdnf.confrZ dnf.cli.clirZdnf.cli.option_parserrZdnf.i18nrZ dnf.cli.utilsr r Zdnf.clir Zdnf.exceptionsZ dnf.loggingZdnf.utilr7r"Z libdnf.errorr$rr8Zos.pathrGZ getLoggerrrrr.rr2r<rJr*argvrrrrsB          5