Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/DistUpgrade/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/DistUpgrade/__pycache__/distro.cpython-310.pyc
o

4��f�\�@s�ddlZddlZddlZddlZddlZddlmZddlmZGdd�de	�Z
Gdd�de�ZGdd	�d	e�Z
Gd
d�de�ZGdd
�d
e�Zdd�Zdd�ZGdd�d�Zddddgfdd�ZdS)�N)�ElementTree)�gettextc@seZdZdS)�NoDistroTemplateExceptionN)�__name__�
__module__�__qualname__�rr�4/usr/lib/python3/dist-packages/DistUpgrade/distro.pyr%src@speZdZgfdd�Zdd�Zddd�Zdd	�Zd
d�Z		dd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�DistributioncCs.||_||_||_||_||_d|_d|_dS)z2 Container for distribution specific informations �debzdeb-srcN)�id�codename�description�release�is_like�binary_type�source_type)�selfrr
rrrrrr	�__init__+s
zDistribution.__init__cCs�||_d|_g|_g|_g|_g|_g|_g|_g|_g|_	d|_
g|_d|_d|_
d|_g|_|jjjD]}|�|j�rH|j|jkrH||_nq5|jdurXtd|j|jf��g}g}g}g}|jjD]�}|js�|�|j�r�|jr�|jjr�|�|jj�r�|j�d�r�|js�|j� |�|�!|j"�n[|j�d�r�|jr�|j� |�nK|j#|j$kr�|js�|j� |�|�!|j"�|� |j�n/|j#|j$kr�|jr�|j� |�n|j#|j%kr�|js�|j� |�n|j#|j%kr�|jr�|j� |�|j�s$|j|jj&v�r$|j�s|j#|j$k�r|j� |�qd|j�s|j#|j%k�r|j� |�qd|j� |�qdt'|�|_t'|�|_|�!|�|�!|�t'|�|_t'|�|_	|�(�dS)zf
        Find the corresponding template, main and child sources
        for the distribution
        NF�z7Error: could not find a distribution template for %s/%s�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rr
�list�invalid�dist�template�official�uri�
startswith�disabled�append�extend�comps�typerr�children�set�get_mirrors)rrr/�mediar6rr�sourcerrr	�get_sources7s��

��
�����������





zDistribution.get_sourcesNc
	Cs�|jj|_|jD]
}|�d�s|j�|�qt|j�dkr"|j|_	n|jdj
|_	i|_d}tj
�|�r�t|d�}t|dd�durE|j|_|�d�}|D]9}z|jd}Wntyc|jd	}Ynwz|jd
}Wntyy|jd}Ynwt�d|�|j|��<qLd|_d|_tjd
dd�}	|	�d�}
|	�d�}|dkr�t|	�}|	|
d|���}|r�|||_||jvr�|j||_||_dSdS)zR
        Provide a set of mirrors where you can get the distribution from
        rrz%/usr/share/xml/iso-codes/iso_3166.xml)�file�iterN�iso_3166_entry�common_namer*�alpha_2_code�alpha_3_code�iso_3166�LANG�en_UK)�default�_�.����)r�base_urir$r r2r&r4�lenrr#r1�	countries�os�path�existsr�getattr�getiteratorr?�attrib�KeyErrorr�dgettext�lower�country�country_code�getenv�findr%)
r�mirror_template�medium�fname�et�it�elm�descr�code�locale�a�zrYrrr	r:�sV


�


���




�zDistribution.get_mirrorscCsfd}|�d�}|�d�}|dkr|dkr||td�|�}||jvr,td�|j|Sd|�d�S)zu Try to get a human readable name for the main mirror of a country
            Customize for different distributions Nz://z.archive.ubuntu.comrJ�
Server for %s�%s�/ )r[rMrNrH�rstrip�r�serverrX�i�lirrr	�_get_mirror_name�s


zDistribution._get_mirror_namecCs�dd�}g}t|j�dkst|j�dkr:||jd|j�r:|�td�|jdg�|jr8|�|�|j�|jdg�|St|j�dkr||jd|j�s|�td�|jdg�|jd}|jrp|||j�sp|�|�|j�|jdg�|r}|�|�|�|dg�|St|j�dkr�|�td�|jdg�|jr�|�|�|j�|jdg�|�td�d	dg�|jD] }|�|�|dg}|||j�s�|||j�r�q�||vr�|�|�q�|S)
z- Return a list of used and suggested servers cSst�|�d�|�d��S)zl Helper function that handles comaprision of mirror urls
                that could contain trailing slashesri)�re�match�striprj)�mir1�mir2rrr	�compare_mirrors�sz5Distribution.get_server_list.<locals>.compare_mirrorsrKrzMain serverTFzCustom serversN)rMr&r$r4rHr%ro)rru�mirrorsrl�mirror_entryrrr	�get_server_list�sT��!��
