%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/python3/debpython/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/python3/debpython/__pycache__/interpreter.cpython-312.pyc

�

���f�4����ddlZddlZddlZddlmZmZddlmZddlm	Z	ejdej�Zejdej�Z
eje�ZGd�d�Zy)	�N)�join�split)�execute)�Versionz�
    (?:\#!\s*){0,1}  # shebang prefix
    (?P<path>
        .*?/bin/.*?)?
    (?P<name>
        python|pypy)
    (?P<version>
        \d[\.\d]*)?
    (?P<debug>
        -dbg)?
    (?P<options>.*)
    a-
    (?P<name>.*?)
    (?:\.
        (?P<stableabi>abi\d+)
     |(?:\.
        (?P<soabi>
            (?P<impl>cpython|pypy)
            -
            (?P<ver>\d{2})
            (?P<flags>[a-z]*?)
        )
        (?:
            -(?P<multiarch>[^/]*?)
        )?
    ))?
    (?P<debug>_d)?
    \.so$c��eZdZdZdZdZdZdZdZiZ			dd�Z
d�Zd�Zd	�Z
d
�Zed��Zdd�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zy)�InterpreterN�pythonF�cpython�c��t�}|d=|d=t|t�r+|j�D]}	||	��	t	||	�||	<�ne|rc|jdd�j
�r|st|�|d<n2|j|�j�D]\}	}
||	��|
||	<�|j�D]\}	}
t||	|
��y)N�self�value�.��version)�locals�
isinstancer�keys�getattr�replace�isdigitr�parse�items�setattr)r
r�path�namer�debug�impl�options�params�key�vals           �+/usr/share/python3/debpython/interpreter.py�__init__zInterpreter.__init__Es�������6�N��7�O��e�[�)��{�{�}�
6���#�;�&�")�%��"5�F�3�K�
6���}�}�S�"�%�-�-�/��$+�E�N��y�!� $�
�
�5� 1� 7� 7� 9�*�H�C���c�{�*�&)��s��*�����	$�H�C���D�#�s�#�	$�c�F�|dk(rW|rU|jd�rd|jd<n |jd�rd|jd<d|vr"d|jd<n|d	k(r
|�t|�}|d
vr |�tt|�|j|<y||j|<y)Nrr	r
r�pypyz-dbgTrr)rrrr)�
startswith�__dict__rrr)r
rrs   r#�__setattr__zInterpreter.__setattr__Zs����6�>�e�����)�(1��
�
�f�%��!�!�&�)�(.��
�
�f�%����)-��
�
�g�&�
�Y�
�5�#4��E�N�E��7�7�E�M�")�+�t�"<�D�M�M�$��"'�D�M�M�$�r%c��|jxsd}||j|j�z
}|jr!|ddj	|j�zz
}|S)Nr� )r�_vstrrrr)r
�results  r#�__repr__zInterpreter.__repr__jsN������b���$�*�*�T�\�\�*�*���<�<��c�C�H�H�T�\�\�2�2�2�F��
r%c�8�|j|j�S�N)r-r)r
s r#�__str__zInterpreter.__str__qs���z�z�$�,�,�'�'r%c���|jdk(r|jS|rLt|�|jvr5|jrdj	|�S|jt|�zS|jS)Nr'zpython{}-dbg)rr�strr�format�r
rs  r#r-zInterpreter._vstrts_���9�9����9�9���s�7�|�4�9�9�4��z�z�%�,�,�W�5�5��9�9�s�7�|�+�+��y�y�r%c��tj|�}|siS|j�}d|vrt|dj	��|d<|S)a�Return dict with parsed shebang

        >>> sorted(Interpreter.parse('pypy').items())
        [('debug', None), ('name', 'pypy'), ('options', ()), ('path', None), ('version', None)]
        >>> sorted(Interpreter.parse('/usr/bin/python3.3-dbg').items())
        [('debug', '-dbg'), ('name', 'python'), ('options', ()), ('path', '/usr/bin/'), ('version', '3.3')]
        >>> sorted(Interpreter.parse('#! /usr/bin/pypy --foo').items())
        [('debug', None), ('name', 'pypy'), ('options', ('--foo',)), ('path', '/usr/bin/'), ('version', None)]
        >>> sorted(Interpreter.parse('#! /usr/bin/python3.2').items())
        [('debug', None), ('name', 'python'), ('options', ()), ('path', '/usr/bin/'), ('version', '3.2')]
        >>> sorted(Interpreter.parse('/usr/bin/python3.2-dbg --foo --bar').items())
        [('debug', '-dbg'), ('name', 'python'), ('options', ('--foo', '--bar')), ('path', '/usr/bin/'), ('version', '3.2')]
        r)�
