
    5h@I                       U d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlmZ ddlZddlmZ ddlmZ ddlmZ ddlmZ d	d
lmZ d	dlmZ ddlmZ ddlmZ de fddddddddfddddddddfddddddddfdddd d!d"d#dffZ!ej"        #                    d$e!d% e!D             &          d'             Z$ej%        dd(            Z&d) Z'd* Z(d+ Z)d, Z* G d- d.          Z+ e,d/d0d1d2ii e,d0g3           e(d4g d5d1gd6i          7           e,d8 e,d9:          ;           e,d<d= ed>          i e,d?d=gfg@           e(d4g d5d=gdAi          7           e,dBdC edD          i e, e+dEdBdCgF          gG           e(dHdIdJg d5igi          7           e,dKdL edM          i e,dLgN           e(d4dLdJg d5igi          7           e,dO edP           edQ          dR e,dSdTgU           e(d4dJdVdWdXdYdZdSdTgigii          7           e,d[d\ e(d4dJg d]ii           ed^          _           e,d`dae
j-        db edc          d           e,dedfe
j-        dgh           e,didjdkdli edm          n           e,dodkdpe
j-        dqidr eds          z   t           e,dudvdkdwi edx          n           e,dyd0dzd1d2iii e,d0gd{g|           e(d4d}dJg d~id0d1dzd1gigigi          7           e,ddd1dii e,dgdg|           e(d4d}dJg d~idd1gigi          7           e,dd0d2d= ed          idi e,d0gddgfg           e(d4g d5d1d?d=gigd6i          7          fZ.de/d<   ej"        #                    de.d e.D             &          d             Z0d Z1d Z2d Z3dS )zwheel tests    )annotationsN)Anypath	parse_tag)metadata)Wheel   )tempdir)DALS)get_config_var)get_platformzinvalid.whlz&simplewheel-2.0-1-py2.py3-none-any.whlsimplewheelz2.01zpy2.py3noneany)project_nameversionbuild
py_versionabiplatformz$simple.dist-0.1-py2.py3-none-any.whlzsimple.distz0.1z example_pkg_a-1-py3-none-any.whlexample_pkg_apy3z9PyQt5-5.9-5.9.1-cp35.cp36.cp37-abi3-manylinux1_x86_64.whlPyQt5z5.9z5.9.1zcp35.cp36.cp37abi3manylinux1_x86_64)filenameinfoc                    g | ]
}|d          S )r    .0ts     ;lib/python3.11/site-packages/setuptools/tests/test_wheel.py
<listcomp>r'   P   s    0P0P0P!10P0P0P    )idsc                   t          j        |          r=t          j        |          5  t	          |            d d d            n# 1 swxY w Y   d S t	          |           fd|                                D             |k    sJ d S )Nc                2    i | ]}|t          |          S r"   )getattr)r$   kws     r&   
<dictcomp>z#test_wheel_info.<locals>.<dictcomp>X   s#    222Awq!}}222r(   )inspectisclasspytestraisesr
   keys)r   r    r.   s     @r&   test_wheel_infor5   O   s     t ]4   	 	(OOO	 	 	 	 	 	 	 	 	 	 	 	 	 	 	hA2222diikk222d::::::s   AA
A
c              +    K   dt          d          |z                      d          i}| r|                    |            t                      5 }t	          j        ||           t          j        t          j	        dddf|           t          j
        t          j                            |dd                    d	         V  d d d            d S # 1 swxY w Y   d S )
Nsetup.pyz
            # -*- coding: utf-8 -*-
            from setuptools import setup
            import setuptools
            setup(**%r)
            utf-8-qbdist_wheelcwddist*.whlr   )r   encodeupdater   r   r   
