U 췀gT@s<dZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z ddlmZddlmZddlmZddlmZmZmZmZmZmZdd lmZmZddlZdd lmZd d lm Z!d d l"m#Z#d dl$m%Z%d dl&m'Z'd dl&m(Z)d dl*m+Z+erddl,Z,z e-dWn*e.k rTd dlm/Z/e/0YnXdddddZ1dddddZ2e3ej 4ddZ5dZ6dddd Z7ddd!d"Z8d#dd$d%d&Z9d=dddddd(d)d*Z:d#dd+d,Z;dddd-d.Zd1dd7d3d8d9d:Z?Gd;d<dzI Create a wheel (.whl) distribution. A wheel is a built archive format. ) annotationsN)BytesGenerator Generator) EmailPolicy)iglob)rmtree) TYPE_CHECKINGCallableIterableLiteralSequencecast) ZIP_DEFLATED ZIP_STORED)Command) __version__)pkginfo_to_metadata)log)tagsversion) WheelFilezsetuptools.logging)_setuptools_loggingstr)namereturncCstdd|S)zConvert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. [^A-Za-z0-9.]+-)resubrr"@/opt/hc_python/lib/python3.8/site-packages/wheel/_bdist_wheel.py safe_name/sr$)rrcCsFztt|WStjk r@|dd}tdd|YSXdS)zB Convert an arbitrary string to a standard version string  .rrN)r_packaging_versionVersionInvalidVersionreplacerr rr"r"r# safe_version6s  r+r&zcp3\dboolrcCstddkS)NP)structcalcsizer"r"r"r#_is_32bit_interpreterGsr2cCsdtjdS)Npyr)sys version_infor"r"r"r# python_tagKsr6z str | None) archive_rootrcCs^t}|dr2|dk r2ddlm}|||}n trR|dkrFd}n |dkrRd}|d d S) z0Return our platform name 'win32', 'linux_x86_64'macosxNr)calculate_macosx_platform_tag linux-x86_64z linux-i686 linux-aarch64z linux-armv7lr_) sysconfig get_platform startswithZmacosx_libfiler9r2r*)r7resultr9r"r"r#r>Os  r>T)varfallbackexpectedwarnrcCs:t|}|dkr2|r.tjd|dtdd|S||kS)zfUse a fallback value for determining SOABI flags if the needed config var is unset or unavailable.NzConfig variable 'z+' is unset, Python ABI tag may be incorrect stacklevel)r=get_config_varwarningsrDRuntimeWarning)rArBrCrDvalr"r"r#get_flagcs  rLcCstd}t}|s|dkrttdrd}d}d}tdttd|dkdrPd }td |dk|dkojtjd kdr~tjd kr~d }|t|||}n|r|dkr| d rd| dd}n|r|dkr| dr| dd}n|r*|dkr*d | ddd}| dd dd}n^|rh|dkrhd | ddd}| dd dd}n |r| dd dd}nd}|S)zJReturn the ABI tag based on SOABI (if available) or emulate SOABI (PyPy2).SOABI)cppp maxunicodePy_DEBUGgettotalrefcountrN)rDd WITH_PYMALLOC)mcpythonrrrrONrEr&r<graalpyrV) r=rHrinterpreter_namehasattrr4rLr5interpreter_versionr?splitjoinr*)soabiimplrTrXuabir"r"r# get_abi_tagts> rdcCst|ddSNrr<)r$r*r!r"r"r# safer_namesrfcCst|ddSre)r+r*rr"r"r# safer_versionsrgzCallable[..., object]z6tuple[type[Exception], Exception, types.TracebackType]None)funcpathexcinforcCst|||ddS)Nr)remove_readonly_exc)rirjrkr"r"r#remove_readonlysrm Exception)rirjexcrcCst|tj||dS)N)oschmodstatS_IWRITE)rirjror"r"r#rlsrlc@seZdZdZeedZddddeddfd d d d d dddddd efddde dfddg Z ddddgZ ddZ ddZed d!Zd"d#d$d%Zd&d'Zd(edfd)d)d*d+d,Zd)d)d-d.d/Zed0d#d1d2Zd)d)d3d4d5ZdS)6 bdist_wheelzcreate a wheel distribution)Zstoreddeflated)z bdist-dir=bz1temporary directory for creating the distributionz plat-name=pz8platform name to embed in generated filenames (default: N)) keep-tempkzPkeep the pseudo-installation tree around after creating the distribution archive)z dist-dir=rTz-directory to put final built distributions in) skip-buildNz2skip rebuilding everything (for testing/debugging))relativeNz7build the archive using relative paths (default: false))zowner=rbz@Owner name used when creating a tar file [default: current user])zgroup=gzAGroup name used when creating a tar file [default: current group]) universalNz'make a universal wheel (default: false)z compression=z6zipfile compression (one of: {}) (default: 'deflated')z, z python-tag=z3Python implementation compatibility tag (default: 'z'))z build-number=NzqBuild number for this particular version. As specified in PEP-0427, this must start with a digit. [default: None])zpy-limited-api=Nz?Python tag (cp32|cp33|cpNN) for abi3 wheel tag (default: false)ryr{r|r~cCsxd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_ d|_ d|_ d|_ d|_t|_d|_d|_d|_dS)NzipFru) bdist_dirdata_dir plat_nameplat_tagformat keep_tempdist_dir egginfo_dir root_is_pure skip_buildr|ownergroupr~ compressionr6 build_numberpy_limited_apiplat_name_supplied)selfr"r"r#initialize_optionss&zbdist_wheel.initialize_optionscCsP|jdkr&|dj}tj|d|_|jd}||j d|_ |j dk |_ z|j |j|_Wn&tk rtd|jdYnXd}|jdt|||jp|j |_|jrtt|jstdtd|jd}d |kr$td |d d }|d kr$d |_|j dk rL|j dd !sLtddS)Nbdistwheelegg_infoz.datazUnsupported compression: )rrrzpy-limited-api must match ''r~z=The [wheel] section is deprecated. Use [bdist_wheel] instead.r)1trueyesTz1Build tag (build-number) must start with a digit.)r)"rget_finalized_command bdist_baserprjr_ distributionget_command_objensure_finalizedwheel_dist_namerrrsupported_compressionsrKeyError ValueErrorset_undefined_optionsrhas_ext_moduleshas_c_librariesrrrmatchPY_LIMITED_API_PATTERNget_option_dictrwarningstriplowerr~risdigit)rrrZ need_optionsrrKr"r"r#finalize_options s<         zbdist_wheel.finalize_optionscCs8t|jt|jf}|jr.||jf7}d|S)z4Return distribution full name with - replaced with _r)rfrget_namerg get_versionrr_)r componentsr"r"r#r5s    zbdist_wheel.wheel_dist_nameztuple[str, str, str]r-cs(|jrtt|jnN|jr dnB|jr:|jds:|jn t|jtrbdkrVddkrbd dd d d d d|jr|j rd }n|j }|d f}n~t }t }||}|jr||d r|j}d}ntt }||f}fddt D}||ks$td||S)Nanyr8)r: linux_x86_64 linux_i686)r; linux_aarch64Z linux_armv7lrr<r&r%zpy2.py3noneZcp3abi3csg|]}|j|jfqSr") interpreterrc).0trr"r# rsz'bdist_wheel.get_tag..z'would build wheel with unsupported tag )rr rrrr?r>rr2rr*r~r6rr[r]rrdsys_tagsAssertionError)rratagZ impl_nameZimpl_verabi_tagsupported_tagsr"rr#get_tag@sF    zbdist_wheel.get_tagc Csr|d}d|_d|_|d}d|_|js6|d|jddd}|j|_d|_|j|_d|_ |d }d|_ d D] }t |d |t j |j|qtd }t jd krt j t j |jd}||_|_t ||jrdnd|td|j|d|\}}} |jd|d|d| } |js4|j} nt j |j||j} |ddt|jdt |j!d} t j |j| } |"|j#| |$| t j %|j&st '|j&t j |j&| d}t(|d|j)}|*| W5QRXt+|jdg,ddj-t.j/dd|f|j0sntd|j|j1snt.j/dkr`t2|jt3dnt2|jt4ddS) N build_scriptspythonT build_extFbuildinstall)reinit_subcommandsinstall_scripts)headersscriptsdatapurelibplatlibinstall_rQntz..install_purelibinstall_platlibzinstalling to rinstall_egg_info)targetrz .dist-infoz.whlw dist_filesrtz{}.{}rEz removing )rV )onerror)onexc)5reinitialize_command executableforceZinplacer run_commandrrootcompilewarn_dirZno_epsetattrrprjr_rrnormpathinstall_libbase install_librrinforrr|_ensure_relative install_baserrfrrrgregg2distrwrite_wheelfileexistsrmakedirsrrZ write_filesgetattrappendrr4r5rdry_runrrmrl)rrrrrkeyZbasedir_observedimpl_tagrrZarchive_basenamer7Zdistinfo_dirname distinfo_dir wheel_pathZwfr"r"r#runzst          "   zbdist_wheel.runz bdist_wheel (r)wheelfile_base generatorc Csddlm}|}d|d<||d<t|j|d<|jdk rH|j|d<|\}}}|dD]8}|dD](} |dD]} d || | f|d <q|qnq`t j |d } t d | t | d } t| dd|W5QRXdS)Nr)Messagez1.0z Wheel-VersionrzRoot-Is-PurelibZBuildr&rTagWHEELz creating wb) maxheaderlen) email.messagerrrrrrr^r_rprjrropenrflatten) rrrrmsgrrrrarcplatZwheelfile_pathfr"r"r#rs     zbdist_wheel.write_wheelfile)rjrcCs6tj|\}}|ddtjkr2||dd}|S)Nrr)rprj splitdrivesep)rrjdriver"r"r#rszbdist_wheel._ensure_relativez Iterable[str]c Cstdkr|jjjpdSt}|jd}tdkrFttt|jjj}nd|kr`|dd }nd}d|krt j dt d d | |dd|s|st|tsd }|D]f}t|D]X}|d rtd |dq||krtj|rtd|d|d| |qq|S)N9r"metadata* license_filesrZ license_filezEThe "license_file" option is deprecated. Use "license_files" instead.rErF)z LICEN[CS]E*zCOPYING*zNOTICE*zAUTHORS*~zignoring license file "z" as it looks like a backupzadding license file "z" (matched pattern "z"))setuptools_major_versionrrrsetrr r rr^rIrDDeprecationWarningadd isinstancelistrendswithrdebugrprjisfiler)rfilesrpatternspatternrjr"r"r# license_pathss>    zbdist_wheel.license_paths) egginfo_path distinfo_pathc Csddddd}||tj|sddl}tjtj|d}||}d |d }|r|tj|d}|d |d 7}t|tj|rt ||} t |nltj|d } t || } t j ||dddtj|d} t | dd} | } W5QRX| s|| tj|d}tdddd}t |ddd}t||d| W5QRX|jD](}tj|}t |tj||q`||dS)z:Convert an .egg-info directory into a .dist-info directoryrrh)rwrcSsJtj|r0tj|s0tj|r0t|ntj|rFt|dS)z-Appropriately delete directory, file or link.N)rprjrislinkisdirshutilrunlink)rwr"r"r#adios#s$  z#bdist_wheel.egg2dist..adiosrNz *.egg-infozEgg metadata expected at z but not foundz (z) found - possible misnamed archive file?)PKG-INFOcSs ddddhS)Nrz requires.txtz SOURCES.txtz not-zip-safer")xyr"r"r#Is z&bdist_wheel.egg2dist..)ignorezdependency_links.txtzutf-8)encodingMETADATATF)utf8 mangle_from_max_line_lengthr)policy)rprjrglobr_dirnamebasenamerrrmkdirrcopytreerreadrrrrrcopy)rrrrr&patpossibleerrZaltpkg_infoZ pkginfo_pathZdependency_links_pathZdependency_links_fileZdependency_linksZ pkg_info_pathZserialization_policyoutZ license_pathfilenamer"r"r#r sL          zbdist_wheel.egg2dist)__name__ __module__ __qualname__ descriptionrrrr>rr_r6 user_optionsboolean_optionsrrpropertyrrr wheel_versionrrrrr"r"r"r#rtsT : + :[ ,rt)TT)A__doc__ __future__rrprrrrr0r4r=rIemail.generatorrr email.policyrr&rrtypingrr r r r r zipfilerr setuptoolsrrQrr:rrutilrZvendored.packagingrrr'Z wheelfilertypes __import__ ImportErrorr configurer$r+intr^rrr2r6r>rLrdrfrgrmrlrtr"r"r"r#s\               (