/ lib / packaging / tags.pyc
tags.pyc
  1  o

  2  %��cU@�
@sUddlZddlZddlZddlZddlZddlmZddlmZm	Z	m
  3  Z
  4  mZmZm
Z
mZmZmZmZddlmZmZe�e�ZeeZeeefZdddd	d
  5  d�Zeeefed<ejd
kZGdd�d�Z dede	e fdd�Z!dHdede"deeedffdd�Z#dedefdd�Z$dede"fdd�Z%dHdede"deefd d!�Z&			dIdd"�de
ed#e
e
  6  ed$e
e
  7  ede"dee f
  8  d%d&�Z'deefd'd(�Z(			dIdd"�d)e
ed#e
e
  9  ed$e
e
 10  ede"dee f
 11  d*d+�Z)dedeefd,d-�Z*			dIde
ed)e
ed$e
e
 12  edee fd.d/�Z+efd0ed1e"defd2d3�Z,d4ed5edeefd6d7�Z-	dJd4e
ed0e
edeefd8d9�Z.efd1e"deefd:d;�Z/deefd<d=�Z0deefd>d?�Z1defd@dA�Z2dd"�de"defdBdC�Z3d4edefdDdE�Z4dd"�de"dee fdFdG�Z5dS)K�N)�EXTENSION_SUFFIXES)
 13  �Dict�	FrozenSet�Iterable�Iterator�List�Optional�Sequence�Tuple�Union�cast�)�
 14  _manylinux�
 15  _musllinux�py�cp�pp�ip�jy)�python�cpython�pypy�
 16  ironpython�jython�INTERPRETER_SHORT_NAMESlc@s�eZdZdZgd�Zdedededdfdd	�Zedefd
 17  d��Zedefdd
��Z	edefdd��Z
 18  dedefdd�Z