subprocess
check_callsys
executableglobosjoin)extra_file_defskwargs	file_defs
source_dirs       r&   build_wheelrL   [   sB      	   &//I  *)))	 Fj
9j)))^Z}=:	
 	
 	
 	
 iZAABB1EEEEF F F F F F F F F F F F F F F F F Fs   A5CCCc           
        t                      }t          j        |           D ]\\  }}}|D ]S}|                    t          j                            t          j                            ||           |                     T]|S N)setrF   walkaddr   rG   relpath)rootcontentsdirpathdirnames	filenamesr   s         r&   tree_setrX   t   s|    uuH(* Q Q$9! 	Q 	QHLLbgoogt&D&DhOOPPPP	QOr(   c                x   t                      }|                                 D ]\  }t          |t                    rt	          |          }|D ]i}t          |t                    r|fdt	          |          D             z  }6|                    t          j                            |                     j|S )z8Flatten nested dicts and lists into a full list of pathsc                P    h | ]"}t           j                            |          #S r"   )rF   r   rG   )r$   valnodes     r&   	<setcomp>zflatten_tree.<locals>.<setcomp>   s)    QQQs27<<c22QQQr(   )	rO   items
isinstancedictflatten_treerQ   rF   r   rG   )treeoutputrT   elemr\   s       @r&   ra   ra   |   s    UUF**,, 5 5hh%% 	.#H--H 	5 	5D$%% 5QQQQl4>P>PQQQQ

27<<d334444		5
 Mr(   c                    d | D             S )Nc           	         h | ]S}|                     t          j                    t                      t	          d           pt	          d                    TS )
EXT_SUFFIXSO)r   r   	shlib_ext)format	sysconfigget_python_versionr   r   )r$   xs     r&   r]   z&format_install_tree.<locals>.<setcomp>   sh         	
 355!^^$\22JnT6J6J 	 	
 	
  r(   r"   )rb   s    r&   format_install_treern      s%         r(   c                   t          |           }t          j                            ||                                          }|                    |           |@t          |          }t          |          }	|                    |	          sJ ||	z
              t          j
                            |g          \  }
|
j	        d         |k    sJ |
j	        d         |k    sJ |
                    d          |k    sJ d S )Nr   NameVersionrequires.txt)r
   rF   r   rG   egg_nameinstall_as_eggrn   rX   issubsetr	   Distributiondiscover	read_text)r   install_dirinstall_tree_includesr   r   requires_txtr.   egg_pathinstall_treeexpr=   s              r&   _check_wheel_installr      s     	hAw||K66HX(*+@AA{##$$S))==<#+===)#,,8*,==GT = L0000=#w....>>.))\999999r(   c                      e Zd Zd ZddZdS )Recordc                "    || _         || _        d S rN   _id_fields)selfidrI   s      r&   __init__zRecord.__init__   s    r(   returnstrc                &    | j          d| j        dS )Nz(**)r   )r   s    r&   __repr__zRecord.__repr__   s    (00t|0000r(   N)r   r   )__name__
__module____qualname__r   r   r"   r(   r&   r   r      s7          1 1 1 1 1 1r(   r   basicfoo__init__.py )packagesfoo-1.0-py{py_version}.egg)PKG-INFORECORDWHEELtop_level.txt)EGG-INFOr   r   rJ   setup_kwargsr}   r8   u   Description accentuée)description)r   r   datazdata.txtz.
                Some data...
                data_dir)
data_files)r   r   	extensionzextension.can  
                #include "Python.h"

                #if PY_MAJOR_VERSION >= 3

                static struct PyModuleDef moduledef = {
                        PyModuleDef_HEAD_INIT,
                        "extension",
                        NULL,
                        0,
                        NULL,
                        NULL,
                        NULL,
                        NULL,
                        NULL
                };

                #define INITERROR return NULL

                PyMODINIT_FUNC PyInit_extension(void)

                #else

                #define INITERROR return

                void initextension(void)

                #endif
                {
                #if PY_MAJOR_VERSION >= 3
                    PyObject *module = PyModule_Create(&moduledef);
                #else
                    PyObject *module = Py_InitModule("extension", NULL);
                #endif
                    if (module == NULL)
                        INITERROR;
                #if PY_MAJOR_VERSION >= 3
                    return module;
                #endif
                }
                zsetuptools.Extension)namesources)ext_modulesz%foo-1.0-py{py_version}-{platform}.eggzextension{shlib_ext}r   headerzheader.hz
                )headersscriptX
                #/usr/bin/python
                print('hello world!')
                N
                #/bin/sh
                echo 'hello world!'
                	script.py	script.shr   r   scriptsr   r   r   r   r   	requires1zfoobar==2.0)r   r   r   rr   r   z%
            foobar==2.0
            )r   install_requiresr}   r{   	requires2z
        bar
        foo<=2.0; z in sys_platform
        z2
            bar
            foo<=2.0
            )r   r   r{   	requires3z
        bar; z != sys_platform
        )r   r   	requires4z
        foo
        extrazfoobar>3zG
            foo

            [extra]
            foobar>3
            )r   r   extras_requirer{   	requires5zfoobar; z != sys_platform
z!
            [extra]
            )r   r   r{   requires_ensure_orderz9
        foo
        bar
        baz
        qux
        za
            foobar>3
            barbaz>4
            bazqux>5
            quxzap>6
            z
            foo
            bar
            baz
            qux

            [extra]
            foobar>3
            barbaz>4
            bazqux>5
            quxzap>6
            namespace_packagebarzfoo.bar)namespace_packagesr   z foo-1.0-py{py_version}-nspkg.pth)r   r   r   znamespace_packages.txtr   empty_namespace_packagefoobarz7__import__('pkg_resources').declare_namespace(__name__)data_in_packagez>
                        Some data...
                        )r   r   zfoo/data_dirzfoo/data_dir/data.txt)r   r   ztuple[dict[str, Any], ...]WHEEL_INSTALL_TESTSparamsc                    g | ]
}|d          S )r   r"   )r$   r   s     r&   r'   r'   (  s    888&888r(   c           
     .   |                      dd          }|                      dd          }|                      dg           }|                      di           }|                      dd           }|                      d          }|                      d	i           }|                      d
