o
    !gM                  
   @  s  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mZ d dlmZ d dlmZ d dlZd dlZd dlmZ d dlZd dlmZmZ d dlmZ d d	lmZ d d
lm Z  h dZ!h dZ"ddhZ#dZ$e$ddide%&e"e#B dedddedddideddddedddddddddiided ddd!d"ed#d$d%d&Z'e
jd'kred(d)d*d+e'd,< d-d. Z(d/d0 Z)ej*d1d2d3d4 Z+ej*d5d6 Z,d7d8 Z-d9d: Z.d;Z/d<d= Z0d>d? Z1d@dA Z2ej34dBdCdDdEe$5dFdGfgdHdI Z6dJdK Z7dLdM Z8dNdO Z9dPZ:dQZ;ej3<dRdSdT Z=dUdV Z>ej3j4dWe?ej@A e?ej@dXdYdZ ZBd[d\ ZCd]d^ ZDd_d` ZEdadb ZFdcdd ZGdedf ZHdgdh ZIdidj ZJdkdl ZKej34dmdndogej3jLeM dpkdqdrdsdt ZNd{dwdxZOdydz ZPdS )|    )annotationsN)suppress)cleandoc)ZipFile)tags)bdist_wheelget_abi_tag)Distribution)SetuptoolsDeprecationWarning)	run_setup>   dummy_dist-1.0.dist-info/WHEEL&dummy_dist-1.0.dist-info/top_level.txtdummy_dist-1.0.dist-info/RECORD!dummy_dist-1.0.dist-info/METADATA>
   
COPYING.md
NOTICE.rstAUTHORS.txtLICENCE.txtLICENSE.txtNOTICEAUTHORSCOPYINGLICENCELICENSEzLICENSE~zAUTHORS~zQfrom setuptools import setup

setup(
    name='dummy_dist',
    version='1.0',
)
	DUMMYFILE )setup.pylicensesu  
            from setuptools import setup

            setup(
                name="simple.dist",
                version="0.1",
                description="A testing distribution ☃",
                extras_require={"voting": ["beaglevote"]},
            )
            )r   
simpledistui  
            from setuptools import setup

            setup(
                name="complex-dist",
                version="0.1",
                description="Another testing distribution ☃",
                long_description="Another testing distribution ☃",
                author="Illustrious Author",
                author_email="illustrious@example.org",
                url="http://example.org/exemplary",
                packages=["complexdist"],
                setup_requires=["setuptools"],
                install_requires=["quux", "splort"],
                extras_require={"simple": ["simple.dist"]},
                entry_points={
                    "console_scripts": [
                        "complex-dist=complexdist:main",
                        "complex-dist2=complexdist:main",
                    ],
                },
            )
            __init__.pyzdef main(): return)r   complexdistz
            from setuptools import setup

            setup(
                name="headers.dist",
                version="0.1",
                description="A distribution with headers",
                headers=["header.h"],
            )
            )r   zheadersdist.pyzheader.hak  
            from setuptools import setup

            setup(
                name="testrepo",
                version="0.1",
                packages=["mypackage"],
                description="A test package with commas in file names",
                include_package_data=True,
                package_data={"mypackage.data": ["*"]},
            )
            )r   z	1,2,3.txt)r   data	mypackage)r   r"   ztestrepo-0.1.0u  
            from setuptools import setup

            setup(
                name="unicode.dist",
                version="0.1",
                description="A testing distribution ☃",
                packages=["unicodedist"],
                zip_safe=True,
            )
            )r      åäö_日本語.py)r   unicodedistu   
            [metadata]
            name = utf8-metadata-dist
            version = 42
            author_email = "John X. Ãørçeč" <john@utf8.org>, Γαμα קּ 東 <gama@utf8.org>
            long_description = file: README.rst
               UTF-8 描述 説明)	setup.cfgz
README.rst)
dummy-distzsimple-distzcomplex-distzheaders-distzcommasinfilenames-distzunicode-distzutf8-metadata-distwin32u  
            from setuptools import Extension, setup

            setup(
                name="extension.dist",
                version="0.1",
                description="A testing distribution ☃",
                ext_modules=[
                    Extension(
                        name="extension", sources=["extension.c"], py_limited_api=True
                    )
                ],
            )
            z![bdist_wheel]
py_limited_api=cp32z5#define Py_LIMITED_API 0x03020000
#include <Python.h>)r   r&   extension.czabi3extension-distc                  K  s^   t jdrtdddntddi}|  t|}|  D ]
\}}t||| q|	  |S )zHRun command in the same process so that it is easier to collect coverager   init)
stop_afterscript_namez%%build_meta%%)
ospathexistsr   r	   parse_config_filesr   itemssetattrfinalize_options)kwargsdist_objcmdattrvalue r9   `/root/parts/websockify/install/lib/python3.10/site-packages/setuptools/tests/test_bdist_wheel.pybdist_wheel_cmd   s   

