U 췀gZ1@sddlmZddlZddlZddlmZmZddlm Z ddl m Z ddl m Z ddlmZddlmZdd lmZdd lmZdd lmZdd lmZd dlmZd dlmZd dlmZd dl m!Z!e"dej#Z$e"dej#Z%e"dZ&e"dZ'eddddZ(deZ)ddddddZ*ddd d!d"Z+ddd#d$d%Z,Gd&d'd'ed(Z-Gd)d*d*e-Z.Gd+d,d,e.Z/Gd-d.d.e-Z0d/dd0dd1d2d3Z1dS)4) annotationsN)ABCMetaabstractmethod) defaultdict)Iterator)Message)Parser) EmailPolicy)iglob)Path)dedent)ZipFile) __version__)generate_requirements) parse_tag) WheelFilez] (?P.+?)-(?P.+?) (-(?Ppy\d\.\d+) (-(?P.+?))? )?.egg$zL ^(?P.+?)-(?P.+?) (-(?Ppy\d\.\d+) )?.egg-info/z>\.(?Pwin32|win-amd64)(?:-(?Ppy\d\.\d))?\.exe$z8\.(?P[a-z0-9]+)-(?Pwin32|win_amd64)\.pyd$TF)utf8 mangle_from_max_line_lengthzwheel strrNone)requiresmetadatareturncCszd}tt}|D]B}|}|s&q|drH|drH|dd}q|||qt|D]\}}|||q`dS)N[]) rlist splitlinesstrip startswithendswithappendr add_header)rrextra requirementslinekeyvaluer+?/opt/hc_python/lib/python3.8/site-packages/wheel/cli/convert.pyconvert_requires0s  r-)pkginforc Cst|}|D]\}}|}|dkr.q|dkrt|}d|dtd|dddf}||q|dkr| dd|q|d kr| dd |q| ||q| d d dS) NUNKNOWN description rrz home-pagez Project-URLz Homepage, z download-urlz Download, zMetadata-Versionz2.4) rparsestritemslowerr joinlstripr set_payloadr%replace_header)r.rZparsed_messager)r* key_lowerZdescription_linesr+r+r,convert_pkg_infoBs(   r:)namercCstdd|ddS)Nz[-_.]+-_)resubr4replace)r;r+r+r, normalize]srAc@sneZdZUded<ded<dZded<dZded<dZded <d ed <edd d dZe dd ddZ dS) ConvertSourcerr;versionzpy2.py3pyvernoneabianyplatformrrrcCs|jd|jdS)Nr< .dist-info)r;rCselfr+r+r, dist_info_diriszConvertSource.dist_info_dirIterator[tuple[str, bytes]]cCsdSNr+rKr+r+r,generate_contentsmszConvertSource.generate_contentsN) __name__ __module__ __qualname____annotations__rDrFrHpropertyrMrrPr+r+r+r,rBas    rB) metaclassc@s(eZdZddddZddddZd S) EggFileSourcer pathcCst|j}s td|j||_t|d|_|d|_|d}r|dd|_ |d}r|j dd |_ t||_ t |_ dS) NzInvalid egg file name: r;verrD.archpycp)egg_filename_rematchr; ValueErrorrYrAgrouprCr@rDrFrHrr)rLrYrarDr]r+r+r,__init__ss  zEggFileSource.__init__rNrIc cst|jd}t|D]}|dr*q|dr|dkrZ||d}t||j q|dkr||d}t ||j q|dkr|j d||fVq|||fVqW5QRXdS) Nr/z EGG-INFO/zEGG-INFO/requires.txtutf-8zEGG-INFO/PKG-INFOzEGG-INFO/entry_points.txt/entry_points.txt) r rYsortednamelistr#r"readdecoder-rr:rM)rLzip_filefilenamerr.r+r+r,rPs"   zEggFileSource.generate_contentsN)rQrRrSrdrPr+r+r+r,rWrsrWc@seZdZddddZdS)EggDirectorySourcerNrIc cst|jD]\}}}t|D]}t||}|jjdkr|jdkrZ|d}t||j q|jdkr|d}t ||j |j d}rt ||_|j d} r| |_ q|jdkr|jd|fVqt||j|fVqq dS) NzEGG-INFO requires.txtrgPKG-INFONameVersionentry_points.txtrh)oswalkrYrir parentr; read_textr-rr:getrArCrM read_bytesr relative_to) rLdirpathr= filenamesrnrYrr.r;rCr+r+r,rPs(           z$EggDirectorySource.generate_contentsN)rQrRrSrPr+r+r+r,rosroc@s,eZdZdZddddZdddd Zd S) WininstFileSourcea Handles distributions created with ``bdist_wininst``. The egginfo filename has the format:: name-ver(-pyver)(-arch).egg-info The installer filename has the format:: name-ver.arch(-pyver).exe Some things to note: 1. The installer filename is not definitive. An installer can be renamed and work perfectly well as an installer. So more reliable data should be used whenever possible. 2. The egg-info data should be preferred for the name and version, because these come straight from the distutils metadata, and are mandatory. 3. The pyver from the egg-info data should be ignored, as it is constructed from the version of Python used to build the installer, which is irrelevant - the installer filename is correct here (even to the point that when it's not there, any version is implied). 4. The architecture must be taken from the installer filename, as it is not included in the egg-info data. 5. Architecture-neutral installers still have an architecture because the installer format itself (being executable) is architecture-specific. We should therefore ignore the architecture if the content is pure-python. r rXc Cs||_t|_t|j}rJt|d|_|d}rJ| dd|_ d}}t |j}| D]}| dd\}}|st|}rd}t|d |_|d |_|d}r| dd|_ n.|st|}rd}|d |_|d|_|rf|rfqqfW5QRXdS) NrHrDr[r\FrfrTr;rZrF)rYrr wininst_researchr;rArcrHr@rDr rjsplit egg_info_rerarCpyd_rerF) rLrYrarDZegg_info_foundZ pyd_foundrmrnprefixr+r+r,rds,     zWininstFileSource.__init__rNrIc cs"|jd|jd}|jd|jd}t|jd}t|D]}|drRqB|dd\}}t |r| ddd}|dkr| | d }t ||jqB|d kr| | d } t| |jqB|d krB|d | |fVqBn|d kr|d|}|| |fVqBW5QRXdS)Nr<rJz.datarerfrrrprgrqrtrhZSCRIPTSz /scripts/)r;rCr rYrirjr#rrrrsplitrkrlr-rr:) rLrMdata_dirrmrnrZtarget_filenamebasenamerr.r+r+r,rPs.   z#WininstFileSource.generate_contentsN)rQrRrS__doc__rdrPr+r+r+r,r~sr~z list[str]bool)filesdest_dirverboserc Cs|D]}t|D]}t|}|jdkrF|rAzconvert..)r)Tagz/WHEELOK)r r suffixis_dirrorWr~printr;rCrDrFrHrrPwritestrrMr as_stringserialization_policyencoderr% GENERATORrr4rri)rrrpatarchiverYsource dest_path wheelfileZ name_or_zinfocontentsZ wheel_messagetagsrr+r+r,convertsP    *      r)2 __future__ros.pathrur>abcrr collectionsrcollections.abcr email.messager email.parserr email.policyr globr pathlibr textwrapr zipfiler r\rrrZvendored.packaging.tagsrrrcompileVERBOSEr`rrrrrr-r:rArBrWror~rr+r+r+r,sT                -^