i           }t          d|||||d|5 }	t                      5 }
t          |	|
||||           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nr   r   r   1.0r   r   r{   r}   rJ   r   r   r   r   r   rH   r"   )getrL   r   r   )r   r   r   r   r   r{   r}   rJ   r   r   ry   s              r&   test_wheel_installr   %  s    ::fe,,LjjE**Gzz"4b99ZZ 0"55N::nd33L::n--L

;++I::nb11L 	
-)%	
 	
 	
 	

 		
 !k<w	
 	
 	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
s6   D
C2&D
2C6	6D
9C6	:D

DDc                    d} d}|  d| d}t                      5 }t          j                            ||          }t	          j        |d                                           t                      5 }t          j        t                    5  t          ||d | |d            d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )N
nodistinfor   -z-py2.py3-none-any.whlr.   )r   rF   r   rG   zipfileZipFilecloser2   r3   
ValueErrorr   )r   r   
wheel_namerK   
wheel_pathry   s         r&   test_wheel_no_dist_dirr   C  s   LG AA7AAAJ	 jW\\*j99

C((..000YY 	+z**  $T<$                	 	 	 	 	 	 	 	 	 	 	 	 	 	 		                 sZ   AC1CB, C,B00C3B04C7CC	C
C	CC"Cc                ~    d }|                      d|           t          d                                          sJ d S )Nc                 4    d t          d          D             S )Nc                6    h | ]}|j         |j        |j        fS r"   )interpreterr   r   r#   s     r&   r]   z=test_wheel_is_compatible.<locals>.sys_tags.<locals>.<setcomp>T  s5     
 
 
 ]AE1:.
 
 
r(   zcp36-cp36m-manylinux1_x86_64r   r"   r(   r&   sys_tagsz*test_wheel_is_compatible.<locals>.sys_tagsS  s,    
 
=>>
 
 
 	
r(   z$setuptools.wheel._get_supported_tagsz2onnxruntime-0.1.2-cp36-cp36m-manylinux1_x86_64.whl)setattrr
   is_compatible)monkeypatchr   s     r&   test_wheel_is_compatibler   R  sQ    
 
 
 >IIIEFFTTVVVVVVVr(   c                    t           j        dd            } t          dt          d          t          d          dt          ddg          t	          d	d
