+
    S^i,U                         ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH t  ! R R]	4      t
 ! R R4      t ! R R	]4      t ! R
 R]4      t ! R R]4      tR tRRRR. / 3R ltR# )    N)ElementTree)gettextc                       ] tR t^$tRtR# )NoDistroTemplateException N)__name__
__module____qualname____firstlineno____static_attributes__r       3/usr/lib/python3/dist-packages/aptsources/distro.pyr   r   $   s    r   r   c                   r   a  ] tR t^(t o . / 3R ltR tRR ltR tR tRR lt	R t
R	 tR
 tR tR tRtV tR# )Distributionc                    VP                  4       V n        W n        W0n        W@n        WPn        W`n        RV n        RV n        R# )z0Container for distribution specific informationsdebzdeb-srcN)	loweridcodenamedescriptionreleaseis_likelike_codenamesbinary_typesource_type)selfr   r   r   r   r   r   s   &&&&&&&r   __init__Distribution.__init__)   s<     ((* &, $r   c                
   Wn         RV n        . V n        . V n        . V n        . V n        . V n        . V n        . V n        . V n	        RV n
        . V n        RV n        RV n        RV n        . V n        V P                   P                   P"                   FI  pV P%                  VP&                  4      '       g   K&  VP(                  V P*                  8X  g   KC  W n         M	  V P                  f(   \-        RV P*                  : RV P.                  : 24      h. p. p. p. pV P                   P1                  4        EF  pVP2                  '       Eg   V P%                  VP4                  4      '       Edq   VP6                  '       Ed^   VP6                  P8                  '       EdA   V P%                  VP6                  P&                  4      '       Ed   VP:                  P=                  R4      '       dK   VP>                  '       g9   V P
                  PA                  V4       VPC                  VPD                  4       EMVP:                  P=                  R4      '       d0   VP>                  '       d   V P
                  PA                  V4       EMYVPF                  V PH                  8X  de   VP>                  '       gS   V P                  PA                  V4       VPC                  VPD                  4       VPA                  VP:                  4       MVPF                  V PH                  8X  d/   VP>                  '       d   V P                  PA                  V4       MVPF                  V PJ                  8X  d/   VP>                  '       g   V P                  PA                  V4       MHVPF                  V PJ                  8X  d.   VP>                  '       d   V P                  PA                  V4       VP2                  '       d   EK  VP6                  V P                  PL                  9   g   EK  VP>                  '       g:   VPF                  V PH                  8X  d   V P                  PA                  V4       EK1  VP>                  '       g:   VPF                  V PJ                  8X  d   V P                  PA                  V4       EK|  V P                  PA                  V4       EK  	  \O        V4      V n        \O        V4      V n        VPC                  V4       VPC                  V4       \O        V4      V n        \O        V4      V n	        V PQ                  4        R# )zN
Find the corresponding template, main and child sources
for the distribution
NF z2Error: could not find a distribution template for /cdrom:))sourceslistsource_templatechild_sourcesmain_sourcesdisabled_sourcescdrom_sourcesdownload_compsenabled_compscdrom_comps
used_mediaget_source_codesource_code_sourcesdefault_servermain_servernearest_serverused_serversmatcher	templatesis_codenamenamedistributionr   r   r   exploded_listinvaliddisttemplateofficialuri
startswithdisabledappendextendcompstyper   r   childrensetget_mirrors)r   r#   r;   mediarB   r+   r*   sources   &&      r   get_sourcesDistribution.get_sources9   s    '# " $#%  !  ((00::H..83H3HDGG3S (0$ ; '+77DMM+  &&446FNNN$$V[[11OOOOO,,,$$V__%9%9:: ::((226???&&--f5&&v||4ZZ**844&&--f5[[D$4$44V___%%,,V4LL.LL,[[D$4$44))008[[D$4$44V___,,33F;[[D$4$44))008>>>foo9M9M9V9V&V6;;$:J:J+J&&--f5V[[D<L<L-L,,33F;))008? 7@ "%j{+U#[) /e*r   Nc                   V P                   P                  V n        V P                   F7  pVP	                  R4      '       d   K  V P
                  P                  V4       K9  	  \        V P                  4      ^ 8X  d   V P                  V n	        M"V P                  ^ ,          P                  V n	        / V n        Rp\        P                  P                  V4      '       d   \        VR7      p\!        VRR4      f   VP"                  Vn        VP%                  R4      pV F]  p VP&                  R,          p VP&                  R	,          p\*        P,                  ! RV4      V P                  VP/                  4       &   K_  	  RV n        RV n        \        P4                  ! RRR7      p	V	P7                  R4      p