defdd�Zdefdd�Zdefdd�ZdS)�Tagz�
 19      A representation of the tag triple for a wheel.
 20  
 21      Instances are considered immutable and thus are hashable. Equality checking
 22      is also supported.
 23      )�_interpreter�_abi�	_platform�_hash�interpreter�abi�platform�returnNcCs8|��|_|��|_|��|_t|j|j|jf�|_dS�N)�lowerrrr�hashr)�selfr r!r"�r(��C:\Users\Jacks.GUTTSPC\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\packaging\tags.py�__init__5s
 24  
 25  
 26  zTag.__init__cC�|jSr$)r�r'r(r(r)r @�zTag.interpretercCr+r$)rr,r(r(r)r!Dr-zTag.abicCr+r$)rr,r(r(r)r"Hr-zTag.platform�othercCs>t|t�stS|j|jko|j|jko|j|jko|j|jkSr$)�
 27  isinstancer�NotImplementedrrrr)r'r.r(r(r)�__eq__Ls
 28  
 29  �
 30  �
 31  �z
 32  Tag.__eq__cCr+r$)rr,r(r(r)�__hash__WszTag.__hash__cCs|j�d|j�d|j��S)N�-)rrrr,r(r(r)�__str__ZszTag.__str__cCsd|�dt|��d�S)N�<z @ �>)�idr,r(r(r)�__repr__]szTag.__repr__)�__name__�
 33  __module__�__qualname__�__doc__�	__slots__�strr*�propertyr r!r"�object�boolr1�intr2r4r8r(r(r(r)r+sr�tagr#c	Cs`t�}|�d�\}}}|�d�D]}|�d�D]}|�d�D]}|�t|||��qqqt|�S)z�
 34      Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances.
 35  
 36      Returning a set is required due to the possibility that the tag is a
 37      compressed tag set.
 38      r3�.)�set�split�addr�	frozenset)rC�tags�interpreters�abis�	platformsr r!�	platform_r(r(r)�	parse_tagas��rNF�name�warncCs&t�|�}|dur|rt�d|�|S)Nz>Config variable '%s' is unset, Python ABI tag may be incorrect)�	sysconfig�get_config_var�logger�debug)rOrP�valuer(r(r)�_get_config_varqs
 39  �rV�stringcCs|�dd��dd�S)NrD�_r3)�replace)rWr(r(r)�_normalize_stringzsrZ�python_versioncCst|�dkot|�dkS)zj
 40      Determine if the Python version supports abi3.
 41  
 42      PEP 384 was first implemented in Python 3.2.
 43      r
)��)�len�tuple)r[r(r(r)�
_abi3_applies~sr`�
 44  py_versionc	Cs�t|�}g}t|dd��}d}}}td|�}ttd�}dtv}	|s,|dur.|s,|	r.d}|dkrXtd|�}
 45  |
 46  s=|
 47  dur?d	}|d
 48  krWtd|�}|dksU|durWtjd
krWd}n
 49  |rb|�d|���|�ddj	||||d��|S)Nr]��Py_DEBUG�gettotalrefcountz_d.pyd�d)r\��
WITH_PYMALLOC�m)r\r\�Py_UNICODE_SIZE�i���urrz"cp{version}{debug}{pymalloc}{ucs4})�versionrT�pymalloc�ucs4)
 50  r_�_version_nodotrV�hasattr�sysr�
 51  maxunicode�append�insert�format)rarPrKrlrTrmrn�
 52  with_debug�has_refcount�has_ext�
with_pymalloc�unicode_sizer(r(r)�
_cpython_abis�s8
 53  
 54  
 55  
 56  ���r{�rPrKrLc	#sB�|s
 57  tjdd�}dt|dd�����|dur't|�dkr%t||�}ng}t|�}dD]}z|�|�Wq-ty?Yq-wt|pEt��}|D]}|D]	}t	�||�VqMqIt
 58  |�rh�fdd�|D�EdH�fdd�|D�EdHt
 59  |�r�t|dddd	�D]}|D]}d
 60  jt|d|f�d��t	�d
|�Vq�q�dSdS)a
 61      Yields the tags for a CPython interpreter.
 62  
 63      The tags consist of:
 64      - cp<python_version>-<abi>-<platform>
 65      - cp<python_version>-abi3-<platform>
 66      - cp<python_version>-none-<platform>
 67      - cp<less than python_version>-abi3-<platform>  # Older Python versions down to 3.2.
 68  
 69      If python_version only specifies a major version then user-provided ABIs and
 70      the 'none' ABItag will be used.
 71  
 72      If 'abi3' or 'none' are specified in 'abis' then they will be yielded at
 73      their normal position and not at the beginning.
 74      Nr]rr
)�abi3�nonec3��|]	}t�d|�VqdS)r}N�r��.0rM�r r(r)�	<genexpr>���zcpython_tags.<locals>.<genexpr>c3r)r~Nr�r�r�r(r)r��r������zcp{version}r�rlr})
rq�version_inforor^r{�list�remove�
 75  ValueError�
platform_tagsrr`�rangeru)r[rKrLrP�explicit_abir!rM�
minor_versionr(r�r)�cpython_tags�sB������r�ccs"�t�d�}|rt|�VdSdS)N�SOABI)rQrRrZ)r!r(r(r)�_generic_abi�s
 76  �
 77  �r�r ccs��|st�}t|d�}d�||g�}|durt�}t|pt��}t|�}d|vr-|�d�|D]}|D]	}t|||�Vq3q/dS)z�
 78      Yields the tags for a generic interpreter.
 79  
 80      The tags consist of:
 81      - <interpreter>-<abi>-<platform>
 82  
 83      The "none" ABI will be added if it was not explicitly provided.
 84      r|rbNr~)�interpreter_name�interpreter_version�joinr�r�r�rsr)r rKrLrP�interp_name�interp_versionr!rMr(r(r)�generic_tags�s �
 85  
 86  ��r�ccs|�t|�dkrdt|dd����Vd|d��Vt|�dkr:t|dddd�D]}dt|d|f���Vq+dSdS)z�
 87      Yields Python versions in descending order.
 88  
 89      After the latest version, the major-only version will be yielded, and then
 90      all previous versions of that major version.
 91      r