SHEBANG_RE�search�	groupdict�tupler)�shebangr.s  r#rzInterpreter.parse~sT�� �"�"�7�+����I��!�!�#����� %�f�Y�&7�&=�&=�&?� @�F�9���
r%c���t|xs|j�}|jdk(rd}n*|td�zrd|z}n|td�zrd|z}nd}|rd|z}|rd	|�|��}|S)
a�Return path to site-packages directory.

        Note that returned path is not the final location of .py files

        >>> i = Interpreter('python')
        >>> i.sitedir(version='3.1')
        '/usr/lib/python3/dist-packages/'
        >>> i.sitedir(version='2.5')
        '/usr/lib/python2.5/site-packages/'
        >>> i.sitedir(version=Version('2.7'))
        '/usr/lib/python2.7/dist-packages/'
        >>> i.sitedir(version='3.1', gdb=True, package='python3-foo')
        'debian/python3-foo/usr/lib/debug/usr/lib/python3/dist-packages/'
        >>> i.sitedir(version=Version('3.2'))
        '/usr/lib/python3/dist-packages/'
        >>> Interpreter('pypy').sitedir(version='2.0')
        '/usr/lib/pypy/dist-packages/'
        r'z/usr/lib/pypy/dist-packages/�2.6z /usr/lib/python%s/site-packages/z3.0z /usr/lib/python%s/dist-packages/z/usr/lib/python3/dist-packages/z/usr/lib/debug%szdebian/)rrr)r
�gdb�packagerrs     r#�sitedirzInterpreter.sitedir�sz��&�'�1�T�\�\�2���9�9���1�D�
����
&�5��?�D�
����
&�5��?�D�4�D��%��,�D��$+�T�2�D��r%c	��t|xs|j�}d|jvrdnd}|td�kr||zSt|�\}}|j	d�s|dz
}t|d|dd�d	|j
|��d|���S)
a�Given path to a .py file, return path to its .pyc/.pyo file.

        This function is inspired by Python 3.2's imp.cache_from_source.

        :param fpath: path to file name
        :param version: Python version

        >>> i = Interpreter('python')
        >>> i.cache_file('foo.py', Version('3.1'))
        'foo.pyc'
        >>> i.cache_file('bar/foo.py', '3.2')
        'bar/__pycache__/foo.cpython-32.pyc'
        z-O�o�c�3.1z.py�__pycache__N���r)rrrr�endswithr�	magic_tag)r
�fpathr�	last_char�fdir�fnames      r#�
cache_filezInterpreter.cache_file�s����'�1�T�\�\�2���4�<�<�/�C�S�	��g�e�n�$��9�$�$��E�l���e��~�~�e�$��U�N�E��D�-��3�B�Z�����!8�)�*E�F�	Fr%c�\�t|xs|j�}|j|�\}}|jdd�d}|r*|dj	|�z
}|r|dj	|�z
}|j
r"|jdk(r|td�zr|dz
}d	j	|�S)
z5Return extension name with soname and multiarch tags.r�rz.{}z-{}r
�3�_dz{}.so)rr�_get_configrr5rr)r
rr�soabi�	multiarchr.s      r#�ext_filezInterpreter.ext_file�s����'�1�T�\�\�2���+�+�G�4���y����C��#�A�&����e�l�l�5�)�)�F���%�,�,�y�1�1���:�:�$�)�)�y�0��w�s�|�+��d�N�F��~�~�f�%�%r%c��t|xs|j�}|jdk(r|td�zry|jd|�}t	|�S)zReturn magic number.r
rQrz9import importlib.util; print(importlib.util.MAGIC_NUMBER))rrr�_execute�eval)r
rr.s   r#�magic_numberzInterpreter.magic_number�sK���'�1�T�\�\�2���9�9�	�!�g����&=�����Z�\c�d���F�|�r%c��t|xs|j�}|jdk(r|td�zry|jd|�S)z�Return Python magic tag (used in __pycache__ dir to tag files).

        >>> i = Interpreter('python')
        >>> i.magic_tag(version='3.2')
        'cpython-32'
        r