V	P7                  R4      pVR8X  d   \        V	4      pW^,           V P/                  4       pV'       d   W,          V n        WP                  9   d!   V P                  V,          V n        Wn        R# R#   \(         d    TP&                  R,          p EL%i ; i  \(         d    TP&                  R
,          p EL6i ; i)zB
Provide a set of mirrors where you can get the distribution from
r"   z%/usr/share/xml/iso-codes/iso_3166.xml)fileiterNiso_3166_entrycommon_namer6   alpha_2_codealpha_3_codeiso_3166LANGen_UK)default_.)r$   base_urir0   r,   r>   r2   r@   lenr&   r/   r=   	countriesospathexistsr   getattrgetiteratorrM   attribKeyErrorr   dgettextr   countrycountry_codegetenvfindr1   )r   mirror_templatemediumfnameetitelmdescrcodelocaleazre   s   &&           r   rF   Distribution.get_mirrors   s   
  //88 ooF$$X..!!((0 &
 t  !Q&"&"2"2D"&"3"3A"6":":D 777>>%  %(B r64(0..)*B/JJ}5E6::n5D 07/?/?
E/Rtzz|,   673KKKK7FA!ea(..0"1"@D>>)>>,7DL , *+   /JJv.E/   6::n5D6s$   "H96I9IIJ ?J c                $   RpVP                  R4      pVP                  R4      pVR8w  d   VR8w  d   W\        R4      ,           V pW P                  9   d$   \        R4      V P                  V,          ,          # RVP	                  R4      ,          # )zgTry to get a human readable name for the main mirror of a country
Customize for different distributionsNz://z.archive.ubuntu.comServer for %s%s/ rX   )rg   rZ   r[   rV   rstripr   serverrd   ilis   &&   r   _get_mirror_nameDistribution._get_mirror_name   s|     KK[[./7rRxU^b1Gnn$_%w(???&-----r   c                   R p. p\        V P                  4      ^8  gE   \        V P                  4      ^8X  d   V! V P                  ^ ,          V P                  4      '       ds   VP                  \	        R4      V P                  R.4       V P
                  '       d8   VP                  V P                  V P
                  4      V P
                  R.4       V# \        V P                  4      ^8X  d   V! V P                  ^ ,          V P                  4      '       g   VP                  \	        R4      V P                  R.4       V P                  ^ ,          pV P
                  '       dP   V! W0P
                  4      '       g8   VP                  V P                  V P
                  4      V P
                  R.4       V'       d$   VP                  V P                  V4      VR.4       V# \        V P                  4      ^8  Ed    VP                  \	        R4      V P                  R.4       V P
                  '       d8   VP                  V P                  V P
                  4      V P
                  R.4       VP                  \	        R4      RR.4       V P                   Fb  pV P                  V4      VR.pV! W0P
                  4      '       g   V! W0P                  4      '       d   KI  WB9  g   KQ  VP                  V4       Kd  	  V# )z+Return a list of used and suggested serversc                l    \         P                  ! V P                  R4      VP                  R4      4      # )z[Helper function that handles comaprision of mirror urls
that could contain trailing slashesrw   )rematchstriprx   )mir1mir2s   &&r   compare_mirrors5Distribution.get_server_list.<locals>.compare_mirrors   s'     88DJJt,dkk$.?@@r   zMain serverTFzCustom serversN)rZ   r2   r0   r@   rV   r1   r}   )r   r   mirrorsrz   mirror_entrys   &    r   get_server_listDistribution.get_server_list   s   	A t  !A%!!"a' 1 1! 4d6F6FGGNNAm,d.>.>EF"""--d.A.AB++d W ""#q(a $"2"22
 2
 NNAm,d.>.>FG&&q)F """&v/B/BCCNN 11$2E2EF //!  5 5f =vtLM2 / ""#a' NNAm,d.>.>FG"""--d.A.AB++ NNA./t<=++ $ 5 5f =vuM"6+>+>???,,D D !0NN<0 , r   c                v   Vf   V P                   pVf   V P                  pVf   \        V P                  4      pVf   V P                  pRpRp\        V P                  4      ;'       g    \        V P                  4       F  pVP                  p M	  V P                  P                  WW4WVVR7      pV P                  '       dv   WP                  8X  dd   V P                  P                  V P                  VVVVVP                  VV P                  P                  P                  V4      ^,           R7       R# R# R# )z#
Add distribution specific sources
N)parentrL   )rL   r   pos)r/   r   listr*   r   reversedr%   r&   rL   r#   addr-   r   index)	r   rC   r=   r:   rB   commentr   rL   
new_sources	   &&&&&&   r   
add_sourceDistribution.add_source  s'    ;%%C<==D=++,E<##Dt112QQht?P?P6QQF;;D R %%))tG * 


 D,<,<$<    __!$$))//
