Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/apt/progress/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/apt/progress/base.pyc


WRc@sdZddlZddlZddlZddlZddlZddlZddlZddddgZde	fdYZ
de	fdYZde	fd	YZde	fd
YZ
dS(sBase 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.
iNtAcquireProgresst
CdromProgresstInstallProgresst
OpProgresscBszeZdZdZZZZZdZZ	Z
dZdZdZ
dZdZdZd	Zd
ZRS(sMonitor 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.pytdone0scCsdS(s*Invoked when an item could not be fetched.N((RR((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytfail3scCsdS(s0Invoked when some of the item's data is fetched.N((RR((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytfetch6scCsdS(sInvoked 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_hit9scCstS(sPrompt the user to change the inserted removable media.

        The parameter 'media' decribes the name of the 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_changeAscCstS(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.pytpulseNs
cCsLd|_d|_d|_d|_d|_d|_d|_d|_dS(s0Invoked when the Acquire process starts running.giN(t
current_bytestcurrent_cpst
current_itemstelapsed_timet
fetched_bytest
last_bytesttotal_bytesttotal_items(R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytstartZs							cCsdS(s/Invoked when the Acquire process stops running.N((R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytstopfs(t__name__t
__module__t__doc__RRRRRRRRRRRR	R
RRR(((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyR%s					
		cBs/eZdZdZdZdZdZRS(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_nametscCsdS(sAsk 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(sPeriodically 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.pytupdates(RRRttotal_stepsRRR"(((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyRjs
		cBseZdZd\ZZZZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZRS(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_updatescCsdS(s+(Abstract) Called when update has finished.N((R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt
finish_updatescCsdS(s>(Abstract) Called when a error is detected during the install.N((Rtpkgterrormsg((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyterrorscCsdS(sA(Abstract) Called when a conffile question from dpkg is detected.N((RR!tnew((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytconffilescCsdS(s.(Abstract) Called when the APT status changed.N((RR4tpercenttstatus((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt
status_changescCsdS(s/(Abstract) Called when the dpkg status changed.N((RR4R:((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytdpkg_status_changescCsdS(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((RR4tstage((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt
processingsc	Cs|j}|dkry#tj|j|jjWqtk
rtjtjtjdddt	|jjd|qt
k
r}tjj
d|tjtjjqXn||_|j}tj|S(sInstall 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_childtWEXITSTATUS(Rtobjtpidtetres((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytruns#

	cCs
tjS(sFork.(R'R@(R((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyR@sc	Csy|jj}WnCtk
rX}|jtjkrT|jtjkrT|jGHndSXd}}}}}|jdry"|jdd\}}}}Wqdt	k
rdSXn|jdry"|jdd\}}}}Wqdt	k
r|jdd\}}}qdXnI|jdrd|jdd\}}}|j
|j|jn|j}|j}|j}|d	ks|d
kr|j||n|dks|dkrt
jd
|}|r|j|jd|jdqn|dkr~t||jks;||jkr|j|t||jt||_|j|_qn|dkr|j||ndS(sUpdate the interface.NR$tpmt:iR:iR>tpmerrorR6sconffile-promptt
pmconffiles\s*'(.*)'\s*'(.*)'.*itpmstatus(R-treadlinetIOErrorterrnotEAGAINtEWOULDBLOCKtstrerrort
startswithtsplitt
ValueErrorR>tstripR6tretmatchR8tgrouptfloatR9R:R;R<(	RtlineterrtpkgnameR:t
status_strR9tbaseRg((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pytupdate_interfacesH$"
"
"($cCsd\}}xtry#tj|jggg|jWn1tjk
rk\}}|tjkrlqlnX|jy5tj	|j
tj\}}||j
krPnWqtk
r}|jtj
krPn|jtjkrqqXqW|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_timeoutR6R^tEINTRRoR'twaitpidROtWNOHANGtOSErrortECHILD(RRSRUterrno_t_errstrRk((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyRPs&	

(igg?R$(RRRROR9RqR:R1R2R3R6R8R;R<R>RVR@RoRP(((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyRs									!		/cBsAeZdZedddf\ZZZZddZ	dZ
RS(sbMonitor objects for operations.

    Display the progress of operations such as opening the cache.R$gcCs|dk	r||_ndS(sCalled periodically to update the user interface.

        You may use the optional argument 'percent' to set the attribute
        'percent' in this call.
        N(tNoneR9(RR9((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.pyR1sN(RRRR
tmajor_changetopR9tsubopRyR"R(((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyR!s	(RR^R.R'RfRpRIRLt__all__tobjectRRRR(((s5/usr/lib/python2.7/dist-packages/apt/progress/base.pyt<module>sE