r;   c                 C  s&   |  |}tjjt| t|d |S )N)prefix)mktempjaracor.   buildEXAMPLESstr)tmp_path_factorynamebasedirr9   r9   r:   	mkexample   s   
rE   session)scopec              	   C  s   |  d}|  d}tD ]/}t| |}|| }tj | tt|t|d	  W d    n1 s6w   Y  qt
dd |dD S )Nr?   dist	bdist_dirdist_dirc                 s  s    | ]}t |V  qd S NrA   .0fnamer9   r9   r:   	<genexpr>   s    zwheel_paths.<locals>.<genexpr>z*.whl)r=   r@   rE   r>   r.   DirectoryStackcontextr;   rA   runsortedglob)rB   
build_baserK   rC   example_dir	build_dirr9   r9   r:   wheel_paths   s   


rZ   c                 C  s
   t | dS )Nr'   )rE   )rB   r9   r9   r:   
dummy_dist   s   
r[   c                 C  s6   t dd | D }t| D ]	}d|jvsJ qdS )z0Make sure entry point scripts are not generated.c                 s      | ]	}d |v r|V  qdS )complex_distNr9   rO   r.   r9   r9   r:   rQ          z"test_no_scripts.<locals>.<genexpr>z.data/scripts/N)nextr   infolistfilename)rZ   r.   entryr9   r9   r:   test_no_scripts   s   rd   c                 C  sX   t dd | D }t|}|d}W d    n1 sw   Y  d |v s*J d S )Nc                 s  r\   )unicode_distNr9   r^   r9   r9   r:   rQ      r_   z&test_unicode_record.<locals>.<genexpr>z!unicode_dist-0.1.dist-info/RECORDr#   )r`   r   readencode)rZ   r.   zfrecordr9   r9   r:   test_unicode_record   s
   
rj   u   Metadata-Version: 2.1
Name: helloworld
Version: 42
Author-email: "John X. Ãørçeč" <john@utf8.org>, Γαμα קּ 東 <gama@utf8.org>


UTF-8 描述 説明
c                 C  s   |  | |d }|d }|  |d jtdd |d   G dd dt}| }||| |d	 jdd}d
|v s?J d|v sEJ d|v sKJ d S )Nzdummy_dist.egg-infodummy_dist.dist-infozPKG-INFOutf-8encodingzdependency_links.txtc                   @  s$   e Zd ZdZdd Zedd ZdS )z;test_preserve_unicode_metadata.<locals>.simpler_bdist_wheelz1Avoid messing with setuptools/distutils internalsc                 S  s   d S rL   r9   selfr9   r9   r:   __init__  s   zDtest_preserve_unicode_metadata.<locals>.simpler_bdist_wheel.__init__c                 S  s   g S rL   r9   ro   r9   r9   r:   license_paths  s   zItest_preserve_unicode_metadata.<locals>.simpler_bdist_wheel.license_pathsN)__name__
__module____qualname____doc__rq   propertyrr   r9   r9   r9   r:   simpler_bdist_wheel  s
    rx   METADATAu"   Author-email: "John X. Ãørçeč"u   Γαμα קּ 東 r%   )chdirmkdir
write_textUTF8_PKG_INFOtouchr   egg2dist	read_text)monkeypatchtmp_pathegginfodistinforx   cmd_objmetadatar9   r9   r:   test_preserve_unicode_metadata  s   