;a? ! 	 %=r   c                \   \        V.4      pV P                   Fu  pVP                  P                   FX  pVP                  V8X  g   K  VP
                  '       g   K*  VP
                  V9  g   K=  VP                  VP
                  4       KZ  	  Kw  	  V F  pV P                  V4       K  	  R# )z
Enable a component in all main, child and source code sources
(excluding cdrom based sources)

comp:         the component that should be enabled
N)r   r&   r;   
componentsr6   parent_componentr@   _enable_component)r   comprB   rH   cs   &&   r   enable_componentDistribution.enable_component?  s     dV''F__//66T>a&8&8&8))6Q%7%78 0 (
 A""1% r   c                F  a V3R  lp. pVP                  V P                  4       VP                  V P                  4       / p/ pV F{  pVP                  V P                  8X  g   K   VP
                  V9  d   \        4       WFP
                  &   VP                   F$  pWFP
                  ,          P                  V4       K&  	  K}  	  V P                   F{  pVP                  V P                  8X  g   K   VP
                  V9  d   \        4       WVP
                  &   VP                   F$  pWVP
                  ,          P                  V4       K&  	  K}  	  \        V P                  4      ^8  d   V P                  RS,          .R7       M,V F  pV! W4       K  	  V P                   F  pV! W4       K  	  V P                  '       d_   \        V P                  4      ^8  d(   V P                  V P                  RS,          .R7       R# V P                   F  pV! W4       K  	  R# R# )c                   < V P                   V9  d   R# SWP                   ,          9   d   R# V P                  S.,           V n        WP                   ,          P                  S4       R# )z
Check if we already added the component to the repository, since
a repository could be splitted into different apt lines. If not
add the component
N)r:   rB   r   )rH   comps_per_distr   s   &&r   add_component_only_once?Distribution._enable_component.<locals>.add_component_only_onceQ  sO     {{.0 ~kk22!<<4&0FL;;'++D1r   rv   )rB   )rC   rB   N)rA   r&   r%   rC   r   r:   rE   rB   r   r.   r   rZ   r   r-   )	r   r   r   sourcesr   comps_per_sdistsr   rH   s	   &f       r   r   Distribution._enable_componentP  s   	2$ t(()t))* Avv)))66/-0UN66*A"66*..q1 !	  ))Avv)))660.1eOFF+A#FF+//2 !	 * t  !A%OO4$;-O0 "'? " 22'@ 3 4++,q0T%5%5dTk]K #66F+FD 7  r   c                   . pVP                  V P                  4       VP                  V P                  4       VP                  V P                  4       WP                  9   d   . pVP                  V P                  4       V Fo  pWP
                  9   g   K  VP
                  pVP                  V4       WCn        \        VP
                  4      ^8  g   KT  V P                  P                  V4       Kq  	  R# )z`
Disable a component in all main, child and source code sources
(excluding cdrom based sources)
N)	rA   r&   r%   r.   r+   rB   removerZ   r#   )r   r   r   rH   rB   s   &&   r   disable_componentDistribution.disable_component  s    
 t(()t))*t//0###GNN4,,-F||#T"$v||$q($$++F3 r   c                P  a  V 3R lp. p. pVS n         S P                   F  pV! WQV4       K  	  S P                   FK  pVP                  P                  e(   VP                  P                  VP
                  8w  g   KB  V! WQV4       KM  	  S P                   F  pV! WQV4       K  	  R# )z@Change the server of all distro specific sources to
a given hostc                 n  < Wn         V P                   Ff  pV P                   V P                  V.V9   d   V P                  P                  V4       K>  VP	                  V P                   V P                  V.4       Kh  	  \        V P                  4      ^8  d   SP                  P                  V 4       R# R# )   N)r=   rB   r:   r   r@   rZ   r#   )rH   r=   seenr   r   s   &&& r   change_server_of_source;Distribution.change_server.<locals>.change_server_of_source  s    JJJT2d:LL''-KKV[[$ ?@	 %
 6<< 1$  ''/ %r   N)r/   r&   r%   r;   rY   r=   r.   )r   r=   r   seen_binaryseen_sourcerH   s   f&    r   change_serverDistribution.change_server  s    		0 !''F#F= (((F ((0??++vzz9'[A ) ..F#F= /r   c                *    WP                   8X  d   R# R# )z/Compare a given name with the release codename.TF)r   r   r6   s   &&r   r5   Distribution.is_codename  s    == r   )r   r+   r(   r%   r   r[   rd   re   r/   r   r'   r)   r*   r-   r   r   r   r0   r&   r1   r   r.   r$   r   r#   r,   r2   N)NNNNr    )r   r	   r
   r   r   rI   rF   r}   r   r   r   r   r   r   r5   r   __classdictcell____classdict__s   @r   r   r   (   sN     :<R% Tl6-p.CJ#J&";Ez4(>< r   r   c                   6   a  ] tR tRt o RtR tR tR tRtV t	R# )DebianDistributioni  z)Class to support specific Debian featuresc                L    WP                   8X  g   V P                  R9   d   R# R# )zuCompare a given name with the release codename and check if
if it can be used as a synonym for a development releasesTF)testingunstable)r   r   r   s   &&r   r5   DebianDistribution.is_codename  s      == DLL4K$Kr   c                   RpVP                  R4      pVP                  R4      pVR8w  d   VR8w  d   W\        R4      ,           V pW P                  9   dU   \        R4      \        P
                  ! RV P                  V,          P                  4       4      P                  4       ,          # RVP                  R4      ,          # )	zQTry to get a human readable name for the main mirror of a country
