0A7hidZddlmZddlmZddlmZddlm Z ddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZdd lmZmZdd lmZdd lmZdd lmZdd lmZddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(djRe jTZ+dZ,GddZ-Gdde-eZ.GddeZGddeZ/dZ0dZ1dZ2d Z3d!Z4d"Z5d#Z6d$Z7d*d%Z8d&Z9d+d'Z:Gd(d)e(Z;y),zUsetuptools.command.egg_info Create a distribution's .egg-info directory and contents)FileList)DistutilsInternalError) convert_path)logN)metadata) _entry_points_normalization)Command)sdist) walk_revctrl) edit_config) bdist_egg)glob) packaging) yield_lines)SetuptoolsDeprecationWarningz{}.{}cd}|jtjj}t j tj}d|d}t |D]6\}}|t|dz k(}|dk(r|r|dz }n |d|d|d z }2d }t|} || kr||} | d k(r ||d zz }n| d k(r||z }n| d k(r|dz} | | kr || dk(r| dz} | | kr || dk(r| dz} | | kr|| dk7r| dz} | | kr || dk7r| | k\r|t j | z }nU||dz| } d} | d dk(rd} | dd} | t j | z } |d | dz }| }n|t j | z }|dz }|| kr|r2||z }9|dz }t j|tjtjzS)z Translate a file path glob like '*.txt' in to a regular expression. This differs from fnmatch.translate which allows wildcards to match directory separators. It also knows about '**/' which matches any number of directories. z[^]**z.*z(?:+z)*r*?[!^Nz\Z)flags) splitospathsepreescape enumeratelencompile MULTILINEDOTALL)rpatchunksr# valid_charcchunk last_chunki chunk_lencharinner_iinner char_classs =/usr/lib/python3/dist-packages/setuptools/command/egg_info.pytranslate_patternr8&s* CTZZ $F ))BFF C!Jf%>5#f+/)  D=t z377  J )m8Ds{zC''z!a%Y&5>S+@%kGY&5>S+@%kG )eGn.C%kG )eGn.Ci'299T?*C"!a%'2E!#JQx3%( %ab "))E"22JZ11C Aryy& FAU)mZ 3JC}>@5LC ::c !9 ::cheZdZdZdZedZdZdZde de fdZ de fdZ de fd Z ee Zy) InfoCommonNc\tj|jjSN)r safe_name distributionget_nameselfs r7namezInfoCommon.name}s"''(9(9(B(B(DEEr9c~|j|jj}tj|Sr=) _maybe_tagr? get_versionr best_effort_version)rBtaggeds r7tagged_versionzInfoCommon.tagged_versions0!2!2!>!>!@A11&99r9c^|jr|j|r|S||jzS)z egg_info may be called more than once for a distribution, in which case the version string already contains all tags. )vtags_already_taggedrBversions r7rEzInfoCommon._maybe_tags5zzd227;  4::% r9rNreturncz|j|jxs|j|jSr=)endswithrK _safe_tagsrMs r7rLzInfoCommon._already_taggeds0 +Rw/?/?@Q/RRr9cLtjd|jddS)N0r)r rGrKrAs r7rRzInfoCommon._safe_tagss'11Adjj\2BCABGGr9cd}|jr||jz }|jr|tjdz }|S)Nrz%Y%m%d) tag_buildtag_datetimestrftimerMs r7tagszInfoCommon.tagss; >> t~~ %G == t}}X. .Gr9)__name__ __module__ __qualname__rVrWpropertyrCrIrEstrboolrLrRrZrKr9r7r;r;yseIH FF:  SsStS HCH c TNEr9r;ceZdZdZgdZdgZddiZdZedZ e jdZ dZ d Z e d fd Zdd Zd ZdZdZdZy )egg_infoz+create a distribution's .egg-info directory))z egg-base=ezLdirectory containing .egg-info directories (default: top of the source tree))tag-datedz0Add date stamp (e.g. 20050528) to version number)z tag-build=bz-Specify explicit tag to add to version number)no-dateDz"Don't include date stamp [default]rerhcJd|_d|_d|_d|_d|_y)NF)egg_baseegg_namerc egg_versionignore_egg_info_in_manifestrAs r7initialize_optionszegg_info.initialize_optionss'   +0(r9cyr=rarAs r7tag_svn_revisionzegg_info.tag_svn_revision r9cyr=ra)rBvalues r7rqzegg_info.tag_svn_revisionrrr9ctj}|j|d<d|d<t|t |y)z Materialize the value of date into the build tag. Install build keys in a deterministic order to avoid arbitrary reordering on subsequent builds. rVrrW)rcN) collections OrderedDictrZrdict)rBfilenamercs r7save_version_infozegg_info.save_version_infos= **,!%  HdH56r9c@|j|_|j|_tj j |j} t|tj j }|rdnd}tjj||j|jfz|j?|jj }|xsij#dt$j&|_|j)dt+j,|jdz|_|jt$j&k7r9t$j0j3|j|j.|_|j|jj4_|jj6}t9|ddxs t9|d d}|o||jj;k(rQ|j|_tj j |j|_d|j_yyy#t$r?}tjjd|jd|j|d}~wwxYw) Nz%s==%sz%s===%sz-Invalid distribution name or version syntax: -rrk .egg-infokeyrC) rCrlrIrmrrNVersion isinstance requirements Requirement ValueError distutilserrorsDistutilsOptionErrorrkr? package_dirgetr!curdirensure_dirnamer filename_componentrcr"joinr _patched_distgetattrlower_version_parsed_version)rBparsed_version is_versionspecrddirspdr~s r7finalize_optionszegg_info.finalize_optionss   ..0"**2243C3CD #NI4E4E4M4MNJ)8yD  " " . .tt}}dFVFV6W/W X == $$00D!ZR,,R;DM J'&99$--H;V ==BII %GGLL FDM .2-=-=""*    , ,b%&C'"fd*C >cT]]%8%8%::**BK!*!2!2!:!:4;K;K!LB .2D   +;>5 ""77==$"2"24  sA"I J:JJNcFt|j|j||S)0Compute filename of the output egg. Private API.) _egg_basenamerlrm)rB py_versionplatforms r7_get_egg_basenamezegg_info._get_egg_basenamesT]]D,<,>"    R   B;DMM?!LC""55c: A Bs D E"0EEctjj|jd}t |j }|j |_||_|j|j|_ y)z"Generate SOURCES.txt manifest filez SOURCES.txtN) r!r"rrcmanifest_makerr?rnignore_egg_info_dirmanifestrfilelist)rBmanifest_filenamemms r7rzegg_info.find_sourcesAsTGGLL F D-- .!%!A!A'    r9F)r[r\r] description user_optionsboolean_options negative_optror^rqsetterrzrPY_MAJORrrrrrrrar9r7rcrcs?K L"lO:L1    7*3X,4dT+$  $$r9rccteZdZdfd ZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZxZS)rc4t|||||_yr=)super__init__r)rBr debug_printr __class__s r7rzFileList.__init__Ns {+#6 r9c |j|\}}}}|j|j|j|jt j |j|t j |j||j|jd}dddddddd d} ||}|jd } |d vr|g}| r|fnd} ||} |jdj!|g| r|gngz|z|D]"} || r t#j$| | g| $y#t$rtd j| wxYw)N)includeexcludezglobal-includezglobal-excludezrecursive-includezrecursive-excludegraftprunez%warning: no files found matching '%s'z9warning: no previously-included files found matching '%s'z>warning: no files found matching '%s' anywhere in distributionzRwarning: no previously-included files matching '%s' found anywhere in distributionz:warning: no files found matching '%s' under directory '%s'zNwarning: no previously-included files matching '%s' found under directory '%s'z+warning: no directories found matching '%s'z6no previously-included directories found matching '%s'z/this cannot happen: invalid action '{action!s}')actionz recursive->rrra )_parse_template_linerrglobal_includeglobal_exclude functoolspartialrecursive_includerecursive_excluderrKeyErrorrformat startswithrrrr) rBlinerpatternsdir dir_pattern action_maplog_mapprocess_actionaction_is_recursiveextra_log_argslog_tmplpatterns r7process_template_linezFileList.process_template_lineRs 04/H/H/N,3 ||||"11"11!*!2!2&&""+!2!2&&"ZZZZ "?VS6P2CM% * '/N%// = ' '#}H#6#B6?  HH%8SEbAHL    =G!'*7<^< =) (AHHPVHW  s &D##%Ecd}tt|jdz ddD]H}||j|s|jd|j|z|j|=d}J|S)z Remove all files from the file list that match the predicate. Return True if any matching files were removed Frz removing T)ranger'filesr)rB predicatefoundr1s r7 _remove_fileszFileList._remove_filessp s4::*B3 AA'   1 !=>JJqM    r9ct|Dcgc]$}tjj|r#|&}}|j |t |Scc}w)z#Include files that match 'pattern'.)rr!r"isdirextendr`)rBrrrs r7rzFileList.includesD MBqq1ABB EE{Cs $AAcNt|}|j|jS)z#Exclude files that match 'pattern'.)r8rmatchrBrrs r7rzFileList.excludes!!'*!!%++..r9ctjj|d|}t|dDcgc]$}tjj |r#|&}}|j |t |Scc}w)zN Include all files anywhere in 'dir/' that match the pattern. rT) recursive)r!r"rrrrr`)rBrr full_patternrrs r7rzFileList.recursive_includes`ww||Cw7  >WqbggmmTUFVWW EE{Xs $A8A8cttjj|d|}|j |j S)zM Exclude any file anywhere in 'dir/' that match the pattern. rr8r!r"rrr)rBrrrs r7rzFileList.recursive_excludes4""'',,sD'"BC!!%++..r9ct|Dcgc](}tjj|D]}|*}}}|j |t |Scc}}w)zInclude all files from 'dir/'.)rrrfindallrr`)rBr match_diritemrs r7rzFileList.graftsh"#Y !**229=     EE{  s-Acttjj|d}|j |j S)zFilter out files from 'dir/'.rr)rBrrs r7rzFileList.prunes0!"'',,sD"9:!!%++..r9c$|j|jttjj d|}|jDcgc]}|j |s|}}|j|t|Scc}w)z Include all files anywhere in the current directory that match the pattern. This is very inefficient on large file trees. r) allfilesrr8r!r"rrrr`)rBrrrrs r7rzFileList.global_includesl == LLN!"'',,tW"=> MM!!%++..r9c|jdr|dd}t|}|j|r|jj |yy)N r)rQr _safe_pathrappend)rBrr"s r7rzFileList.appendsF == 9DD! ??4 JJ  d # !r9cb|jjt|j|yr=)rrfilterr)rBpathss r7rzFileList.extends &%89r9c`tt|j|j|_y)z Replace self.files with only safe paths Because some owners of FileList manipulate the underlying ``files`` attribute directly, this method must be called to repair those paths. N)listrrrrAs r7_repairzFileList._repairs&$**=> r9cd}tj|}|tjd|zytj|d}|tj||dy d|vxsd|v}|j r|ryt jj|st jj|ryy#t$r,tj||tjYywxYw)Nz!'%s' not %s encodable -- skippingz''%s' in unexpected encoding -- skippingFrr}s .egg-infoT) unicode_utilsfilesys_decoderr try_encoderr!r"rUnicodeEncodeErrorsysgetfilesystemencoding)rBr"enc_warnu_path utf8_path is_egg_infos r7rzFileList._safe_paths6--d3 > HH>E F",,VW=   HHXtW - B%/L<93LK''Kww~~f% )B*C" B HHXtS%>%>%@ A Bs$B==>B==2C21C2)NNF)r[r\r]rrrrrrrrrrrrrrr __classcell__)rs@r7rrKsQ7E=N  / // /$:?Br9rcbeZdZdZdZdZdZdZdZdZ e dZ d Z d Z d Zd Zd Zy)rz MANIFEST.incJd|_d|_d|_d|_d|_y)NrF) use_defaultsr manifest_onlyforce_manifestrrAs r7roz!manifest_maker.initialize_optionss) #( r9cyr=rarAs r7rzmanifest_maker.finalize_optionss r9c&t|j|_tjj |j s|j|jtjj |jr|j|j|j|j|jj|jj|jy)N)r)rrrr!r"rrwrite_manifest add_defaultstemplate read_templateadd_license_files_add_referenced_filesprune_file_listsortremove_duplicatesrAs r7rzmanifest_maker.run!s T5M5MN ww~~dmm,    !  77>>$-- (       ""$   '') r9cltj|}|jtjdS)N/)rrreplacer!r#)rBr"s r7_manifest_normalizez"manifest_maker._manifest_normalize/s'++D1||BFFC((r9c |jj|jjDcgc]}|j|}}d|jz}|j t |j|f|ycc}w)zo Write the file list in 'self.filelist' to the manifest file named by 'self.manifest'. zwriting manifest file '%s'N)rrrr6rexecuter)rBrrrs r7r*zmanifest_maker.write_manifest3sk 7;mm6I6IJ))!,JJ*T]]: Z$--!7=KsBcT|j|stj||yyr=)_should_suppress_warningr r)rBrs r7rzmanifest_maker.warn?s#,,S1 JJtS !2r9c.tjd|S)z; suppress missing-file warnings from sdist zstandard file .*not found)r$r)rs r7r:z'manifest_maker._should_suppress_warningCs xx4c::r9cvtj||jj|j|jj|j t t}|r|jj|n9tjj|j r|jtjjdr|jjd|jd}|jj|jy)Nzsetup.pyrc)r r+rrr,rrr rr!r"r read_manifestget_finalized_commandrrc)rBrcfilesei_cmds r7r+zmanifest_maker.add_defaultsJs 4  T]]+ T]]+|~&  MM  ) WW^^DMM *    77>>* % MM  ,++J7 FOO,r9c|jjjxsg}|D]}tjd||j j |y)Nzadding license file '%s')r?r license_filesrrrr)rBrBlfs r7r.z manifest_maker.add_license_files\sN))22@@FB  5B HH/ 4 5 ]+r9ct|jdg}|D]}tjd||jj |y)zGAdd files referenced by the config (e.g. `file:` directive) to filelist_referenced_filesz%adding file referenced by config '%s'N)rr?rdebugrr)rB referencedrfs r7r/z$manifest_maker._add_referenced_filesbsIT..0CRH  CB II=r B C Z(r9cl|jd}|jj}|jj |j |jj |t jtj}|jjd|zdz|zdy)Nbuildz(^|z)(RCS|CVS|\.svn)r)is_regex) r>r? get_fullnamerr build_baser$r%r!r#exclude_pattern)rBrJbase_dirr#s r7r0zmanifest_maker.prune_file_listjs**73$$113 E,,- H%ii %% SL. . 4q & r9ct|dr|jStjddd|j S)a0 The parent class implementation of this method (``sdist``) will try to include data files, which might cause recursion problems when ``include_package_data=True``. Therefore, avoid triggering any attempt of analyzing/building the manifest again. get_data_files_without_manifestz@`build_py` command does not inherit from setuptools' `build_py`.z Custom 'build_py' does not implement 'get_data_files_without_manifest'. Please extend command classes from setuptools instead of distutils. z!https://peps.python.org/pep-0632/)see_url)hasattrrQremitget_data_files)rBbuild_pys r7_safe_data_fileszmanifest_maker._safe_data_filestsJ 8> ?;;= =$)) N 8  &&((r9N)r[r\r]r,rorrr6r*r staticmethodr:r+r.r/r0rWrar9r7rrsRH)  ) >";; -$, ) )r9rcdj|}|jd}t|d5}|j|dddy#1swYyxYw)z{Create a file with the specified name and write 'contents' (a sequence of strings without line terminators) to it.  rrN)rrrr)rycontentsrs r7rrsOyy"Hw'H h  s A  Actjd||js|jj}|j |j c|_}|j|jc|_} |j|j||c|_|_t|jdd}tj|j|yy#||c|_|_wxYw)Nz writing %szip_safe)rrrr?rrmrNrlrCwrite_pkg_inforcrrwrite_safety_flag)cmdbasenameryroldveroldnamesafes r7r^r^sHH\8$ ;;##,,#&??H4D4D &!$x}} w > $H # #CLL 1.5v +HM8+s''T:##CLL$7 /6v +HM8+s 6CC+cy)aj Unused: left to avoid errors when updating (from source) from <= 67.8. Old installations have a .dist-info directory with the entry-point ``depends.txt = setuptools.command.egg_info:warn_depends_obsolete``. This may trigger errors when running the first egg_info in build_meta. TODO: Remove this function in a version sufficiently > 68. Nrar`rarys r7warn_depends_obsoletergsr9ctt|xsd}d}t|t|}|j|y)Nrac |dzS)NrZra)rs r7 append_crz&_write_requirements..append_crs d{r9)rmapsorted writelines)streamreqslinesrjs r7_write_requirementsrqs5   #E  6%= )E er9c b|j}tj}t||j|j xsi}t |D]:}|jdjditt|||<|jd||jy)Nz [{extra}] rra) r?ioStringIOrqinstall_requiresextras_requirerlrrvarsrgetvalue)r`rarydistrrvextras r7write_requirementsr{s   D ;;=Dd334((.BN'9 )?))3DF34D."789^Xt}}Gr9ctj}t||jj|j d||j y)Nzsetup-requirements)rsrtrqr?setup_requiresrrx)r`raryrs r7write_setup_requirementsr~s< ;;=Dc..==>18T]]_Mr9c tj|jjDcgc]}|j dddc}}|j d|dj t|dzycc}w)N.rrztop-level namesrZ)rxfromkeysr?iter_distribution_namesr rrrl)r`rarykpkgss r7write_toplevel_namesrsg ==%(%5%5%M%M%OPa P DNN$h &,0G$0NO QsA>c t|||dy)NT) write_argrfs r7 overwrite_argrs c8Xt,r9ctjj|d}t|j|d}|dj |dz}|j ||||y)NrrZ)r!r"splitextrr?rr)r`raryrargnamerts r7rrs\ggx(+G C$$gt 4E  % 4'Whu=r9ctj|jj}tj|}|j d||dy)Nz entry pointsT)r rr?rrenderr)r`raryepsdefns r7 write_entriesrsB   S--:: ;C    $D^XtTBr9ctj|}tj|}|d|d|xst}|r|d|z }|S)rr|z-py)r rr)rlrmrrrCrNeggs r7rrsV  , ,X 6D// rs<53' !,*11(0 '53 7>>3++ ,P;f))Xc$z7c$LFByFBRv)Uv)r 8&HN P->C J <Jr9