�3.2rz/import sys; print(sys.implementation.cache_tag))rrrrXr6s  r#rIzInterpreter.magic_tag�sD���'�1�T�\�\�2���9�9�	�!�g����&?���}�}�N�PW�X�Xr%c��t|xs|j�}	|j|�\}}|S#t$rtjdd��YywxYw)zReturn multiarch tag.zcannot get multiarchT��exc_infor�rrrS�	Exception�logr�r
rrTrUs    r#rUzInterpreter.multiarch�s\���'�1�T�\�\�2��	�#�/�/��8��E�9�
���	�	��I�I�,�t�I�<��	���1� A�Ac��t|xs|j�}|jdk(r*|td�z	rdj|j�Syy)Nr
r\zabi{})rrrr5�majorr6s  r#�	stableabizInterpreter.stableabisH���'�1�T�\�\�2���9�9�	�!�g����&?��>�>�'�-�-�0�0�'@�!r%c��t|xs|j�}	|j|�\}}|S#t$rtjdd��YywxYw)z�Return SOABI flag (used to in .so files).

        >>> i = Interpreter('python')
        >>> i.soabi(version=Version('3.3'))
        'cpython-33m'
        zcannot get soabiTr^rr`rcs    r#rTzInterpreter.soabi	s]���'�1�T�\�\�2��	�#�/�/��8��E�9�
���	�	��I�I�(�4�I�8��	�rdc��t|xs|j�}d|vr|jdd�\}}nd}tj	|�}|sy|j�}|dryt
||��}|dr#dj|dd	|dd�|_|js|d
sd|dxsdvrd
|_	|j�\}}|d}|jdk(r%|jdz	r|jd�r|dd}|ds|r9dj||dxs|�}|ds|rdj||dxs|�}|dz
}||k(ryt||�S#t$rtjdd
��YywxYw)a�Return extension file name if file can be renamed.

        >>> i = Interpreter('python')
        >>> i.check_extname('foo.so', version='3.3') # doctest: +ELLIPSIS
        'foo.cpython-33m-....so'
        >>> i.check_extname('foo.abi3.so', version='3.3')
        >>> i.check_extname('foo/bar/bazmodule.so', version='3.3') # doctest: +ELLIPSIS
        'foo/bar/baz.cpython-33m-....so'
        �/rPrNrg)r�verz{}.{}rr�d�flagsTzcannot get soabi/multiarchr^rr
r\�modulei����rTrUz{}-{}z.so)rr�rsplit�
EXTFILE_REr9r:rr5rrSrarbrrHr)	r
rMrrL�info�irTrUr.s	         r#�
check_extnamezInterpreter.check_extnames����'�1�T�\�\�2���%�<��,�,�s�A�.�K�D�%��D�� � ��'�����~�~���������g�.����;����t�E�{�1�~�t�E�{�1�~�F�A�I��w�w�D��M�S�T�'�]�5H�b�-I��A�G�	� �}�}���E�9��f����6�6�Y��1�9�9��#5�&�/�/�(�:S��C�R�[�F���=�E��^�^�F�D��M�,B�U�C�F��K� �I� �����[�0A�0N�Y�O���%����F�?���D�&�!�!���	��I�I�2�T�I�B��	�s�=E �  F�Fc�@�t|xs|j�}|jdk(s#|jdk(r|dz	r|dzs
|dz	s|dk(rd}nd}|dz
}|j||�j	d	�}	t
jd
|d<|S#t$rY|SwxYw)Nr'r
r>rQrEzimport sysconfig as s;z%from distutils import sysconfig as s;zOprint("__SEP__".join(i or "" for i in s.get_config_vars("SOABI", "MULTIARCH")))�__SEP__�DEB_HOST_MULTIARCHrP)rrrrXr�os�environ�KeyError)r
r�cmd�	conf_varss    r#rSzInterpreter._get_configKs����'�1�T�\�\�2���9�9���$�)�)�y�"8��5� �W��^��e�#�w�#�~�*�C�9�C��D�	D���M�M�#�w�/�5�5�i�@�	�	��:�:�&:�;�I�a�L�����	����	�s�8B�	B�Bc���t|xs|j�}|j|�d|f}|r1||jjvr|jj|St|�}|ddk7r6tj|d�tdj||d���|dj�}t|�dk(r|d}|r||jj|<|S)Nz-c�
returncoder�stderrz{} failed with status code {}�stdoutrP)rrr-�	__class__�_cacherrbrrar5�
splitlines�len)r
�commandr�cache�outputr.s      r#rXzInterpreter._execute^s����'�1�T�\�\�2���:�:�g�&��g�6���W���� 5� 5�5��>�>�(�(��1�1���!���,��1�$��I�I�f�X�&�'��;�B�B�7�F�S_�L`�a�b�b���!�,�,�.���v�;�!���A�Y�F��-3�D�N�N�!�!�'�*��
r%)NNNNNNN)FNNr1)NT)�__name__�
__module__�__qualname__rrrrrrr�r$r*r/r2r-�staticmethodrrArNrVrZrIrUrgrTrsrSrXrr%r#rr<s����D��D��G��E��D��G�
�F�AE�04�$�*(� �(������0$�LF�2&��
Y�	�1��"/"�b�&r%r)�loggingrw�re�os.pathrr�	debpythonr�debpython.versionr�compile�VERBOSEr8rp�	getLoggerr�rbrrr%r#�<module>r�sw��*�	�	���%�
�R�Z�Z��
����
��R�Z�Z�
� �j�j�!�
�"�g����!��u�ur%

Zerion Mini Shell 1.0