���

�
�zDistribution.get_server_listrc
Cs�|dur|j}|dur|j}|durt|j�}|dur|j}|j�|||||�}|jrH||jkrJ|jj|j|||||j	|jj�
|�dd�dSdSdS)z3
        Add distribution specific sources
        NrK)r>�pos)r#r
r,rrr�addr!rr>�index)rr7r1r.r6�comment�
new_sourcerrr	�
add_sources 

��zDistribution.add_sourcecCsXt|g�}|jD]}|jjD]}|j|kr|jr|�|j�qq|D]}|�|�q"dS)z�
        Enable a component in all main, child and source code sources
        (excluding cdrom based sources)

        comp:         the component that should be enabled
        N)r9rr/�
componentsr*�parent_componentrz�_enable_component)r�compr6r<�crrr	�enable_component%s

���zDistribution.enable_componentc	sZ�fdd�}g}|�|j�|�|j�i}i}|D]!}|j|jkr;|j|vr-t�||j<|jD]
}||j�|�q0q|j	D]!}|j|j
kr`|j|vrRt�||j<|jD]
}||j�|�qUq?t|j�dkrr|jd�gd�n|D]}|||�qt|j	D]}|||�q|j
r�t|j	�dkr�|j|j
d�gd�dS|j	D]	}|||�q�dSdS)Ncs@|j|vrdS�||jvrdS|j���||j���dS)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.r6r4rz)r<�comps_per_dist�r�rr	�add_component_only_once7s
z?Distribution._enable_component.<locals>.add_component_only_oncerKrh)r6)r7r6)r5rrr7rr.r9r6rzr"rrMr~r!)	rr�r��sourcesr��comps_per_sdist�sr�r<rr�r	r�5sB

�


�

�zDistribution._enable_componentcCs�g}|�|j�|�|j�|�|j�||jvr!g}|�|j�|D]}||jvr=|j�|�t|j�dkr=|j�|�q#dS)zx
        Disable a component in all main, child and source code sources
        (excluding cdrom based sources)
        rKN)	r5rrr"rr6�removerMr)rr�r�r<rrr	�disable_componentss

��zDistribution.disable_componentcs��fdd�}g}g}|�_�jD]}||||�q�jD]}|jjdus+|jj|jkr1||||�q�jD]}||||�q5dS)zN Change the server of all distro specific sources to
            a given host csh||_|jD]}|j|j|g|vr|j�|�q|�|j|j|g�qt|j�dkr2�j�|�dSdS)NrK)r1r6r.r�r4rMr)r<r1�seenr��rrr	�change_server_of_source�s
�z;Distribution.change_server.<locals>.change_server_of_sourceN)r#rrr/rLr1r")rr1r��seen_binary�seen_sourcer<rr�r	�
change_server�s

�
�zDistribution.change_servercCs||jkrdSdS)z1 Compare a given name with the release codename. TF)r
�rr*rrr	r)�s
zDistribution.is_codename�N)NNNNr)rrrrr=r:rorxr~r�r�r�r�r)rrrr	r
)s
]93
�>r
c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�DebianDistributionz+ Class to support specific Debian features cCs||jks
|jdvrdSdS)z� Compare a given name with the release codename and check if
            if it can be used as a synonym for a development releases )�testing�unstableTF)r
rr�rrr	r)�szDebianDistribution.is_codenamecCsvd}|�d�}|�d�}|dkr|dkr||td�|�}||jvr4td�t�d|j|�����Sd|�d�S)	z_ Try to get a human readable name for the main mirror of a country
            Debian specific Nz://ftp.z.debian.orgrJrgrDrhri)r[rMrNrHrrVrjrkrrr	ro�s



��z#DebianDistribution._get_mirror_namecC�tj|dd�dS)Nz http://ftp.%s.debian.org/debian/�r\�r
r:r�rrr	r:��
�zDebianDistribution.get_mirrorsN)rrr�__doc__r)ror:rrrr	r��s
r�c@�eZdZdZdd�ZdS)�UbuntuDistributionz+ Class to support specific Ubuntu features cCr�)Nz$http://%s.archive.ubuntu.com/ubuntu/r�r�r�rrr	r:�r�zUbuntuDistribution.get_mirrorsN�rrrr�r:rrrr	r���r�c@r�)�UbuntuRTMDistributionz/ Class to support specific Ubuntu RTM features cCs|jj|_dSr�)rrLr$r�rrr	r:�sz!UbuntuRTMDistribution.get_mirrorsNr�rrrr	r��r�r�c
Cs�ddlm}m}ddl}ddddd�}z!|d	d
g|d���d}|�d�}|�d
d�|�d�D��W|Sty[}z|j|j	krPt
�d|�WYd}~|SWYd}~|Sd}~ww)z-Call lsb_release --idrc and return a mapping.r��Popen�PIPEN�sid�DebianzDebian GNU/Linux unstable (sid)r�)�Codename�Distributor ID�Description�Release�lsb_releasez-idrc)�stdoutzutf-8css"�|]}d|vr|�d�VqdS)z:	N)�split)�.0�linerrr	�	<genexpr>�s���z_lsb_release.<locals>.<genexpr>�
z#lsb_release failed, using defaults:)�
subprocessr�r��errno�communicate�decode�updater��OSError�ENOENT�logging�warning)r�r�r��result�out�excrrr	�_lsb_release�s&�
�
���r�c
Cs�ddlm}m}ddl}zddlm}Wnty%t�tjtj	�}Ynwz(|ddg||dd��
�d}|��D]}|�d	�rK|�
d
d�dWSq9WdStyu}z|j|jkrjt�d|�WYd}~dSWYd}~dSd}~ww)
z=Get the current channel from system-image-cli -i if possible.rr�N)�DEVNULLzsystem-image-cliz-iT)r��stderr�universal_newlinesz	channel: z: rKz+system-image-cli failed, using defaults: %s)r�r�r�r�r��ImportErrorrO�open�devnull�O_RDWRr��
splitlinesr2r�r�r�r�r�)r�r�r�r�r�r�r�rrr	�_system_image_channel�s<�
��
����
���r�c@s>eZdZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Z	d
S)�
_OSReleasez/etc/os-releaseTcCsHi|_d|_tj|_tj�|j�sdS|��d|_|r"|�	�dSdS)NFT)
r��validr��OS_RELEASE_FILEr>rOrP�isfile�parse�inject_lsb_compat)r�
lsb_compatrrr	rs�z_OSRelease.__init__cCsd|jd|jd<|jd|jd<|j�d�|jd<|jds'|j�d�|jd<|j�d�|jd	<dS)
N�IDr��PRETTY_NAMEr��VERSION_CODENAMEr��UBUNTU_CODENAME�
VERSION_IDr�)r��getr�rrr	r�s
z_OSRelease.inject_lsb_compatcCsBt|jd�}|D]}|��}|sq|j|�dd��q|��dS)N�r�=rK)r�r>rr�parse_entryr��close)r�fr�rrr	r�sz_OSRelease.parsecCs4|�|�}|dkrt|t�r|�d�}||j|<dS)N�ID_LIKE� )�parse_value�
isinstance�strr�r�)r�key�valuerrr	r�'s

z_OSRelease.parse_entrycCs"t�|�}t|�dkr|dS|S)NrKr)�shlexr�rM)rr��valuesrrr	r�/s
z_OSRelease.parse_valueN)T)
rrr�DEFAULT_OS_RELEASE_FILEr�rr�r�r�r�rrrr	r�s

	r�c	Cs�|r|r|r|sRt�}g}t�}|jr|j}t�}|d}|d}|d}|d}|�dg�}|dkrRt�}|durRd|vrRd	}|�d
d�d�dd�d
}|}|}|dkr^t|||||�S|d	krjt	|||||�S|dkrvt
|||||�St|||||�S)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 via
    a call to lsb-release
    r�r�r�r�r��UbuntuNzubuntu-rtm/z
Ubuntu-RTM�/rK�-rr�)r�r�r�r�r�r��rsplitr�r�r�r�r
)	rr
rrr�
os_release�	os_result�
lsb_result�channelrrr	�
get_distro6s8


�r�)rr�rpr�rO�xml.etree.ElementTreer�apt_pkgrH�	Exceptionr�objectr
r�r�r�r�r�r�r�rrrr	�<module>s*5�

Spamworldpro Mini