r   c                 C  sp   | |  tt|d  td}dd tD }t| t|B ks&J W d    d S 1 s1w   Y  d S )NrJ   $dist/dummy_dist-1.0-py3-none-any.whlc                 S     h | ]}d | qS zdummy_dist-1.0.dist-info/r9   rN   r9   r9   r:   	<setcomp>+      z(test_licenses_default.<locals>.<setcomp>)	rz   r;   rA   rT   r   DEFAULT_LICENSE_FILESsetnamelistDEFAULT_FILESr[   r   r   wflicense_filesr9   r9   r:   test_licenses_default'  s   

"r   c                 C  s|   |  djddd ||  tt|d  td}dh}t| t	|B ks,J W d    d S 1 s7w   Y  d S )Nr&   z*[metadata]
license_file=licenses/DUMMYFILErl   rm   r   r   z"dummy_dist-1.0.dist-info/DUMMYFILE
joinpathr|   rz   r;   rA   rT   r   r   r   r   r   r9   r9   r:   test_licenses_deprecated1  s   


"r   )config_fileconfig)r&   z-[metadata]
license_files=licenses/*
  LICENSE)r&   z,[metadata]
license_files=licenses/*, LICENSEr   )z2  license_files=['licenses/DUMMYFILE', 'LICENSE'])c                 C  s   |  |j|dd ||  tt|d  td}dd dD }t| t	|B ks0J W d    d S 1 s;w   Y  d S )Nrl   rm   r   r   c                 S  r   r   r9   rN   r9   r9   r:   r   P  r   z)test_licenses_override.<locals>.<setcomp>>   r   r   r   )r[   r   r   r   r   r   r   r9   r9   r:   test_licenses_override>  s   

"r   c                 C  sr   |  djddd ||  tt|d  td}t| t	ks'J W d    d S 1 s2w   Y  d S )Nr&   z[metadata]
license_files=
rl   rm   r   r   r   )r[   r   r   r   r9   r9   r:   test_licenses_disabledV  s   


"r   c                 C  sp   | |  tt|dd  td}t| }d|v s J d|v s&J W d    d S 1 s1w   Y  d S )N2rJ   build_numberz&dist/dummy_dist-1.0-2-py3-none-any.whlr   r   )rz   r;   rA   rT   r   r   r   )r[   r   r   r   	filenamesr9   r9   r:   test_build_number`  s   

"r   c                 C  s`   | |  tjtdd tt|dd  W d    n1 s!w   Y  tj	ds.J d S )Nz.*universal is deprecatedmatchT)rJ   	universalz(dist/dummy_dist-1.0-py2.py3-none-any.whl)
rz   pytestwarnsr
   r;   rA   rT   r-   r.   r/   )r[   r   r   r9   r9   r:   test_universal_deprecatedi  s
   
r   a&  #include <Python.h>

static PyMethodDef methods[] = {
  { NULL, NULL, 0, NULL }
};

static struct PyModuleDef module_def = {
  PyModuleDef_HEAD_INIT,
  "extension",
  "Dummy extension module",
  -1,
  methods
};

PyMODINIT_FUNC PyInit_extension(void) {
  return PyModule_Create(&module_def);
}
u   from __future__ import annotations

from setuptools import Extension, setup

setup(
    name="extension.dist",
    version="0.1",
    description="A testing distribution ☃",
    ext_modules=[Extension(name="extension", sources=["extension.c"])],
)
zEonce:Config variable '.*' is unset.*, Python ABI tag may be incorrectc                 C  sh   | d}|d jtdd |d jtdd |d}|d}| | tt|t|d  d	S )
z=Test that building a binary wheel with the limited ABI works.extension_distr   rl   rm   r)   r?   rH   rI   N)	r=   r|   EXTENSION_SETUPPYEXTENSION_EXAMPLEr   rz   r;   rA   rT   )r   r   rB   
source_dirrY   rK   r9   r9   r:   test_limited_abi  s   



r   c                 C  sn   t |d}tt | | || t|D ]\}}}|D ]}ttj	||t
j q qt   d S )Ndummy)rA   r   shutilcopytreerz   r-   walkchmodr.   joinstatS_IREADr;   rT   )r[   r   r   rD   root_dirsfilesrP   r9   r9   r:   test_build_from_readonly_tree  s   
r   )optioncompress_type)idsc                 C  s   | |  tt||d  td(}t| }d|v s J d|v s&J |jD ]	}|j|ks2J q)W d    d S 1 s>w   Y  d S )N)rJ   compressionr   r   r   )	rz   r;   rA   rT   r   r   r   filelistr   )r[   r   r   r   r   r   r   zinfor9   r9   r:   test_compression  s   


"r   c              	   C  s`   | D ]+}t |}tdd |jD }||}d|vsJ W d    n1 s(w   Y  qd S )Nc                 s  s     | ]}|j d r|V  qdS )WHEELN)rb   endswith)rO   fnr9   r9   r:   rQ     s    z.test_wheelfile_line_endings.<locals>.<genexpr>   )r   r`   r   rf   )rZ   r.   r   	wheelfilewheelfile_contentsr9   r9   r:   test_wheelfile_line_endings  s   

r   c                 C  sr   | dd ||  tt|dd  td}|jD ]	}|jdks&J qW d    d S 1 s2w   Y  d S )NSOURCE_DATE_EPOCH02ar   z'dist/dummy_dist-1.0-2a-py3-none-any.whl)i     r   r   r   r   )setenvrz   r;   rA   rT   r   r   	date_time)r[   r   r   r   r   r9   r9   r:   test_unix_epoch_timestamps  s   


"r   c                 C  s   |  tddd  |  tddd  t dksJ |  tddd d	 t d
ks*J |  tddd  t dks:J | td t dksGJ d S )Ninterpreter_namec                   S     dS )Ncpr9   r9   r9   r9   r:   <lambda>      z*test_get_abi_tag_windows.<locals>.<lambda>get_config_varc                 S  r   )Nzcp313-win_amd64r9   xr9   r9   r:   r     r   cp313gettotalrefcountc                   S  r   )Nr   r9   r9   r9   r9   r:   r     r   Fcp313dc                 S  r   )Nzcp313t-win_amd64r9   r   r9   r9   r:   r     r   cp313tdcp313t)r2   r   	sysconfigr   sysdelattrr   r9   r9   r:   test_get_abi_tag_windows  s   r   c                 C  6   |  tddd  |  tddd  t dksJ d S )Nr   c                   S  r   Nppr9   r9   r9   r9   r:   r     r   z+test_get_abi_tag_pypy_old.<locals>.<lambda>r   c                 S  r   )Nzpypy36-pp73r9   r   r9   r9   r:   r     r   pypy36_pp73)r2   r   r   r   r   r9   r9   r:   test_get_abi_tag_pypy_old     r   c                 C  r   )Nr   c                 S  r   )Nzpypy37-pp73-darwinr9   r   r9   r9   r:   r     r   z+test_get_abi_tag_pypy_new.<locals>.<lambda>r   c                   S  r   r   r9   r9   r9   r9   r:   r     r   pypy37_pp73r2   r   r   r   r   r9   r9   r:   test_get_abi_tag_pypy_new  r   r   c                 C  r   )Nr   c                 S  r   )Nz"graalpy231-310-native-x86_64-linuxr9   r   r9   r9   r:   r     r   z*test_get_abi_tag_graalpy.<locals>.<lambda>r   c                   S  r   )Ngraalpyr9   r9   r9   r9   r:   r     r   graalpy231_310_nativer   r   r9   r9   r:   test_get_abi_tag_graalpy  s
   
r   c                 C  r   )Nr   c                 S  r   )Nzunknown-python-310r9   r   r9   r9   r:   r     r   z+test_get_abi_tag_fallback.<locals>.<lambda>r   c                   S  r   )Nzunknown-pythonr9   r9   r9   r9   r:   r     r   unknown_python_310r   r   r9   r9   r:   test_get_abi_tag_fallback  r   r   c                 C  s   | |  tdd  dS )z>Ensure building on platforms with a space in the name succeed.zisilon onefs)	plat_nameN)rz   r;   rT   )r[   r   r9   r9   r:   test_platform_with_space  s   
r   c           
   	   C  s   |  | ddddd}| D ]"\}}t|ddd}|t| W d   n1 s-w   Y  qt   d	}tj	|sBJ t
t| }d
D ]}||v sTJ qLdD ]}	|	|vs_J qWdS )z
    Setuptools allow authors to set PEP 440's local version segments
    using ``egg_info.tag_build``. This should be reflected not only in the
    ``.whl`` file name, but also in the ``.dist-info`` and ``.data`` dirs.
    See pypa/setuptools#3997.
    z]
            from setuptools import setup
            setup(headers=["hello.h"])
            z
            [metadata]
            name = test
            version = 1.0

            [options.data_files]
            hello/world = file.txt

            [egg_info]
            tag_build = +what
            tag_date = 0
            r   )r   r&   zfile.txtzhello.hwrl   rm   Nz#dist/test-1.0+what-py3-none-any.whl)z"test-1.0+what.data/headers/hello.hz,test-1.0+what.data/data/hello/world/file.txtz test-1.0+what.dist-info/METADATAztest-1.0+what.dist-info/WHEEL)ztest.data/headers/hello.hz'test-1.0.data/data/hello/world/file.txtztest.dist-info/METADATAztest-1.0.dist-info/WHEEL)rz   r1   openwriter   r;   rT   r-   r.   r/   r   r   r   )
r   r   r   filecontentfh
wheel_pathentriesexpectednot_expectedr9   r9   r:   test_data_dir_with_tag_build  s(   

r   )reportedr   )zlinux-x86_64
linux_i686)zlinux-aarch64linux_armv7lLinuxz!Only makes sense to test on Linux)reasonc                 C  sL   | tddd  t }t|}| |_d|_| \}}}||ks$J d S )Ncalcsizec                 S  r   )N   r9   r   r9   r9   r:   r   :  r   z'test_platform_linux32.<locals>.<lambda>F)r2   struct
setuptoolsr	   r   r   root_is_pureget_tag)r   r   r   rH   r6   _actualr9   r9   r:   test_platform_linux322  s   r	  returnNonec                 C  s   ddd}t t | tjd W d    n1 sw   Y  | td| tjt	dd d	d l
}W d    n1 s=w   Y  | tjd
 d	d l}d S )NrC   rA   c                 _  s.   | dkrt d|  tj| g|R i |S )NctypeszNo module named )ModuleNotFoundError	importlib
__import__)rC   argsr4   r9   r9   r:   _fake_importD  s   z$test_no_ctypes.<locals>._fake_importzwheel.macosx_libfiler  zNo module named ctypesr   r   zsetuptools.command.bdist_wheel)rC   rA   )r   KeyErrordelitemr   modulesr2   builtinsr   raisesr  wheel.macosx_libfilesetuptools.command.bdist_wheel)r   r  wheelr  r9   r9   r:   test_no_ctypesC  s   


r  c                 C  s   | |  |d }|  |d jddd |d jddd tt|t|d  d	d
h}td}t| }W d    n1 sDw   Y  || t ksRJ dd |D r[J d S )Nrk   ry   zname: helloworldrl   rm   FOObar)rJ   dist_info_dirzdummy_dist-1.0.dist-info/FOOr   r   c                 S  s   g | ]
}d t |v r|qS )zegg-inforM   r^   r9   r9   r:   
<listcomp>o  s    z+test_dist_info_provided.<locals>.<listcomp>)	rz   r{   r|   r;   rA   rT   r   r   r   )r[   r   r   r   r   r   files_foundr9   r9   r:   test_dist_info_providedY  s   

r   )r
  r  )Q
__future__r   r  r  os.pathr-   platformr   r   r  r   r   
contextlibr   inspectr   zipfiler   jaraco.pathr>   r   	packagingr   r  r  r   r   setuptools.distr	   setuptools.warningsr
   distutils.corer   r   r   OTHER_IGNORED_FILESSETUPPY_EXAMPLEdictfromkeysr@   r;   rE   fixturerZ   r[   rd   rj   r}   r   r   r   markparametrizereplacer   r   r   r   r   r   filterwarningsr   r   listsupported_compressionsr1   r   r   r   r   r   r   r   r   r   r   skipifsystemr	  r  r   r9   r9   r9   r:   <module>   s   	
w






		

	7