dddddddgigii                    }|                    dd          }|                    dd          }|                    d          }|                    di           }|                    di           } | d||g i |d|5 }t                      5 }t          |||||d            t          |          }	t          j
        |          |	                                z  }
|
d
z  dz  dz  }|                                sJ t          j        dk    r>t          t!          j        |                                j                            dk    sJ d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nc              ;    K   dt          d          |z                      d          i}| r|                    |            t                      5 }t	          j        ||           t          j        |          dz  }t          j	        |d           t          j        t          j        dddf|           t          j        t          j                            |d	d
                    d         V  d d d            d S # 1 swxY w Y   d S )Nr7   z
                # -*- coding: utf-8 -*-
                from setuptools import setup
                import setuptools
                setup(**%r)
                r8   r   i  r9   r:   r;   r=   r>   r   )r   r?   r@   r   r   r   pathlibPathrF   chmodrA   rB   rC   rD   rE   rG   )rH   rI   rJ   rK   runshs        r&   rL   z$test_wheel_mode.<locals>.build_wheel^  sh         fWoo
	  	._---YY 	J*Jy*---L,,{:EHUE"""!T=Az    )BGLLVWEEFFqIIII	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	Js   B!C==DDr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r}   rJ   r   r   win320o777rN   r"   )
contextlibcontextmanagerr`   r   ra   r   r   r   r
   r   r   rs   existsrC   r   octstatS_IMODEst_mode)rL   r   r   r   r}   rJ   r   r   ry   r.   base	script_shs               r&   test_wheel_moder   ]  s   J J J J2    
 
  +.
 
 
 "(#k :;+
#
 
 
'  F@ ::fe,,LjjE**G::n--L

;++I::nb11L 	 	
%	
 	
 	
 	
J 		J !k<w	
 	
 	
 (OO|K((1::<<7:%	1K?	!!!!!<7""t|INN$4$4$<==>>'IIII)J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J J Js7   ,G;B<G7GG	G
G	GG"GrN   )4__doc__
__future__r   r   rE   r0   rF   r   r   rA   rC   rk   r   typingr   r2   jaracor   packaging.tagsr   setuptools._importlibr	   setuptools.wheelr
   contextsr   textwrapr   distutils.sysconfigr   distutils.utilr   r   WHEEL_INFO_TESTSmarkparametrizer5   r   rL   rX   ra   rn   r   r   r`   r   r   __annotations__r   r   r   r   r"   r(   r&   <module>r      s
      " " " " " "       				       



                   $ $ $ $ $ $ * * * * * * " " " " " "             . . . . . . ' ' ' ' ' ' J0)#	
 	

 	/)#	
 	

 	++	
 	

 	D#*+	
 	

G. b *0P0P?O0P0P0P   ; ; ; F F F F0      : : :(1 1 1 1 1 1 1 1 	D="-.TW
 
 
 "\(LLL%+ +#
     	DT0
 
 
   	D 
 T#j\23
 
 
 "\(LLL'L+ +#
    & 	D44(* *,
Z T*}o  
 
 
 "\3& ! ! !
6#
  mC C CH 	D 
 TL
 
 
 "\( ! ! !
+#
    2 	D   
 
 T +.
 
 
 "\(#k :;+
#
 
 
'  > 	D&!\(   +
#
 
 
 T
 
  ( 	D<   T
 
   	Dl     	D Z
 T
 
  " 	D@@@@
 
$
 

   	D"  
 T
 
!  > 	Dr*

 T %w[
 
 
 "\(2 ! ! ! %0+#
    @ 	D$M
 T (zZ
 
 
 "\(2 ! ! ! %+#
       B 	D!! !	 	
 TW'*A)BCD
 
 
 "\(   ""&%+ +#
  %$ $ $O
l3  l l l l^ 88$7888   

 
 

2  W W WUJ UJ UJ UJ UJr(   