HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python2.7/dist-packages/aptsources/distro.pyc
�
&��cc@sddlZddlZddlZddlZddlZddlmZddlmZde	fd��YZ
defd��YZdefd	��YZ
d
efd��YZdefd
��YZd�Zd�Zdfd��YZeeeegd�ZdS(i����N(tElementTree(tgettexttNoDistroTemplateExceptioncBseZRS((t__name__t
__module__(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR%stDistributioncBs�eZgd�Zd�Zdd�Zd�Zd�Zdddddd�Zd�Z	d�Z
d	�Zd
�Zd�Z
RS(
cCsC||_||_||_||_||_d|_d|_dS(s2 Container for distribution specific informations tdebsdeb-srcN(tidtcodenametdescriptiontreleasetis_liketbinary_typetsource_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|j�r�|j|jkr�||_Pq�q�W|jdkr	td|j|jf��ng}g}g}g}x4|jjD]&}|jr�|j|j�r�|jr�|jjr�|j|jj�r�|jj d�r�|j!r�|jj"|�|j#|j$�q�|jj d�r�|j!r�|jj"|�q�|j%|j&kr6|j!r6|jj"|�|j#|j$�|j"|j�q�|j%|j&krd|j!rd|jj"|�q�|j%|j'kr�|j!r�|j
j"|�q�|j%|j'kr�|j!r�|jj"|�q�n|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(+tsourceslisttNonetsource_templatet
child_sourcestmain_sourcestdisabled_sourcest
cdrom_sourcestdownload_compst
enabled_compstcdrom_compst
used_mediatFalsetget_source_codetsource_code_sourcestdefault_servertmain_servertnearest_servertused_serverstmatchert	templatestis_codenametnametdistributionRRRtlisttinvalidtdistttemplatetofficialturit
startswithtdisabledtappendtextendtcompsttypeRR
tchildrentsettget_mirrors(RRR+tmediaR2RRtsource((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pytget_sources7s�																	
	
	
	
	




c
Cs5|jj|_x3|jD](}|jd�s|jj|�qqWt|j�dkri|j|_	n|jdj
|_	i|_d}tj
j|�rytd|�}t|dd�dkr�|j|_n|jd�}x�|D]�}y|jd}Wntk
r |jd}nXy|jd	}Wntk
rR|jd
}nXtjd|�|j|j�<q�Wnd|_d|_tjdd
d�}	|	jd�}
|	jd�}|dkr�t|	�}n|	|
d|!j�}|r|||_n||jkr1|j||_||_ndS(sR
        Provide a set of mirrors where you can get the distribution from
        scdrom:is%/usr/share/xml/iso-codes/iso_3166.xmltfiletitertiso_3166_entrytcommon_nameR&talpha_2_codetalpha_3_codetiso_3166tLANGtdefaultten_UKt_t.i����iN(Rtbase_uriR RR.R"R0tlenRRR-t	countriestostpathtexistsRtgetattrRtgetiteratorR;tattribtKeyErrorRtdgettexttlowertcountrytcountry_codetgetenvtfindR!(
Rtmirror_templatetmediumtfnametettittelmtdescrtcodetlocaletatzRS((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR6�sL	


			cCs�d}|jd�}|jd�}|dkrV|dkrV||td�|!}n||jkrztd�|j|Sd|jd�SdS(su Try to get a human readable name for the main mirror of a country
            Customize for different distributions s://s.archive.ubuntu.comi����s
Server for %ss%ss/ N(RRURGRHRDtrstrip(RtserverRRtitli((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt_get_mirror_name�scCskd�}g}t|j�dksRt|j�dkr�||jd|j�r�|jtd�|jtg�|jrg|j|j|j�|jtg�qgn�t|j�dkrq||jd|j�rq|jtd�|jtg�|jd}|jrF|||j�sF|j|j|j�|jtg�qFn|rg|j|j|�|tg�qgn�t|j�dkrg|jtd�|jtg�|jr�|j|j|j�|jtg�n|jtd�dtg�xr|jD]d}|j|�|tg}|||j�s�|||j�rDq�q�||kr�|j|�q�q�Wn|S(s- Return a list of used and suggested servers cSs"tj|jd�|jd��S(sl Helper function that handles comaprision of mirror urls
                that could contain trailing slashess/ (tretmatchtstripRa(tmir1tmir2((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pytcompare_mirrors�siisMain serversCustom serversN(
RGR"R R0RDtTrueR!ReRR(RRktmirrorsRbtmirror_entry((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pytget_server_list�sB		
	%	RcCs�|dkr|j}n|dkr0|j}n|dkrNt|j�}n|dkrf|j}n|jj|||||�}|jr�||jkr�|jj|j	||||d|j
d|jjj|�d�ndS(s3
        Add distribution specific sources
        R:tposiN(RRRR(RRRtaddRR
R:tindex(RR3R-R*R2tcommentt
new_source((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt
add_sources		cCs�t|g�}xS|jD]H}x?|jjD]1}|j|kr,|jr,|j|j�q,q,WqWx|D]}|j|�qlWdS(s�
        Enable a component in all main, child and source code sources
        (excluding cdrom based sources)

        comp:         the component that should be enabled
        N(R5RR+t
componentsR&tparent_componentRqt_enable_component(RtcompR2R8tc((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pytenable_component%s
c	s��fd�}g}|j|j�|j|j�i}i}xm|D]e}|j|jkrH|j|kr�t�||j<nx(|jD]}||jj|�q�WqHqHWxp|j	D]e}|j|j
kr�|j|kr�t�||j<nx(|jD]}||jj|�q�Wq�q�Wt|j�dkrS|jdd�g�n?x|D]}|||�qZWx|j	D]}|||�q{W|j
r�t|j	�dkr�|jd|j
dd�g�q�x!|j	D]}|||�q�WndS(NcsR|j|krdS�||jkr*dS|jj��||jj��dS(s�
            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*R2R0Rq(R8tcomps_per_dist(Ry(s5/usr/lib/python2.7/dist-packages/aptsources/distro.pytadd_component_only_once7siR2s%sR3(R1RRR3RR*R5R2RqRR
RGRuR(	RRyR}tsourcesR|tcomps_per_sdisttsRzR8((Rys5/usr/lib/python2.7/dist-packages/aptsources/distro.pyRx5s:

	#cCs�g}|j|j�|j|j�|j|j�||jkr^g}|j|j�nxX|D]P}||jkre|jj|�t|j�dkr�|jj|�q�qeqeWdS(sx
        Disable a component in all main, child and source code sources
        (excluding cdrom based sources)
        iN(	R1RRRRR2tremoveRGR(RRyR~R8((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pytdisable_componentss
cs��fd�}g}g}|�_x!�jD]}||||�q.WxK�jD]@}|jjdks|jj|jkrR||||�qRqRWx!�jD]}||||�q�WdS(sN Change the server of all distro specific sources to
            a given host cs�||_x[|jD]P}|j|j|g|krG|jj|�q|j|j|j|g�qWt|j�dkr��jj|�ndS(Ni(R-R2R*R�R0RGR(R8R-tseenRy(R(s5/usr/lib/python2.7/dist-packages/aptsources/distro.pytchange_server_of_source�s	 N(RRRR+RFRR-R(RR-R�tseen_binarytseen_sourceR8((Rs5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt
change_server�s	cCs||jkrtStSdS(s1 Compare a given name with the release codename. N(RRlR(RR&((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR%�sN(RRRR9RR6ReRoRuR{RxR�R�R%(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR)s	]9		3		>		tDebianDistributioncBs)eZdZd�Zd�Zd�ZRS(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(R�R�(RR
RlR(RR&((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR%�scCs�d}|jd�}|jd�}|dkrV|dkrV||td�|!}n||jkr�td�tjd|j|j��j�Sd|jd�SdS(	s_ Try to get a human readable name for the main mirror of a country
            Debian specific s://ftp.s.debian.orgi����s
Server for %sR@s%ss/ N(RRURGRHRDRRPRa(RRbRRRcRd((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyRe�scCstj|dd�dS(NRVs http://ftp.%s.debian.org/debian/(RR6(R((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR6�s(RRt__doc__R%ReR6(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR��s		tUbuntuDistributioncBseZdZd�ZRS(s+ Class to support specific Ubuntu features cCstj|dd�dS(NRVs$http://%s.archive.ubuntu.com/ubuntu/(RR6(R((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR6�s(RRR�R6(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR��stUbuntuRTMDistributioncBseZdZd�ZRS(s/ Class to support specific Ubuntu RTM features cCs|jj|_dS(N(RRFR (R((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR6�s(RRR�R6(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR��scCs�ddlm}m}ddl}idd6dd6dd	6d
d6}yU|dd
gd|�j�d}|jd�}|jd�|jd�D��Wn9tk
r�}|j|j	kr�t
jd|�q�nX|S(s-Call lsb_release --idrc and return a mapping.i����(tPopentPIPENtsidtCodenametDebiansDistributor IDsDebian GNU/Linux unstable (sid)tDescriptionR�tReleasetlsb_releases-idrctstdoutisutf-8css*|] }d|kr|jd�VqdS(s:	N(tsplit(t.0tl((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pys	<genexpr>�ss
s#lsb_release failed, using defaults:(t
subprocessR�R�terrnotcommunicatetdecodetupdateR�tOSErrortENOENTtloggingtwarning(R�R�R�tresulttouttexc((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt_lsb_release�s
"$cCsddlm}m}ddl}yddlm}Wn)tk
ratjtjtj	�}nXyl|ddgd|d|d	t
�j�d
}x7|j�D])}|j
d�r�|jdd
�d
Sq�WWn9tk
r	}|j|jkr
tjd|�q
nXdS(s=Get the current channel from system-image-cli -i if possible.i����(R�R�N(tDEVNULLssystem-image-clis-iR�tstderrtuniversal_newlinesis	channel: s: is+system-image-cli failed, using defaults: %s(R�R�R�R�R�tImportErrorRItopentdevnulltO_RDWRRlR�t
splitlinesR.R�R�R�R�R�R(R�R�R�R�R�R�R�((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt_system_image_channel�s$
t
_OSReleasecBsDeZdZdZed�Zd�Zd�Zd�Zd�Z	RS(s/etc/os-releasecCsai|_t|_tj|_tjj|j�s7dS|j	�t
|_|r]|j�ndS(N(R�RtvalidR�tOS_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�|jd<n|jjd�|jd	<dS(
NtIDsDistributor IDtPRETTY_NAMER�tVERSION_CODENAMER�tUBUNTU_CODENAMEt
VERSION_IDR�(R�tget(R((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR�s
cCsbt|jd�}x?|D]7}|j�}|s7qn|j|jdd��qW|j�dS(Ntrt=i(R�R:Rhtparse_entryR�tclose(Rtftline((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR�s
cCsM|j|�}|dkr<t|t�r<|jd�}n||j|<dS(NtID_LIKEt (tparse_valuet
isinstancetstrR�R�(Rtkeytvalue((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR�&scCs-tj|�}t|�dkr)|dS|S(Nii(tshlexR�RG(RR�tvalues((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR�.s(
RRtDEFAULT_OS_RELEASE_FILER�RlRR�R�R�R�(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyR�s	
			c	Csv|o|o|o|s�t�}g}t�}|jrE|j}nt�}|d}|d}|d}|d}|jdg�}|dkr�t�}|dk	r�d|kr�d}|jd	d
�d
jdd
�d}|}|}q�q�n|dkrt	|||||�S|dkr:t
|||||�S|d
kr\t|||||�St|||||�SdS(s�
    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 via
    a call to lsb-release
    sDistributor IDR�R�R�R�tUbuntusubuntu-rtm/s
Ubuntu-RTMt/it-iR�N(
R�R�R�R�R�R�RtrsplitR�R�R�R�R(	RRR	R
Rt
os_releaset	os_resultt
lsb_resulttchannel((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt
get_distro5s6
			
	



	&(RR�RfR�RItxml.etree.ElementTreeRtapt_pkgRDt	ExceptionRtobjectRR�R�R�R�R�R�RR�(((s5/usr/lib/python2.7/dist-packages/aptsources/distro.pyt<module>s"��		5