rNr]rr�)r^ror�)ra�minorr(r(r)�_py_interpreter_ranges��r�ccsz�|s
 92  tjdd�}t|pt��}t|�D]}|D]	}t|d|�Vqq|r-t|dd�Vt|�D]	}t|dd�Vq1dS)z�
 93      Yields the sequence of tags that are compatible with a specific version of Python.
 94  
 95      The tags consist of:
 96      - py*-none-<platform>
 97      - <interpreter>-none-any  # ... if `interpreter` is provided.
 98      - py*-none-any
 99      Nr]r~�any)rqr�r�r�r�r)r[r rLrlrMr(r(r)�compatible_tagss�
��r��arch�is_32bitcCs|s|S|�d�rdSdS)N�ppc�i386)�
100  startswith)r�r�r(r(r)�	_mac_arch0s
101  
102  r�rl�cpu_archcCs�|g}|dkr|dkr
gS|�gd��n7|dkr'|dkrgS|�gd��n%|dkr;|dks3|dkr5gS|�d�n|d	krL|d
103  krEgS|�ddg�|d
vrU|�d�|dvr^|�d�|S)N�x86_64)�
104  rj)�intel�fat64�fat32r�)r�r��fat�ppc64)r��r�r�)r��r�r�>r��arm64�
105  universal2>r�r�r�r�r��	universal)�extendrs)rlr��formatsr(r(r)�_mac_binary_formats:s,
106  
107  r�c
108  cs��t��\}}}|durFtdttt|�d�dd����}|dkrEtjt	j
109  dddgd	d
110  ditjd	d�j}tdttt|�d�dd����}n|}|durQt
|�}n|}d
|kr}|dkr}t|ddd�D]}d|f}t||�}|D]}djd||d�Vqpqc|dkr�t|ddd�D]}	|	df}t||�}|D]}dj|	d|d�Vq�q�|dkr�|dkr�tddd�D]}d|f}t||�}|D]}dj|d|d|d�Vq�q�dStddd�D]}d|f}d}dj|d|d|d�Vq�dSdS)aD
111      Yields the platform tags for a macOS system.
112  
113      The `version` parameter is a two-item tuple specifying the macOS version to
114      generate platform tags for. The `arch` parameter is the CPU architecture to
115      generate platform tags for. Both parameters default to the appropriate value
116      for the current system.
117      N�
118  MacVersionrDr])r��z-sSz-cz-import platform; print(platform.mac_ver()[0])TZSYSTEM_VERSION_COMPAT�0)�check�env�stdout�universal_newlines)r�r)�rr
r�r�z&macosx_{major}_{minor}_{binary_format})�majorr��
binary_formatrr�r�r\r�)r"�mac_verrr_�maprBrF�
119  subprocess�runrq�
120  executable�PIPEr�r�r�r�ru)
121  rlr��version_strrXr�r��compat_version�binary_formatsr��
major_versionr(r(r)�
mac_platformsZs��"���"�
122  
123  
124  ��
125  
126  ��
127  
128  ���
129  
130  ��r�ccsh�tt���}|r|dkrd}n|dkrd}|�dd�\}}t�||�EdHt�|�EdH|VdS)N�linux_x86_64�
131  linux_i686�
linux_aarch64�linux_armv7lrXr
)rZrQ�get_platformrFrr�r)r��linuxrXr�r(r(r)�_linux_platforms�s�
132  r�ccs�tt���VdSr$)rZrQr�r(r(r(r)�_generic_platforms�s�r�cCs*t��dkr	t�St��dkrt�St�S)z;
133      Provides the platform tags for this installation.
134      �Darwin�Linux)r"�systemr�r�r�r(r(r(r)r��s
135  r�cCstjj}t�|�p
136  |S)z6
137      Returns the name of the running interpreter.
138      )rq�implementationrOr�get)rOr(r(r)r��sr�cCs2td|d�}|rt|�}|Sttjdd��}|S)z9
139      Returns the version of the running interpreter.
140      �py_version_nodotr|Nr])rVr>rorqr�)rPrlr(r(r)r��s�r�cCsd�tt|��S)Nrb)r�r�r>r�r(r(r)ro�sroccsl�t�}|dkrt|d�EdHnt�EdH|dkrd}n|dkr*dt|d�}nd}t|d�EdHdS)z�
141      Returns the sequence of tag triples for the running interpreter.
142  
143      The order of the sequence corresponds to priority order for the
144      interpreter, from most to least important.
145      rr|Nr�pp3r�)r�r�r�r�r�)rPr��interpr(r(r)�sys_tags�s�r�)F)NNN)NN)6�loggingr"r�rqrQ�importlib.machineryr�typingrrrrrrr	r
146  rrrbrr�	getLoggerr9rSrB�
PythonVersionr�rr>�__annotations__�maxsize�_32_BIT_INTERPRETERrrNrArVrZr`r{r�r�r�r�r�r�r�r�r�r�r�r�r�ror�r(r(r(r)�<module>s�
147  0
148  �
149  	6"		%���
150  �
151  ��
152  �9���
153  �
154  ��
155  ����
156  �
157  �
158  !���
159  �X