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/sourceslist.pyc
�
&��cc@@s�ddlmZmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddddd	gZ
d
�Zd�Zdefd��YZdefd
��YZdefd��YZd	efd��YZedkr�e
j�e�Zx%eD]Zejdej��qWedd�Zejde�ejedd��ejedd��ndS(i(tabsolute_importtprint_functionNi(tDistInfot	is_mirrortSourceEntrytNullMatchertSourcesListtSourceEntryMatchercC@s�|jd�}|jd�}||kr.tSy*|jd�d}|jd�d}Wntk
rltSXd|kr�||jd�d|kr�tStS(s� check if the given add_url is idential or a mirror of orig_uri e.g.:
        master_uri = archive.ubuntu.com
        compare_uri = de.archive.ubuntu.com
        -> True
    s/ s//it.(trstriptTruetsplitt
IndexErrortFalsetindex(t
master_uritcompare_uritcompare_srvt
master_srv((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyR.s
cC@stt|��S(s. simple and efficient way to return uniq collection

    This is not intended for use with a SourceList. It is provided
    for internal use only. It does not have a leading underscore to
    not break any old code that uses it; but it should not be used
    in new code (and is not listed in __all__).(tlisttset(ts((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pytuniqLscB@sPeZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	s single sources.list entry cC@s�t|_t|_d|_g|_d|_d|_d|_g|_	d|_
||_|dkr�tj
jd�tj
jd�}n||_|j|�d|_g|_dS(NtsDir::EtcsDir::Etc::sourcelist(R
tinvalidtdisabledttypet
architecturestNonettrustedturitdisttcompstcommenttlinetapt_pkgtconfigtfind_dirtfindtfiletparsettemplatetchildren(tselfR"R'((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyt__init__Ys"												
	cC@sj|j|jkoi|j|jkoi|jjd�|jjd�koi|j|jkoi|j|jkS(s- equal operator for two sources.list entries t/(RRRR	RR (R+tother((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyt__eq__ls
$cC@sF|j�}g}d}t}t}x�tt|��D]�}||dkr�|ryt}t}|j|�||}qt}|||7}q7||dkr�t}|||7}q7|r�||j�r�t}|j|�||}q7||j�r|rt}q7|||7}q7Wt|�dkrB|j|�n|S(s� a split() implementation that understands the sources.list
            format better and takes [] into account (for e.g. cdroms) Rt[t]i(tstripR
trangetlenR
tappendtisspace(R+R"tpiecesttmptp_foundtspace_foundti((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pytmysplitts6



	cC@so||_|j�}|dks-|dkr:t|_dS|ddkr�t|_|dj�j�}|ddkr�t|_dS|d}n|jd�}|dkr�||d|_|| }n|j|�}t	|�d
