Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/debian/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/debian/debian_support.pyc


}Nc@sCdZddlZddlZddlZddlZddlmZy ddlZeje	Z
Wnek
reZ
nXde
fdYZdefdYZdefd	YZd
efdYZe
rdefd
YZndefdYZdZdd!dYZdd"dYZdefdYZdZeeZedZeeZ[[dZeeZejddZeeZ dZ!ee!Z"dZ#ee#Z$dZ%ee%Z&dZ'ee'Z(ddZ*ee*Z+d Z,ee,Z-dS(#sHThis module implements facilities to deal with Debian-specific metadata.iN(tfunction_deprecated_byt
ParseErrorcBs>eZdZdZdZdZdZeeZRS(sAn exception which is used to signal a parse failure.

    Attributes:

    filename - name of the file
    lineno - line number in the file
    msg - error message

    cCs:t|tjkst||_||_||_dS(N(ttypettypestIntTypetAssertionErrortfilenametlinenotmsg(tselfRRR((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__init__.s		cCs|jS(N(R(R	((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__str__4scCsd|j
|j|j
fS(NsParseError(%s, %d, %s)(RRR(R	((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__repr__7s
cCs1|jd|j|j|jf|jdS(s0Writes a machine-parsable error message to file.s
%s:%d: %s
N(twriteRRRtflush(R	tfile((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt	print_out<s#(	t__name__t
__module__t__doc__R
RRRRtprintOut(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR#s					tBaseVersioncBsteZdZejdZdZdZdZd	Z	d
Z
dZdZd
Z
dZdZRS(sBase class for classes representing Debian versions

    It doesn't implement any comparison, but it does check for valid versions
    according to Section 5.6.12 in the Debian Policy Manual.  Since splitting
    the version into epoch, upstream_version, and debian_revision components is
    pretty much free with the validation, it sets those fields as properties of
    the object, and sets the raw version to the full_version property.  A
    missing epoch or debian_revision results in the respective property set to
    None.  Setting any of the properties results in the full_version being
    recomputed and the rest of the properties set from that.

    It also implements __str__, just returning the raw version given to the
    initializer.
    sd^((?P<epoch>\d+):)?(?P<upstream_version>[A-Za-z0-9.+:~-]+?)(-(?P<debian_revision>[A-Za-z0-9+.~]+))?$tfull_versiontepochtupstream_versiontdebian_revisiontdebian_versioncCs
||_dS(N(R(R	tversion((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR
ZscCs|jj|}|s+td|n|jddkrhd|jdkrhtd|n||_|jd|_|jd|_|jd|_dS(NsInvalid version string %rRt:RR(	tre_valid_versiontmatcht
ValueErrortgrouptNonet_BaseVersion__full_versiont_BaseVersion__epocht_BaseVersion__upstream_versiont_BaseVersion__debian_revision(R	Rtm((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt_set_full_version]s*	cCs||jkr,tt|j||dS|dkrAd}n|dkrc|jt|n|dk	r~t|}nd|}t||}t|||y|j	WnAt
k
rt||||j	t
d||fnXdS(NRRRs_BaseVersion__%ss+Setting %s to %r results in invalid version(tmagic_attrstsuperRt__setattr__R'tstrR!tgetattrtsetattrt_update_full_versionR(R	tattrtvaluetprivatet	old_value((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR*ks&	


cCsQ||jkr%tt|j|S|dkr:d}nd|}t||S(NRRs_BaseVersion__%s(R(R)Rt__getattribute__R,(R	R/R1((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__getattr__s	
cCs`d}|jdk	r)||jd7}n||j7}|jrS|d|j7}n||_dS(NtRt-(R#R!R$R%R(R	R((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR.s
	cCs|jS(N(R(R	((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRscCsd|jj|fS(Ns%s('%s')(t	__class__R(R	((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRscCs
tdS(N(tNotImplementedError(R	tother((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__cmp__scCstt|S(N(thashR+(R	((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__hash__s(sfull_versionsepochsupstream_versionsdebian_revisionsdebian_version(RRRtretcompileRR(R
R'R*R4R.RRR:R<(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRCs										t
AptPkgVersioncBs eZdZdZdZRS(sARepresents a Debian package version, using apt_pkg.VersionComparecCs/tstdntt|j|dS(Ns5apt_pkg not available; install the python-apt package(t
_have_apt_pkgR8R)R?R
(R	R((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR
scCstjt|t|S(N(tapt_pkgtversion_compareR+(R	R9((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR:s(RRRR
R:(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR?s	t
NativeVersioncBseZdZejdZejdZejdZejdZdZ	e
dZe
dZe
dZ
RS(	sBRepresents a Debian package version, with native Python comparisons\d+|\D+s\d+s\ds[A-Za-z]cCst|tsTytt|}WqTtk
rP}td||fqTXntt|jpfdt|jpxd}|dkr|S|j|j|j}|dkr|S|j|j	pd|j	pdS(Ns&Couldn't convert %r to BaseVersion: %st0i(
t
isinstanceRR+RtcmptintRt_version_cmp_partRR(R	R9tetres((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR:s-cCs^|dkrdS|jj|r0t|dS|jj|rLt|St|dSdS(s'Return an integer value for character xt~iiiN(tre_digitRRGtre_alphatord(tclstx((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt_orders
c	Csg|D]}|j|^q}g|D]}|j|^q)}xk|sS|rd}d}|rw|jd}n|r|jd}nt||}|dkrG|SqGWdS(Ni(RQtpopRF(	ROtvatvbRPtlatlbtatbRJ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt_version_cmp_strings""cCs|jj|}|jj|}x|s3|rd}d}|rW|jd}n|ro|jd}n|jj|r|jj|rt|}t|}t||}|dkr|Sq'|j||}|dkr'|Sq'WdS(NRDi(tre_all_digits_or_nottfindallRRt	re_digitsRRGRFRY(RORSRTRURVRWRXRJ((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRHs&$(RRRR=R>RZR\RLRMR:tclassmethodRQRYRH(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRCs	tVersioncBseZRS((RR(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR^scBseZRS((RR(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR^scCstt|t|S(N(RFR^(RWRX((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRBstPackageFilecBsYeZdZejdZejdZddZdZ	ddZ
ee
ZRS(smA Debian package file.

    Objects of this class can be used to read Debian's Source and
    Packages files.s*^([A-Za-z][A-Za-z0-9-]+):(?:\s*(.*?))?\s*$s^\s+(?:\.|(\S.*?)\s*)$cCs:|dkrt|}n||_||_d|_dS(sCreates a new package file object.

        name - the name of the file the data comes from
        file_obj - an alternate data source; the default is to open the
                  file with the indicated name.
        iN(R!RtnameR(R	R`tfile_obj((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR
s
		ccs}|jj}|jd7_g}xD|rj|jddkrt|dkrd|jdn|Vg}|jj}|jd7_q'n|jj|}|s|jdn|j\}}|pd}xxt	rS|jj}|jd7_|j
j|}|rO|j\}|dkr<d}nd||f}qPqW|j||fq'W|ry|VndS(	Nis 	s
isexpected package recordsexpected package fieldR5s%s
%s(
RtreadlineRtstriptlentraise_syntax_errortre_fieldRtgroupstTruetre_continuationR!tappend(R	tlinetpkgRR`tcontentst	ncontents((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt__iter__$s<			cCs1|dkr|j}nt|j||dS(N(R!RRR`(R	RR((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyReGsN(
RRRR=R>RfRiR!R
RoReRtraiseSyntaxError(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR_s
	#t
PseudoEnumcBs;eZdZdZdZdZdZdZRS(s8A base class for types which resemble enumeration types.cCs||_||_dS(N(t_nameRQ(R	R`torder((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR
Ps	cCsd|jjt
fS(Ns%s(%s)(R7t_name__R`(R	((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRSscCs|jS(N(Rr(R	((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRUscCst|j|jS(N(RFRQ(R	R9((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR:WscCs
t|jS(N(R;RQ(R	((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyR<Ys(RRRR
RRR:R<(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRqNs				tReleasecBseZRS((RR(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyRu\scCsQi}d}x5tt|D]!}t||||||<qW|t_|S(Ntpotatotwoodytsargetetchtlennytsid(RvRwRxRyRzR{(trangeRdRutreleases(R}trelstr((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt
list_releases^s	cCs|j|r||SdSdS(N(thas_keyR!(R`R}((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pytintern_releasehscCs4tj}x|D]}|j|qW|jS(N(thashlibtsha1tupdatet	hexdigest(tlinesR&tl((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pytread_lines_sha1ss
s^(\d+)(?:,(\d+))?([acd])$c
cst|}xy|D]q}|j|}|d
krEtd|
n|j\}}}t|}|d
k	rt|}n|dkr|d}|d
kr|d}n||gfVqn|dkr|d
k	rtd|
n|}n#|d}|d
kr|d}ng}xT|D]L}	|	dkrItd|
n|	dksa|	d	krePn|j|	q&W|||fVqWd
S(s1Converts source to a stream of patches.

    Patches are triples of line indexes:

    - number of the first line to be replaced
    - one plus the number of the last line to be replaced
    - list of line replacements

    This is enough to model arbitrary additions, deletions and
    replacements.
    sinvalid patch command: tdiRWsinvalid patch argument: R5send of stream in command: s.
t.N(titerRR!RRgRGRj(
tsourcetre_cmdtiRkRtfirsttlasttcmdRR((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pytpatches_from_ed_script{s<


	


cCs+x$|D]\}}}||||+qWdS(s2Applies patches to lines.  Updates lines in place.N((RtpatchesRRtargs((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pytpatch_linesscCsddl}|d}t|d}z<x|D]}|j|q/W|j|j||Wd|jj|r|j|nXdS(Nis.newsw+(tos.pathRR
tclosetrenametpathtexiststunlink(Rtlocaltost	local_newtnew_fileR((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pytreplace_files


c
Csddl}ddl}ddl}|j\}}zNtj||j||\}}|j|}|j}	|jWdtj	|X|	S(s[Downloads a file from a remote location and gunzips it.

    Returns the lines in the file.iN(
tgzipttempfileturllibtmkstempRRturlretrievetGzipFilet	readlinesR(
tremoteRRRthandletfnameRtheaderstgfileR((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pytdownload_gunzip_liness
cCs!t|d}t|||S(sCopies a gzipped remote file to the local system.

    remote - URL, without the .gz suffix
    local - name of the local file
    s.gz(RR(RRR((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt
download_files
cCs.yt|}Wn)tk
r;|r.dGHnt||SX|j}|jt|}g}i}ddl}|d}	tjd}
y(|j	|	}t
t|	|}WnQtk
r|rdGHnt||Stk
r
|rdGHnt||SXxO|D]G}
x>|
D]6\}}|dkrp|
j
|\}}||kr|rfd	GHn|Sqn|d
krx`|jD]R}|dkrqn|
j
|\}}}|s||kr|j|qqWqn|dkrBxH|jD]:}|dkrqn|
j
|\}}}|||<qWqn|rd
|
GHqqWqW|s|rudG|GHnt||Sxj|D]b}d|
GHt|d|d}t|||krtd|
nt|t|qWt|}||krtd||fnt|||S(sjUpdates the local file by downloading a remote patch.

    Returns a list of lines in the local file.
    s1update_file: no local copy, downloading full fileiNs.diff/Indexs\s+s1update_file: could not interpret patch index files0update_file: could not download patch index filesSHA1-Currents%update_file: local file is up-to-datesSHA1-HistoryR5sSHA1-Patchessupdate_file: field %s ignoreds*update_file: could not find historic entrysupdate_file: downloading patch s.diff/s.gzspatch %s was garbleds"patch failed, got %s instead of %s(RtIOErrorRRRRRR=R>turlopentlistR_Rtsplitt
splitlinesRjRRRRR(RRtverboset
local_fileRt
local_hashtpatches_to_applytpatch_hashesRt
index_namet
re_whitespacet	index_urltindex_fieldstfieldstfieldR0tremote_hashtremote_sizetentryt	hist_hasht	hist_sizet
patch_namet
patch_hasht
patch_sizetpatch_contentstnew_hash((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pytupdate_files










cGsLi}x)|D]!}x|D]}t||<qWq
W|j}|j|S(sdCreate an order set (represented as a list) of the objects in
    the sequences passed as arguments.(Rhtkeystsort(RtsRPtyR((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt
merge_as_setsPs


(((.RRR=RRtdeprecationRRAtinitRhR@tImportErrortFalset	ExceptionRtobjectRR?RCR^RBR_RqRuRtlistReleasesRt
internReleaseRt
readLinesSHA1R>RtpatchesFromEdScriptRt
patchLinesRtreplaceFileRtdownloadGunzipLinesRtdownloadFileR!Rt
updateFileRtmergeAsSets(((s9/usr/lib/python2.7/dist-packages/debian/debian_support.pyt<module>sX



 bQ	@		2				_