%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core22/current/usr/share/python3/__pycache__/
Upload File :
Create Path :
Current File : //snap/core22/current/usr/share/python3/__pycache__/py3versions.cpython-310.pyc

o

年f�.�@s�ddlZddlZddlZdadadadd�ej�dd��d�D�a	da
d#dd�Zd	d
�Zdd�Z
d$dd�Zd$dd�Zd$dd�Zd$dd�Zd$dd�Zd$dd�ZGdd�de�ZGdd�de�Zdd�Z	d d!�Zed"krpe�dSdS)%�NcCs g|]}|��rd|���qS�zpython%s��strip)�.0�ver�r�!/usr/share/python3/py3versions.py�
<listcomp>
s�r	�DEBPYTHON3_SUPPORTED��,cCsvddlm}m}ts"tj�d�r"|�}td�}|�|�|�	�|atr9|r9z	t�
d|�}W|S|y8t�wdS)Nr)�ConfigParser�
NoOptionErrorz"/usr/share/python3/debian_defaults�DEFAULT)�configparserr
r�	_defaults�os�path�exists�open�	read_file�close�get�
ValueError)�namer
r�config�defaultsfile�valuerrr�read_defaults 
��rcCstdd�|�d�D��S)Ncss�|]}t|�VqdS�N)�int)r�partrrr�	<genexpr>(s�z#version_to_tuple.<locals>.<genexpr>�.)�tuple�split)�versionrrr�version_to_tuple'sr'c
	sZt|�d��dkr
td��ddl}|j|j|j|j|jd�}i}t�}tt	dd��}d}|�d�D]h}|�
�}|d	kr<q1|d
vrAq1|�dt��t�
d�}|�|�}	z<|	sYtd
��|	�d�|	�d�}
���d�\}}t|�dkrsWq1|
dvr}|���nd}||
���fdd�|D�}Wq1ty�td
��wd|vr�||d<|r�|�|�|d<|S)Nr�zDtoo many arguments provided for X-Python3-Version: min and max only.r)N�=z>=z<=z<<T��version_onlyF�all)�current�current_ext�versionsz(>=|<=|<<|=)? *(\d\.\d+)$z'error parsing Python3-Version attribute�r#�)Nr)cs"g|]
}�t|�t���r|�qSr)r')r�av��filtop�vrrr	Ks
�z"parse_versions.<locals>.<listcomp>)�lenr%r�operator�eq�ge�le�lt�set�supported_versionsr�
setdefault�re�compile�match�groupr �add�	Exception�union)
�vstringr7�	operators�vinfo�exact_versions�
version_range�
relop_seen�field�ve�m�op�vmaj�vminrr3r�parse_versions+sR�

��rRFcC�Rtsztd�}dd�|�d�D�aWntygaYnw|r'dd�tD�StS)Nzold-versionscS�g|]}|���qSrr�r�srrrr	[�z old_versions.<locals>.<listcomp>rcS�g|]}|dd��qS��Nr�rr5rrrr	_�)�
_old_versionsrr%r�r+rrrr�old_versionsV��r_cCrS)Nzunsupported-versionscSrTrrrUrrrr	irWz(unsupported_versions.<locals>.<listcomp>rcSrXrYrr[rrrr	mr\)�_unsupported_versionsrr%rr^rrr�unsupported_versionsdr`rbc	Cst�tsnztd�}dd�|�d�D�aWnXtymgd�}zddl}|j|dd|jd	�}|j}Wnt	yDt
�d
�|��}Ynwd}|D]}|�
d�r]|�dd�d���d�}qI|��d
d�|D�}|aYnwt�t�t��}t��t�|�|r�dd�tD�StS)Nzsupported-versionscSrTrrrUrrrr	xrWz&supported_versions.<locals>.<listcomp>r)z/usr/bin/apt-cachez--no-all-versions�showzpython3-allrr0F)�bufsize�shell�stdout� zDepends:�:cSsg|]	}t�dd|��qS)z\s*(\S+)[ (]?.*z\1)r?�subrUrrrr	�scSrXrYrr[rrrr	�r\)�default_version�_supported_versionsrr%r�
subprocess�Popen�PIPErf�ImportErrorr�popen�join�
startswithrr�pop�index�_default_version�sort�append)	r+r�cmdrl�p�fd�depends�line�defaultrrrr=rs>�
�
��
r=cCsPtst�d�atd�}t|tj�d|�fvrtd|��|a|r&tdd�StS)Nz/usr/bin/python3zdefault-versionz/usr/binzkthe symlink /usr/bin/python3 does not point to the python3 default version. It must be reset to point to %srZ)rur�readlinkrrrqr)r+�debian_defaultrrrrj�s
�rjcCs�t�d}t|�}tdd�}t|�dkrH|d�|�}g}|D]}|�|�qz|�|�tdd���}Wnd}Y|�	�|rG|�|�nt
d��|sRt
d��|rV|Sd	d
�|D�S)NTr*r0r/rZrz/No supported python3 versions in version stringzempty set of versionscSsg|]}d|�qSrrr[rrrr	�rWz&requested_versions.<locals>.<listcomp>)rjrRr=r6�intersectionrwrsrtrurvr)rFr+r/rH�	supported�vlr&r}rrr�requested_versions�s,

�r�csNddl}t���fdd�|�d�|�d�D�}|��|r%dd�|D�S|S)Nrcs(g|]}tj�|��vrtj�|��qSr)rr�basenamerU�r�rrr	�s

�z&installed_versions.<locals>.<listcomp>z/usr/bin/python3.[0-9]z/usr/bin/python3.[0-9][0-9]cSrXrYrr[rrrr	�r\)�globr=rv)r+r�r/rr�r�installed_versions�s
�r�c@�eZdZdS)�ControlFileValueErrorN��__name__�
__module__�__qualname__rrrrr���r�c@r�)�MissingVersionValueErrorNr�rrrrr��r�r�cCs�d}d}d}t|dd��}dd�|D�}Wd�n1swY|D]>}|dkr8|dkr8|dkr5n/d}q%|�d�r@d}q%|�d	|�rJ|}q%|���d
�rc|dkrYtd��|�dd
�d
��}q%|durltd��|dkrz|durxtd��|S|S)zFread the debian/control file, extract the X-Python3-Version
    field.Nzutf-8)�encodingcSrTrr)rr|rrrr	�rWz/extract_pyversion_attribute.<locals>.<listcomp>r�SourcezSource:z	Package: zx-python3-version:z1attribute X-Python3-Version not in Source sectionrhr0znot a control filez$no X-Python3-Version in control file)rrr�lowerrr%rr�r�)�fn�pkgr&�sversion�section�controlfile�linesr|rrr�extract_pyversion_attribute�s6�
�r�c
Cs�ddlm}d}	||d�}|jddddd	d
�|jddd
ddd
�|jdddddd
�|jdddddd
�|jddddddd�|��\}}tj�tjd�}|j	r�t
|�dkr�z
tt|j
��WdSty�}ztd||�t�d�WYd}~dSd}~ww|jr�t
|�dkr�td�t|j
���dS|jr�t
|�dkr�td�t|j
���dS|j�r>t
|�dk�r>t
|�dkr�d }n|d}zUtj�|��r|}z
t|d!�}	t|	|j
�}
Wn4ty�tj�d"||f�t�d�Ynt�y
tj�d#|�t|j
�}
Ynwt||j
�}
td�|
��WdSt�y=}ztj�d$||f�t�d�WYd}~dSd}~wwtj�d%||f�t�d�dS)&Nr)�OptionParserz;[-v] [-h] [-d|--default] [-s|--supported] [-i|--installed] )�usagez-dz	--defaultz!print the default python3 version�
store_truer})�help�action�destz-sz--supportedz$print the supported python3 versionsr�z-rz--requestedz�print the python3 versions requested by a build; the argument is either the name of a control file or the value of the X-Python3-Version attribute�	requestedz-iz--installedz.print the installed supported python3 versions�	installedz-vz	--versionz print just the version number(s)Fr+)r�r}r�r�z%s:r0rgzdebian/controlr�z%s: not a control file: %s, zC%s: no X-Python3-Version in control file, using supported versions
z%s: %s
z
usage: %s %s
)�optparser��
add_option�
parse_argsrrr��sys�argvr}r6�printrjr+r�exitr�rqr=r�r�r��isfiler�r�r��stderr�writer�)r�r��parser�opts�args�program�msgr/r�rF�vsrrr�mains�
�������
�����r��__main__r)F)rr?r�rr]ra�environrr%rkrurr'rRr_rbr=rjr�r�rr�r�r�r�r�rrrr�<module>s6�

+


!


A
�

Zerion Mini Shell 1.0