s_c@s ddlZddlZddlZddlZddlZddlmZddlmZde fdYZ de fdYZ de fd YZ d e fd YZd efd YZdZdZdfdYZeeeegdZdS(iN(t ElementTree(tgettexttNoDistroTemplateExceptioncBseZRS((t__name__t __module__(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR%st DistributioncBseZgdZdZd dZdZdZd d d d ddZdZ dZ d Z d Z d Z RS( cCsC||_||_||_||_||_d|_d|_dS(s2 Container for distribution specific informations tdebsdeb-srcN(tidtcodenamet descriptiontreleasetis_liket binary_typet source_type(tselfRRR R R ((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt__init__+s      cCs||_d|_g|_g|_g|_g|_g|_g|_g|_ g|_ t |_ g|_ d|_d|_d|_g|_xH|jjjD]7}|j|jr|j|jkr||_PqqW|jdkr td|j|jfng}g}g}g}x4|jjD]&}|j r|j|jr|jr|jjr|j|jjr|jj dr|j! r|jj"||j#|j$q|jj dr|j!r|jj"|q|j%|j&kr6|j! r6|jj"||j#|j$|j"|jq|j%|j&krd|j!rd|jj"|q|j%|j'kr|j! r|j j"|q|j%|j'kr|j!r|jj"|qn|j r.|j|jj(kr.|j! r|j%|j&kr|jj"|qT|j! rA|j%|j'krA|j j"|qT|jj"|q.q.Wt)||_t)||_ |j#||j#|t)||_t)||_ |j*dS(sf Find the corresponding template, main and child sources for the distribution ts7Error: could not find a distribution template for %s/%sscdrom:N(+t sourceslisttNonetsource_templatet child_sourcest main_sourcestdisabled_sourcest cdrom_sourcestdownload_compst enabled_compst cdrom_compst used_mediatFalsetget_source_codetsource_code_sourcestdefault_servert main_servertnearest_servert used_serverstmatchert templatest is_codenametnamet distributionRRRtlisttinvalidtdistttemplatetofficialturit startswithtdisabledtappendtextendtcompsttypeR R tchildrentsett get_mirrors(RRR+tmediaR2RRtsource((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt get_sources7s                               c Cs5|jj|_x3|jD](}|jds|jj|qqWt|jdkri|j|_ n|jdj |_ i|_ d}t j j|rytd|}t|dddkr|j|_n|jd}x|D]}y|jd}Wntk r |jd}nXy|jd }Wntk rR|jd }nXtjd ||j |j  tDebianDistributioncBs)eZdZdZdZdZRS(s+ Class to support specific Debian features cCs*||jks|jdkr"tStSdS(s Compare a given name with the release codename and check if if it can be used as a synonym for a development releases ttestingtunstableN(RR(RR RlR(RR&((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR%scCsd}|jd}|jd}|dkrV|dkrV||td|!}n||jkrtdtjd|j|jjSd|jdSdS( s_ Try to get a human readable name for the main mirror of a country Debian specific s://ftp.s .debian.orgis Server for %sR@s%ss/ N(RRURGRHRDRRPRa(RRbRRRcRd((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyRescCstj|dddS(NRVs http://ftp.%s.debian.org/debian/(RR6(R((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR6s(RRt__doc__R%ReR6(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyRs  tUbuntuDistributioncBseZdZdZRS(s+ Class to support specific Ubuntu features cCstj|dddS(NRVs$http://%s.archive.ubuntu.com/ubuntu/(RR6(R((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR6s(RRRR6(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyRstUbuntuRTMDistributioncBseZdZdZRS(s/ Class to support specific Ubuntu RTM features cCs|jj|_dS(N(RRFR (R((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR6s(RRRR6(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyRscCsddlm}m}ddl}idd6dd6dd 6d d 6}yU|d d gd|jd}|jd}|jd|jdDWn9tk r}|j|j krt j d|qnX|S(s-Call lsb_release --idrc and return a mapping.i(tPopentPIPENtsidtCodenametDebiansDistributor IDsDebian GNU/Linux unstable (sid)t DescriptionRtReleaset lsb_releases-idrctstdoutisutf-8css*|] }d|kr|jdVqdS(s: N(tsplit(t.0Rd((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pys ss s#lsb_release failed, using defaults:( t subprocessRRterrnot communicatetdecodetupdateRtOSErrortENOENTtloggingtwarning(RRRtresulttouttexc((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt _lsb_releases  "$cCsddlm}m}ddl}yddlm}Wn)tk ratjtjtj }nXyl|ddgd|d|d t j d }x7|j D])}|j d r|jd d d SqWWn9tk r }|j|jkr tjd|q nXdS(s=Get the current channel from system-image-cli -i if possible.i(RRN(tDEVNULLssystem-image-clis-iRtstderrtuniversal_newlinesis channel: s: is+system-image-cli failed, using defaults: %s(RRRRRt ImportErrorRItopentdevnulltO_RDWRRlRt splitlinesR.RRRRRR(RRRRRRdR((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt_system_image_channels$  t _OSReleasecBsDeZdZdZedZdZdZdZdZ RS(s/etc/os-releasecCsai|_t|_tj|_tjj|js7dS|j t |_|r]|j ndS(N( RRtvalidRtOS_RELEASE_FILER:RIRJtisfiletparseRltinject_lsb_compat(Rt lsb_compat((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyRs     cCs|jd|jd<|jd|jd<|jjd|jd<|jdsj|jjd|jds       4