Debian specificNz://ftp.z.debian.orgru   rR   rv   rw   rX   )rg   rZ   r[   rV   r   rc   rx   ry   s   &&   r   r}   #DebianDistribution._get_mirror_name  s     KK	"[['7rRxY/"5Gnn$ /"""w 7 > > @&( &-----r   c                4    \         P                  V R R7       R# )z http://ftp.%s.debian.org/debian/rh   Nr   rF   r   s   &r   rF   DebianDistribution.get_mirrors  s      "D 	! 	
r   r   N)
r   r	   r
   r   __doc__r5   r}   rF   r   r   r   s   @r   r   r     s     3.&
 
r   r   c                   *   a  ] tR tRt o RtR tRtV tR# )UbuntuDistributioni  z)Class to support specific Ubuntu featuresc                4    \         P                  V R R7       R# )z$http://%s.archive.ubuntu.com/ubuntu/r   Nr   r   s   &r   rF   UbuntuDistribution.get_mirrors  s      "H 	! 	
r   r   Nr   r	   r
   r   r   rF   r   r   r   s   @r   r   r     s     3
 
r   r   c                   *   a  ] tR tRt o RtR tRtV tR# )UbuntuRTMDistributioni  z-Class to support specific Ubuntu RTM featuresc                <    V P                   P                  V n        R # r   )r$   rY   r0   r   s   &r   rF   !UbuntuRTMDistribution.get_mirrors  s    //88r   )r0   Nr   r   s   @r   r   r     s     79 9r   r   c                    ^ RI p ^ RIHpHpHp  V! RR.VVRR7      P                  4       ^ ,          pVP                  4        F5  pVP                  R4      '       g   K  VP                  R^4      ^,          u # 	  R#   \         dD   pTP                   T P                  8w  d   \        P                  ! R	T,          4        Rp?R# Rp?ii ; i)
z=Get the current channel from system-image-cli -i if possible.N)DEVNULLPIPEPopenzsystem-image-cliz-iT)stdoutstderruniversal_newlinesz	channel: z: z+system-image-cli failed, using defaults: %s)errno
subprocessr   r   r   communicate
splitlinesr>   splitOSErrorENOENTloggingwarning)r   r   r   r   outlineexcs          r   _system_image_channelr     s    //Q&#	

 +- NN$D{++zz$*1-- %   Q99$OOICOPQs$   A
A> A> :A> >C	8CCc                   V e   V P                  4       p V '       d   V'       d   V'       d	   V'       g   \        P                  ! 4       pVR,          p VR,          pVR,          pVP                  R4      pVP                  R. 4      pV F4  pVP                  RVP	                  4       ,          R4      pVf   K0  WV&   K6  	  V R8X  dL   \        4       p	V	e>   R	V	9   d7   R
p V	P                  R^4      ^,          P                  R^4      ^ ,          pTpTpV R8X  d   \        WW#WE4      # V R
8X  d   \        WW#WE4      # V R8X  d   \        WW#WE4      # \        WW#WE4      # )z
Check the currently used distribution and return the corresponding
distriubtion class that supports distro specific features.

If no paramter are given the distro will be auto detected
NIDVERSION_CODENAMEPRETTY_NAME
VERSION_IDID_LIKEz%s_VERSION_CODENAMEubuntuzubuntu-rtm/z
ubuntu-rtmr!   -debian)r   platformfreedesktop_os_releasegetupperr   rsplitr   r   r   r   r   )
r   r   r   r   r   r   
os_releaselike_idlike_codenamechannels
   &&&&&&    r   
get_distror     s]     
~XXZ8446
01 /.....B/ G&NN%7M (*7w'  >+-G"}'?!">>#q1!4::3B1E&"	X~!+
 	
 
\$+
 	
 
x!+
 	
 B+XXr   )r   r   r\   r   r   xml.etree.ElementTreer   apt_pkgrV   	Exceptionr   r   r   r   r   r   r   r   r   r   <module>r      sz   4   	  	 -  		 	\ \~!
 !
H
 
9. 9, 5Yr   