Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/landscape/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/landscape/patch.pyc


Tc@shddlZdefdYZdefdYZdefdYZdefd	YZdS(
iNtUpgraderConflictcBseZdZRS(s9Two upgraders with the same version have been registered.(t__name__t
__module__t__doc__(((s3/usr/lib/python2.7/dist-packages/landscape/patch.pyRstUpgradeManagerBasecBs2eZdZdZdZdZdZRS(sA simple upgrade system.cCs
i|_dS(N(t
_upgraders(tself((s3/usr/lib/python2.7/dist-packages/landscape/patch.pyt__init__scCsC||jkr2td||j||fn||j|<dS(sN
        @param version: The version number that this upgrader is
            upgrading the database to. This defines the order that
            upgraders are run.
        @param function: The function to call when applying
            upgraders. It must take a single object, the database that is
            being upgraded.
        s-%s is already registered as %s; not adding %sN(RR(Rtversiontfunction((s3/usr/lib/python2.7/dist-packages/landscape/patch.pytregister_upgraders	cCs#|jj}|rt|SdS(sp
        Get the 'current' version of any database that this
        UpgradeManager will be applied to.
        i(Rtkeystmax(RR((s3/usr/lib/python2.7/dist-packages/landscape/patch.pytget_versions
csfd}|S(s
        A decorator for specifying that a function is an upgrader for
        this upgrade manager.

        @param version: The version number that the function will be
            upgrading to.
        csj||S(N(R
(R	(RR(s3/usr/lib/python2.7/dist-packages/landscape/patch.pytinner/s((RRR((RRs3/usr/lib/python2.7/dist-packages/landscape/patch.pytupgrader's(RRRRR
R
R(((s3/usr/lib/python2.7/dist-packages/landscape/patch.pyRs
			
tUpgradeManagercBseZdZdZRS(cCs|jds"|jddnxft|jjD]O\}}||jdkr8|jd|||tjd|q8q8WdS(sBring the database up-to-date.

        @param persist: The database to upgrade. It will be passed to
            all upgrade functions.
        ssystem-versionisSuccessfully applied patch %sN(thastsettsortedRtitemstgettloggingtinfo(RtpersistRR((s3/usr/lib/python2.7/dist-packages/landscape/patch.pytapply7s"
cCs|jd|jdS(sk
        Mark the database as being up-to-date; use this when
        initializing a new database.
        ssystem-versionN(RR
(RR((s3/usr/lib/python2.7/dist-packages/landscape/patch.pyt
initializeEs(RRRR(((s3/usr/lib/python2.7/dist-packages/landscape/patch.pyR5s	tSQLiteUpgradeManagercBs;eZdZdZdZdZdZdZRS(s$An upgrade manager backed by sqlite.cCs:|jd|j}tg|D]}|d^q#S(NsSELECT version FROM patchi(texecutetfetchallR(Rtcursortresulttrow((s3/usr/lib/python2.7/dist-packages/landscape/patch.pytget_database_versionsPs
cCs+|jd|jd}|r'|SdS(NsSELECT MAX(version) FROM patchi(Rtfetchone(RRR((s3/usr/lib/python2.7/dist-packages/landscape/patch.pytget_database_versionUs

cCsX|j|}xBt|jjD]+\}}||kr%|j||q%q%WdS(sBring the database up-to-date.N(R!RRRt	apply_one(RRtversionsRR((s3/usr/lib/python2.7/dist-packages/landscape/patch.pyR\s"cCs.|j|}|||jd|fdS(NsINSERT INTO patch VALUES (?)(RR(RRRR((s3/usr/lib/python2.7/dist-packages/landscape/patch.pyR$cs

cCsJ|jdx6t|jjD]\}}|jd|fq#WdS(sr
        Mark the database as being up-to-date; use this when
        initializing a new SQLite database.
        s$CREATE TABLE patch (version INTEGER)sINSERT INTO patch VALUES (?)N(RRRR(RRRR((s3/usr/lib/python2.7/dist-packages/landscape/patch.pyRhs
"(RRRR!R#RR$R(((s3/usr/lib/python2.7/dist-packages/landscape/patch.pyRMs				(Rt	ExceptionRtobjectRRR(((s3/usr/lib/python2.7/dist-packages/landscape/patch.pyt<module>s-