kr�t|_dS|dj�|_
|j
dkr)t|_dS|dj�ddkr�|jd�jd�j�}x�|D]�}y|jd
d�\}}Wntk
r�t|_qhX|dkr�|jd�|_
qh|dkr�tj|�|_qht|_qhWn|dj�|_t	|j�dkr-t|_n|dj�|_t	|�d
krb|d
|_n	g|_dS(s^ parse a given sources.list (textual) line and break it up
            into the field we have Rt#Niitrpmsrpm-srctdebsdeb-srciR0s[]t=tarcht,Ri(R>srpm-srcR?sdeb-src(R?sdeb-srcR>srpm-src(R"R2R
RRRR&R!R<R4Rtpopt	ExceptionRR#tstring_to_boolRRRR (R+R"R7R;toptionstoptiontkeytvalue((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyR(�sV				

		


cC@s^||_|r.|jj�jd�|_n,|jj�ddkrZd|j|_ndS(s# set a line to enabled or disabled R=iN(RR"tlstripR2(R+t	new_value((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pytset_enabled�s

cC@s|j�j�S(s debug helper (tstrR2(R+((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyt__str__�scC@sQ|jr|jSd}|jr(d}n||j7}|jr|jdk	r|ddj|j�|jrqdndf7}nU|jdk	r�|d|jr�dnd7}n&|jr�|ddj|j�7}n|d	|j|j	f7}t
|j�d
kr |ddj|j�7}n|jdkrC|d|j7}n|d
7}|S(s# return the current line as string Rs# s [arch=%s trusted=%s]RBtyestnos
 [trusted=%s]s
 [arch=%s]s %s %sit s #s
N(
RR"RRRRRtjoinRRR4R R!(R+R"((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyRM�s(			
, 	
N(t__name__t
__module__t__doc__RR,R/R<R(RLRNRM(((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyRVs		%	@		cB@seZdZd�ZRS(s a Matcher that does nothing cC@stS(N(R
(R+R((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pytmatchs(RSRTRURV(((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyRscB@s�eZdZedd�Zd�Zd�Zd�Zdddgd�Z	d	�Z
d
�Zdd�Zd�Z
d
�Zd�ZRS(s8 represents the full sources.list + sources.list.d file s /usr/share/python-apt/templates/cC@s;g|_|r!t|�|_nt�|_|j�dS(N(RRtmatcherRtrefresh(R+twithMatchertmatcherPath((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyR,s
	cC@s�g|_tjjd�}tjj|�r=|j|�ntjjd�}x(t	j	d|�D]}|j|�qcWx-|jD]"}|j
s�|jj|�q�q�WdS(s" update the list of known entries sDir::Etc::sourcelistsDir::Etc::sourcepartss	%s/*.listN(
RR#R$t	find_filetostpathtexiststloadR%tglobRRWRV(R+R'tpartsdirtsource((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyRXs		cc@sx|jD]}|Vq
WdS(sM simple iterator to go over self.list, returns SourceEntry
            types N(R(R+tentry((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyt__iter__&sc/@s��jdd�}x�|jD]v�|rO|jd��jjd�krOqnt��fd��D��rt�fd�|D��r�VqqWdS(NRR-c3@s(|]}t�|��|kVqdS(N(tgetattr(t.0RH(tattrsRb(s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pys	<genexpr>1sc3@s|]}|��VqdS(N((Rft	predicate(Rb(s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pys	<genexpr>2s(RCRRR	Rtall(R+t
predicatesRgR((RgRbs:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyt__find,s'Ri����c	@s�|j�}|jd�}	|	r4|dj�}nt���|}
|j�fd�d|	dtd|d|d|�}xW|D]O}xF|
D]>}
|
|jkr�|
|
j|
�=t|
�d	kr�|Sq�q�Wq�W|j�fd
�dtd|d|d|�}x�|D]�}|j	|	kr[t|j�t|
�krWt
|j|
�|_n|S|j	r|	rt|j�t|
�kr�t|_	|SqqW|	r�dnd|�r�dd
j��nd||g}|j|
�|r�|j
d|�ndjd�|D��d}t|�}|dk	r<||_n|jj|�|d	krk|jj
|�n|jj||�|S(s�
        Add a new source to the sources.list.
        The method will search for existing matching repos and will try to
        reuse them as far as possible
        R=ic@st|j��kS(N(RR(R(R(s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyt<lambda>ERRRRRRic@st|j��kS(N(RR(R(R(s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyRlRRRs	[arch=%s]RBRQcs@s|]}|r|VqdS(N((Rftpart((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pys	<genexpr>kss
N(R2t
startswithRJRt_SourcesList__findR
R RR4RRRRtextendR5RRR'RWRVRtinsert(R+RRRt
orig_compsR!tposR'RRR tsourcesRbtnew_comptpartsR"t	new_entry((Rs:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pytadd5sV


		
cC@s|jj|�dS(s2 remove the specified entry from the sources.list N(Rtremove(R+tsource_entry((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyRywscC@s�tjjd�}tjj||�rQtjj|�rQtj|||�ntjjd�}xHt	j	d|�D]3}tjj||�rwtj|||�qwqwWdS(s: restore sources.list files based on the backup extension sDir::Etc::sourcelistsDir::Etc::sourcepartss	%s/*.listN(
R#R$R[R\R]R^tshutiltcopyR%R`(R+t
backup_extR'Ra((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pytrestore_backup{s(cC@s�t�}|dkr'tjd�}nxX|jD]M}|j|kr1tjj|j�r1t	j
|jd|j|f�q1q1W|S(s� make a backup of the current source files, if no backup extension
            is given, the current date/time is used (and returned) s%y%m%d.%H%Ms%s%sN(RRttimetstrftimeRR'R\R]R^R{R|(R+R}talready_backupedRb((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pytbackup�s	'cC@suyLt|d��7}x-|D]%}t||�}|jj|�qWWdQXWn"tk
rptjd|�nXdS(s (re)load the current sources trNscould not open file '%s'
(topenRRR5RDtloggingtwarning(R+R'tfR"Rb((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyR_�s

cC@s�i}t|j�dkr\tjjd�}d}t|d��}|j|�WdQXdSz]xV|jD]K}|j|kr�t|jd�||j<n||jj|j��qiWWdx|D]}||j	�q�WXdS(s save the current sources isDir::Etc::sourcelists�## See sources.list(5) for more information, especialy
# Remember that you can only use http, ftp or file URIs
# CDROMs are managed through the apt-cdrom tool.
twN(
R4RR#R$R[R�twriteR'RMtclose(R+tfilesR]theaderR�Rb((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pytsave�s"
cC@s�g}i}x�|D]�}|jdkr.qn|jjrv|j}||kr\g||<n||}|j|�qt|jj�dkr|j|�qqW||fS(s5get all parent and child channels in the sources listiN(R)RtchildR5R4R*(R+tsources_listtparentstused_child_templatesRbRHttemp((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pytcheck_for_relations�s
	

N(RSRTRUR
R,RXRdRoRRxRyR~R�R_R�R�(((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyR	s					A			
	cB@s eZdZd�Zd�ZRS(s} matcher class to make a source entry look nice
        lots of predefined matchers to make it i18n/gettext friendly
        cC@s�g|_tjd|�}x�|D]|}tjj|�}|jd�}|d|!}t|d|�}x3|jD](}|jdk	rs|jj	|�qsqsWq#WdS(Ns	%s/*.infos.infoitbase_dir(
t	templatesR`R\R]tbasenameR&Rt	match_uriRR5(R+RZt
spec_filesR�R;RR)((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyR,�s	

cC@s�t}x�|jD]�}tj|j|j�rztj|j|j�rz|j	|j	ksg|j	dkrzt
}||_Pq|j|j�rtj|j|j�rt
}||_PqqW|S(s%Add a matching template to the sourceR?(
R
R�tretsearchR�RRVt
match_nameRRR
R)R(R+RbtfoundR)((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyRV�s!		(RSRTRUR,RV(((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyR�s	t__main__sentry %ss!http://archive.ubuntu.com/ubuntu/s$http://de.archive.ubuntu.com/ubuntu/sis_mirror(): %ss http://archive.ubuntu.com/ubuntus#http://de.archive.ubuntu.com/ubuntu(t
__future__RRR`R�tos.pathR\R�R{RR#tdistinfoRt__all__RRtobjectRRRRRStinit_configRtRctinfoRMtmirror(((s:/usr/lib/python2.7/dist-packages/aptsources/sourceslist.pyt<module>s8			
��(