ó ±sã_c@sØdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddddgZ de fd„ƒYZ de fd „ƒYZ de fd „ƒYZde fd „ƒYZdS( sªBase classes for progress reporting. Custom progress classes should inherit from these classes. They can also be used as dummy progress classes which simply do nothing. iÿÿÿÿ(tprint_functionNtAcquireProgresst CdromProgresstInstallProgresst OpProgresscBszeZdZdZZZZZdZZ Z d„Z d„Z d„Z d„Zd„Zd„Zd „Zd „ZRS( s·Monitor object for downloads controlled by the Acquire class. This is an mostly abstract class. You should subclass it and implement the methods to get something useful. gicCsdS(s<Invoked when an item is successfully and completely fetched.N((tselftitem((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytdone2scCsdS(s*Invoked when an item could not be fetched.N((RR((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytfail5scCsdS(s0Invoked when some of the item's data is fetched.N((RR((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytfetch8scCsdS(sçInvoked when an item is confirmed to be up-to-date. Invoked when an item is confirmed to be up-to-date. For instance, when an HTTP download is informed that the file on the server was not modified. N((RR((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytims_hit;scCstS(sóPrompt the user to change the inserted removable media. The parameter 'media' decribes the name of the media type that should be changed, whereas the parameter 'drive' should be the identifying name of the drive whose media should be changed. This method should not return until the user has confirmed to the user interface that the media change is complete. It must return True if the user confirms the media change, or False to cancel it. (tFalse(Rtmediatdrive((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt media_changeCs cCstS(sPeriodically invoked while the Acquire process is underway. This method gets invoked while the Acquire progress given by the parameter 'owner' is underway. It should display information about the current state. This function returns a boolean value indicating whether the acquisition should be continued (True) or cancelled (False). (tTrue(Rtowner((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytpulsePs cCsLd|_d|_d|_d|_d|_d|_d|_d|_dS(s0Invoked when the Acquire process starts running.giN(t current_bytest current_cpst current_itemst elapsed_timet fetched_bytest last_bytest total_bytest total_items(R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytstart\s       cCsdS(s/Invoked when the Acquire process stops running.N((R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytstophs(t__name__t __module__t__doc__RRRRRRRRRRR R RRRR(((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyR's     cBs/eZdZdZd„Zd„Zd„ZRS(s Base class for reporting the progress of adding a cdrom. Can be used with apt_pkg.Cdrom to produce an utility like apt-cdrom. The attribute 'total_steps' defines the total number of steps and can be used in update() to display the current progress. icCsdS(sAsk for the name of the cdrom. If a name has been provided, return it. Otherwise, return None to cancel the operation. N((R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytask_cdrom_namevscCsdS(s‰Ask for the CD-ROM to be changed. Return True once the cdrom has been changed or False to cancel the operation. N((R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt change_cdrom}scCsdS(sÂPeriodically invoked to update the interface. The string 'text' defines the text which should be displayed. The integer 'current' defines the number of completed steps. N((Rttexttcurrent((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytupdate„s(RRRt total_stepsRR R#(((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyRls   cBsŒeZdZd\ZZZZd„Zd„Zd„Z d„Z d „Z d „Z d „Z d „Zd „Zd„Zd„Zd„ZRS(s4Class to report the progress of installing packages.iggš™™™™™¹?tcCshtjƒ\|_|_tj|jdƒ|_tj|jdƒ|_tj|jtjtj ƒdS(Ntwtr( tostpipetstatusfdtwritefdtfdopent write_streamt status_streamtfcntltF_SETFLt O_NONBLOCK(R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt__init__‘scCsdS(s(Abstract) Start update.N((R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt start_update˜scCsdS(s+(Abstract) Called when update has finished.N((R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt finish_update›scCsdS(s>(Abstract) Called when a error is detected during the install.N((Rtpkgterrormsg((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyterroržscCsdS(sA(Abstract) Called when a conffile question from dpkg is detected.N((RR"tnew((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytconffile¡scCsdS(s.(Abstract) Called when the APT status changed.N((RR5tpercenttstatus((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt status_change¤scCsdS(s/(Abstract) Called when the dpkg status changed.N((RR5R;((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytdpkg_status_change§scCsdS(sú(Abstract) Sent just before a processing stage starts. The parameter 'stage' is one of "upgrade", "install" (both sent before unpacking), "configure", "trigproc", "remove", "purge". This method is used for dpkg only. N((RR5tstage((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt processingªsc Csç|jƒ}|dkrÅy#tj|j|jjƒƒƒWqÅtk rˆtjtjtjdddt |jjƒƒd|ƒƒqÅt k rÁ}t j j d|ƒtjtjjƒqÅXn||_|jƒ}tj|ƒS(sáInstall using the object 'obj'. This functions runs install actions. The parameter 'obj' may either be a PackageManager object in which case its do_install() method is called or the path to a deb file. If the object is a PackageManager, the functions returns the result of calling its do_install() method. Otherwise, the function returns the exit status of dpkg. In both cases, 0 means that there were no problems. itdpkgs --status-fds-is%s (tforkR(t_exitt do_installR-tfilenotAttributeErrortspawnlptP_WAITtstrt Exceptiontsyststderrtwritetapt_pkgtPackageManagert RESULT_FAILEDt child_pidt wait_childt WEXITSTATUS(Rtobjtpidtetres((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytrun²s  #    cCs tjƒS(sFork.(R(RA(R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyRAÓsc Cs¦y|jjƒ}WnHtk r]}|jtjkrY|jtjkrYt|jƒndSXd}}}}}|jdƒr½y"|j ddƒ\}}}}Wqit k r¹dSXn¬|jdƒr y"|j ddƒ\}}}}Wqit k r|j ddƒ\}}}qiXnI|jdƒri|j ddƒ\}}}|j |j ƒ|j ƒƒn|j ƒ}|j ƒ}|j ƒ}|d ks¥|d kr¸|j ||ƒnê|d ksÐ|d krtjd |ƒ}|r¢|j|jdƒ|jdƒƒq¢n’|dkrƒt|ƒ|jks@||jkr¢|j|t|ƒ|j ƒƒt|ƒ|_|j ƒ|_q¢n|dkr¢|j||ƒndS(sUpdate the interface.NR%tpmt:iR;iR?tpmerrorR7sconffile-promptt pmconffiles\s*'(.*)'\s*'(.*)'.*itpmstatus(R.treadlinetIOErrorterrnotEAGAINt EWOULDBLOCKtprinttstrerrort startswithtsplitt ValueErrorR?tstripR7tretmatchR9tgrouptfloatR:R;R<R=( RtlineterrtpkgnameR;t status_strR:tbaseRi((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytupdate_interface×sH$" " "   ( $ cCsd\}}xítrûy#tj|jggg|jƒWn:tjk rt}|j\}}|tjkru‚qunX|jƒy5t j |j t j ƒ\}}||j kr³PnWqt k r÷}|jtjkrÜPn|jtjkrø‚qøqXqW|S(sWait for child progress to exit. This method is responsible for calling update_interface() from time to time. It exits once the child has exited. The return values is the full status returned from os.waitpid() (not only the return code). i(ii(RtselectR.tselect_timeoutR7targsR_tEINTRRqR(twaitpidRPtWNOHANGtOSErrortECHILD(RRTRVR7terrno_t_errstrRm((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyRQs(    (iggš™™™™™¹?R%(RRRRPR:RsR;R2R3R4R7R9R<R=R?RWRARqRQ(((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyRŒs         !  /cBsAeZdZedddf\ZZZZdd„Z d„Z RS(sbMonitor objects for operations. Display the progress of operations such as opening the cache.R%gcCs|dk r||_ndS(s¤Called periodically to update the user interface. You may use the optional argument 'percent' to set the attribute 'percent' in this call. N(tNoneR:(RR:((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyR#,s cCsdS(s,Called once an operation has been completed.N((R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyR5sN( RRRR t major_changetopR:tsubopR|R#R(((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyR%s (Rt __future__RR_R/R(RhRrRJRMt__all__tobjectRRRR(((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyts       E ™