\bgdZddlmZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl mZddlmZd Zejd Zeed Zd Zd ZdZd dZd!dZd"dZd#dZdS)$z2 Tools for converting old- to new-style metadata. ) annotationsN)Message)Parser)Iterator) Requirementc2|o|d S)N#) startswith)strs r/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/setuptools/_vendor/wheel/metadata.py _nonblankrs  *s~~c****cftjtt|S)a Yield valid lines of a string or iterable. >>> list(yield_lines('')) [] >>> list(yield_lines(['foo', 'bar'])) ['foo', 'bar'] >>> list(yield_lines('foo\nbar')) ['foo', 'bar'] >>> list(yield_lines('\nfoo\n#bar\nbaz #comment')) ['foo', 'baz #comment'] >>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n'])) ['foo', 'bar', 'baz', 'bing'] ) itertoolschain from_iterablemap yield_lines)iterables r rrs$ ? ( ([()C)C D DDrcttttj|SN)filterrrr strip splitlines)texts r _r)s( )SDOO,=,=>> ? ??rc#2Kd}g}t|D]z}|drN|dr)|s|r||fV|dd}g}Ut d|||{||fVdS)arSplit a string or iterable thereof into (section, content) pairs Each ``section`` is a stripped version of the section header ("[section]") and each ``content`` is a list of stripped lines excluding blank lines and comment-only lines. If there are any such lines before the first section header, they're returned in a first ``section`` of ``None``. N[]rzInvalid section heading)rr endswithr ValueErrorappend)ssectioncontentlines r split_sectionsr).sGGA ! ! ??3   !}}S!! B+g+!7****qt***,, !:DAAA NN4  7 rcRtjdd|S)zConvert an arbitrary string to a standard 'extra' name Any runs of non-alphanumeric characters are replaced with a single '_', and the result is always lowercased. z[^A-Za-z0-9.-]+r)resublower)extras r safe_extrar/Gs% 6#S% 0 0 6 6 8 88rc.tjdd|S)zConvert an arbitrary string to a standard distribution name Any runs of non-alphanumeric/. characters are replaced with a single '-'. z[^A-Za-z0-9.]+-)r+r,)names r safe_namer3Os 6"C . ..r requirementrreturnr ct|ddr d|jzSg}|jD]$}||j|jz%|r%ddt|zSdS)zFReturn the version specifier for a requirement in PEP 345/566 fashion.urlNz @  ,)getattrr7 specifierr$operatorversionjoinsorted)r4 requires_distspecs r requires_to_requires_distrCVs{E4(('{&&M%;;T]T\9::::SXXf]334444rr requirements list[str] Iterator[str]c#K|D]u}t|}t|}dtd|jD}|rd|d}t |j|z|zVvdS)z=Yield Requires-Dist: strings for parsed requirements strings.r9c34K|]}t|VdSr)r/).0es r z'convert_requirements..js( R R1A R R R R R Rrrr N)rrCr?r@extrasr3r2)rDreqparsed_requirementrBrLs r convert_requirementsrOesAA(--();<<& R R8J8Q R R RRRSS  #"]]]F*/0069D@@@@@AArextras_requiredict[str, list[str]]Iterator[tuple[str, str]]c#K|D]s\}}d}|pd}d|vr|dd\}}t|}|rd|fV|rd|zdz}|d|zz }|rd|z}t|D] }d ||zfV td S) a, Convert requirements from a setup()-style dictionary to ('Requires-Dist', 'requirement') and ('Provides-Extra', 'extra') tuples. extras_require is a dictionary of {extra: [requirements]} as passed to setup(), using the empty extra {'': [requirements]} to hold install_requires. r::rProvides-Extra(z) and z extra == '%s'z ; Requires-DistN)itemssplitr/rO)rPr.depends conditionnew_reqs r generate_requirementsr]qs)..0077w   %<<${{322 E95!!  1"E) ) ) ) 7)Oh6 50 0I  * )I+G44 7 7G!7Y#66 6 6 6 6 7!77r egg_info_path pkginfo_pathrc t|d5}t|}dddn #1swxYwY|dd|d=|d=tj|d}tj|rt|d5}|}dddn #1swxYwYtt|d }|D]9\}} t|| iD]"\} } | | f| vr| || <#:|d } | r|d  } d | d tjd | ddd f}|||d =|S)zN Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format zutf-8)encodingNzMetadata-Versionz2.1rUrWz requires.txtc|dpdS)Nrr:)xs r z%pkginfo_to_metadata..sQqTZUWr)key Description rr)openrparsereplace_headerospathr?existsreadr@r)r]rXrlstriptextwrapdedent set_payload)r^r_headerspkg_info requires_path requires_filerequiresparsed_requirementsr.reqsrfvalue descriptiondescription_linesdedented_descriptions r pkginfo_to_metadatarsh lW - - -+88>>'**+++++++++++++++ .666!"!GLL??M w~~m$$* -' 2 2 2 ,m$))++H , , , , , , , , , , , , , , ,%^H%=%=CWCWXXX. * *KE43UDMBB * * U>@@#yy"!$++-- *;ABB*? @ @AA    1222 ] # Os#"AAA7CCC)r4rr5r )rDrEr5rF)rPrQr5rR)r^r r_r r5r)__doc__ __future__r functoolsros.pathrlr+rq email.messager email.parserrtypingrvendored.packaging.requirementsrrsingledispatchrregisterr rr)r/r3rCrOr]rrcrr rs#""""" !!!!!!888888+++ EEE" c@@@2999///     A A A A7777<%%%%%%r