a [dg֜@sdgZddlZddlZddlZddlZddlZddlZddlZddl Zddl Zddl Zddl Zddl mZddlmZddlmZddlZddlmZddlmZddlmZmZdd l mZdd lmZdd lmZdd lm Z d dl!m"Z"ddl#Z#ddl$Z#ddl#m%Z%ddl&m'Z'ddl(m)Z)ddl*Z*e+de+dddZ,ddZ-ddZ.ddZ/ddZ0e1e2fZ3ddZ4d d!Z5d"d#Z6d$d%Z7d&d'Z8d(d)Z9d*d+Z:d,d-Z;d.d/Zd4d5Z?e'ej@jAZBGd6ddeBZAGd7d8d8e"ZCdS)9 DistributionN) strtobool)DEBUGtranslate_longopt) defaultdict)message_from_file)DistutilsOptionErrorDistutilsSetupError) rfc822_escape) StrictVersion) packaging) ordered_set)SetuptoolsDeprecationWarning)windows_support) get_unpatched)parse_configurationz&setuptools.extern.packaging.specifiersz#setuptools.extern.packaging.versioncCstdtt|S)NzDo not call this function)warningswarnDistDeprecationWarningr)clsr9/usr/local/lib/python3.9/site-packages/setuptools/dist.py_get_unpatched+s rcCst|dd}|dur|js |jr*td}nd|jdusT|jdusTt|dddusT|jr^td}n0|js||js||j s||j s||j rtd}ntd}||_ |S)Nmetadata_versionz2.1python_requires1.21.1z1.0) getattrlong_description_content_typeprovides_extrasr maintainermaintainer_email project_urlsprovidesrequires obsoletes classifiers download_urlr)selfmvrrrget_metadata_version0s*      r,cs t|fdd}fdd}td|_|d|_|d|_|d|_|d |_d|_|d |_d|_ |d |_ |d |_ d vr|d |_ nd|_ |d|_ |d|_dvr|dd|_|d|_|d|_|jtdkr |d|_|d|_|d|_nd|_d|_d|_dS)Ncs|}|dkrdS|S)NZUNKNOWNr)namevaluemsgrr _read_fieldJsz"read_pkg_file.._read_fieldcs|d}|gkrdS|SN)Zget_all)r-valuesr/rr _read_listPs z!read_pkg_file.._read_listzmetadata-versionr-versionZsummaryauthorz author-emailz home-pagelicensez download-url descriptionkeywords,platformZ classifierrr&r%r')rr rr-r5r8r6r" author_emailr#urlr7r)Zlong_descriptionsplitr9Z platformsr(r&r%r')r*filer1r4rr/r read_pkg_fileFs:                 r@cCs"d|vrtd|dd}|S)N z1newlines not allowed and will break in the future )rrreplace)valrrr single_line{s  rEc s|}fdd}|dt||d||d||dt||d||tdkr|d ||d | n.d }|D]$\}}t ||}|dur|||q|d | |j r|d |j |j D]}|dd|qt|} |d| d|} | r(|d| |tdkrR|D]} |d| q>n|d||d||d||d||d|t|dr|d|j|jr|d|j|jr|jD]} |d| qdS)Ncsd||fdS)Nz%s: %s )write)keyr.r?rr write_fieldsz#write_pkg_file..write_fieldzMetadata-VersionNameVersionZSummaryz Home-pagerAuthor Author-email))rLr6)rMr<)Z Maintainerr")zMaintainer-emailr#ZLicensez Download-URLz Project-URLz%s, %sZ Descriptionr:ZKeywordsZPlatformZ ClassifierZRequiresZProvidesZ ObsoletesrzRequires-PythonzDescription-Content-TypezProvides-Extra)r,strget_nameZ get_versionrEZget_descriptionZget_urlr Z get_contactZget_contact_emailrZ get_licenser)r$itemsr Zget_long_descriptionjoinZ get_keywordsZ get_platformsZ _write_listZget_classifiersZ get_requiresZ get_providesZ get_obsoleteshasattrrr r!) r*r?r5rIZoptional_fieldsZfieldattrZattr_valZ project_urlZ long_descr9r;extrarrHrwrite_pkg_filesV             rUc CsXztjd|}Wn>ttttfyR}ztd||f|WYd}~n d}~00dS)Nzx=z4%r must be importable 'module:attrs' string (got %r)) pkg_resources EntryPointparse TypeError ValueErrorAttributeErrorAssertionErrorr )distrSr.eperrrcheck_importablesr`c CsHzWn>ttttfyB}ztd||f|WYd}~n d}~00dS)Nz%%r must be a list of strings (got %r))rYrZr[r\r r]rSr.r_rrrassert_string_lists rbcCsd|}t||||D]J}||s2tdd||d\}}}|r||vrtjd||qdS)Nz1Distribution contains no modules or packages for znamespace package %r.z^WARNING: %r is declared as a package namespace, but %r is not: please correct this in setup.py)rbhas_contents_forr rpartition distutilslogr)r]rSr.Z ns_packagesZnspparentsepchildrrr check_nsps   rkc CsRzttt|Wn4tttfyL}ztd|WYd}~n d}~00dS)Nz'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.) list itertoolsstarmap _check_extrarPrYrZr[r rarrr check_extrassrpcCs<|d\}}}|r*t|r*td|tt|dS)N:zInvalid environment marker: ) partitionrVZinvalid_markerr rlparse_requirements)rTZreqsr-rimarkerrrrros rocCs&t||kr"d}t|j||ddS)Nz0{attr!r} must be a boolean value (got {value!r}))rSr.)boolr format)r]rSr.tmplrrr assert_bools rxc Csnz(tt|t|ttfr&tdWn@ttfyh}z$d}t|j ||d|WYd}~n d}~00dS)NzUnordered types are not allowedzm{attr!r} must be a string or list of strings containing valid project/version requirement specifiers; {error}rSerror) rlrVrs isinstancedictsetrYrZr rvr]rSr.rzrwrrrcheck_requirementss  rc CsZztj|WnDtjjtfyT}z$d}t|j||d|WYd}~n d}~00dS)NzF{attr!r} must be a string containing valid version specifiers; {error}ry)r Z specifiersZ SpecifierSetZInvalidSpecifierr[r rvr~rrrcheck_specifier%s rc CsDztj|Wn.ty>}zt||WYd}~n d}~00dSr2)rVrWZ parse_maprZr rarrrcheck_entry_points3srcCst|tstddS)Nztest_suite must be a string)r{rNr )r]rSr.rrrcheck_test_suite;s rcCsZt|tstd||D]4\}}t|tsBtd||t|d||q dS)NzT{!r} must be a dictionary mapping package names to lists of string wildcard patternsz,keys of {!r} dict must be strings (got {!r})zvalues of {!r} dict)r{r|r rvrPrNrb)r]rSr.kvrrrcheck_package_data@s  rcCs(|D]}td|stjd|qdS)Nz \w+(\.\w+)*z[WARNING: %r not a valid package name; please use only .-separated package names in setup.py)rematchrfrgr)r]rSr.Zpkgnamerrrcheck_packagesOs  rc@sFeZdZdeejejdZdZddZdHddZ e ddZ e d d Z d d Z d dZe ddZddZddZdIddZddZddZdJddZdKddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Z d4d5Z!d6d7Z"d8d9Z#d:d;Z$dd?Z&d@dAZ'dBdCZ(dDdEZ)dFdGZ*dS)LrN)r r$r!Z license_filescCsl|rd|vsd|vrdStt|d}tjj|}|durh|dshtt|d|_ ||_ dS)Nr-r5zPKG-INFO) rVZ safe_namerNlower working_setZby_keygetZ has_metadataZ safe_versionZ_version _patched_dist)r*attrsrGr]rrrpatch_missing_pkg_infosz#Distribution.patch_missing_pkg_infocstd}|si_|pi}g_|dd_||dg_|dg_t dD]}t  |j dq`t fdd|DjD]J\}}jj|fD]}||vr||}qq|r|nd}tj||qjjj_dS)N package_datasrc_rootdependency_linkssetup_requiresdistutils.setup_keywordscs i|]\}}|jvr||qSr)_DISTUTILS_UNSUPPORTED_METADATA.0rrr*rr s z)Distribution.__init__..)rRrZ dist_filespoprrrrrViter_entry_pointsvars setdefaultr- _Distribution__init__rPrmetadata__dict__setattr_normalize_version_validate_versionr5_finalize_requires)r*rZhave_package_datar^optiondefaultsourcer.rrrrs2   zDistribution.__init__cCsTt|tjs|dur|Sttj|}||krPd}t|j fit |S|S)Nz)Normalizing '{version}' to '{normalized}') r{ setuptoolssicrNr r5rKrrrvlocals)r5Z normalizedrwrrrrszDistribution._normalize_versionc Csdt|tjrt|}|dur`ztj|Wn2tjjtfy^t d|t |YS0|S)NzThe version specified (%r) is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.) r{numbersNumberrNr r5rKZInvalidVersionrYrrrr)r5rrrrs zDistribution._validate_versioncCsft|ddr|j|j_t|ddrR|jD]$}|dd}|r,|jj|q,|| dS)Nrextras_requirerqr) rrrrkeysr>r!add_convert_extras_requirements"_move_install_requirements_markers)r*rTrrrrs   zDistribution._finalize_requirescCsht|ddpi}tt|_|D]@\}}|j|t|D]"}||}|j|||q>q"dS)Nr) rrrl_tmp_extras_requirerPrVrs _suffix_forappend)r*Z spec_ext_reqssectionrrsuffixrrrrs   z)Distribution._convert_extras_requirementscCs|jrdt|jSdS)Nrq)rtrNreqrrrr szDistribution._suffix_forcsdd}tddpd}tt|}t||}t||}ttt|_ |D]}j dt|j  |qPt fddj D_dS)NcSs|j Sr2rtrrrr is_simple_reqszFDistribution._move_install_requirements_markers..is_simple_reqinstall_requiresrrqc3s,|]$\}}|ddtj|DfVqdS)cSsg|] }t|qSr)rN)rrrrr 'zMDistribution._move_install_requirements_markers...N)map _clean_reqrrrr &szBDistribution._move_install_requirements_markers..)rrlrVrsfilterrm filterfalserrNrrrtrr|rPr)r*rZspec_inst_reqsZ inst_reqsZ simple_reqsZ complex_reqsrrrrrs    z/Distribution._move_install_requirements_markerscCs d|_|Sr2r)r*rrrrr+szDistribution._clean_reqc Csddlm}tjtjkrgngd}t|}|dur<|}trJ|d|}t |_ |D]}t j |dd6}tr|dj fit||Wdn1s0Y|D]d}||}||} |D]F} | dks| |vrq||| } || |} || |} || f| | <qq|qZd |jvr:dS|jd D]\} \} } |j| } | rrt|  } n| d vrt| } zt|| p| | Wn0ty}zt||WYd}~n d}~00qHdS) Nr) ConfigParser) z install-basezinstall-platbasez install-libzinstall-platlibzinstall-purelibzinstall-headerszinstall-scriptsz install-dataprefixz exec-prefixhomeuserrootz"Distribution.parse_config_files():utf-8)encodingz reading {filename}__name__global)verbosedry_run) configparserrsysr base_prefix frozensetZfind_config_filesrannouncerNZ optionxformioopenrvrZ read_fileZsectionsoptionsget_option_dictrwarn_dash_deprecationmake_option_lowercasercommand_optionsrP negative_optrrrZr )r* filenamesrZignore_optionsparserfilenamereaderrrZopt_dictoptrDsrcaliasr_rrr_parse_config_files3sJ  (           z Distribution._parse_config_filescCsd|dvr |S|dd}tjjtjj}|dsF|dkrF||vrF|Sd|vr`td||f|S)N)zoptions.extras_requirezoptions.data_files-_rrzrUsage of dash-separated '%s' will not be supported in future versions. Please use the underscore name '%s' instead)rCrfcommand__all__r startswithrr)r*rrZunderscore_optcommandsrrrrus z"Distribution.warn_dash_deprecationcCs4|dks|r|S|}td|||f|S)NrzlUsage of uppercase key '%s' in '%s' will be deprecated in future versions. Please use lowercase '%s' instead)islowerrrr)r*rrZ lowercase_optrrrrsz"Distribution.make_option_lowercasec Cs\|}|dur||}tr,|d||D] \}\}}trZ|d|||fzdd|jD}Wntyg}Yn0z |j}Wntyi}Yn0z|t|t } ||vr| rt |||t | nJ||vr| rt ||t |n,t ||rt |||nt d|||fWq4tyT} zt | | WYd} ~ q4d} ~ 00q4dS)Nz# setting options for '%s' command:z %s = %s (from %s)cSsg|] }t|qSrr)rorrrrsz5Distribution._set_command_options..z1error in %s: command '%s' has no such option '%s')Zget_command_namerrrrPZboolean_optionsr[rr{rNrrrRr rZ) r*Z command_objZ option_dictZ command_namerrr.Z bool_optsneg_optZ is_stringr_rrr_set_command_optionssF             z!Distribution._set_command_optionsFcCs(|j|dt||j|d|dS)N)r)ignore_option_errors)rrrr)r*rrrrrparse_config_filess  zDistribution.parse_config_filescCs8tjjt||jdd}|D]}tjj|ddq|S)NT) installerZreplace_conflicting)rC)rVrresolversfetch_build_eggr)r*r&Zresolved_distsr]rrrfetch_build_eggsszDistribution.fetch_build_eggscCs>d}dd}tddt|}t||dD] }||q,dS)Nz(setuptools.finalize_distribution_optionscSs t|ddS)Norderr)r)hookrrrby_ordersz/Distribution.finalize_options..by_ordercSs|Sr2)load)r_rrrrz/Distribution.finalize_options..)rG)rrVrsorted)r*grouprepsr^rrrfinalize_optionss zDistribution.finalize_optionscCsJtdD]:}t||jd}|dur |j|jd|||j|q dS)Nrr)rVrrr-requirerr)r*r^r.rrr_finalize_setup_keywordss z%Distribution._finalize_setup_keywordscCs*t|ddr dd|jD|_ng|_dS)Nconvert_2to3_doctestscSsg|]}tj|qSr)ospathabspathrprrrrsz8Distribution._finalize_2to3_doctests..)rrrrrr_finalize_2to3_doctestss   z$Distribution._finalize_2to3_doctestscCstjtjd}tj|st|t|tj|d}t|d.}| d| d| dWdn1s|0Y|S)Nz.eggsz README.txtwzcThis directory contains eggs that were downloaded by setuptools to build, test, and run plug-ins. zAThis directory caches those eggs to prevent repeated downloads. z/However, it is safe to delete this directory. ) rrrQcurdirexistsmkdirrZ hide_filerrF)r*Z egg_cache_dirZreadme_txt_filenamefrrrget_egg_cache_dirs      (zDistribution.get_egg_cache_dircCsddlm}|||S)Nr)r)Zsetuptools.installerr)r*rrrrrr s zDistribution.fetch_build_eggcCs\||jvr|j|Std|}|D]*}|j|jd||j|<}|St||S)Ndistutils.commandsr)cmdclassrVrrrrrget_command_class)r*rrr^rrrrrs   zDistribution.get_command_classcCs:tdD]$}|j|jvr |}||j|j<q t|SNr)rVrr-rrrprint_commandsr*r^rrrrrs  zDistribution.print_commandscCs:tdD]$}|j|jvr |}||j|j<q t|Sr)rVrr-rrrget_command_listrrrrr#s  zDistribution.get_command_listcKs@|D]2\}}t|d|d}|r.||q|||qdS)NZ _include_)rPr _include_misc)r*rrrincluderrrr+s  zDistribution.includecsfd|jr&fdd|jD|_|jrDfdd|jD|_|jrbfdd|jD|_dS)Nrccs"g|]}|kr|s|qSrrrpackagepfxrrrFsz0Distribution.exclude_package..cs"g|]}|kr|s|qSrrrrrrrLscs&g|]}|jkr|js|qSr)r-rrrrrrRs)packages py_modules ext_modules)r*rrrrexclude_packageAs   zDistribution.exclude_packagecCs2|d}|D]}||ks&||rdSqdS)NrcT)iter_distribution_namesr)r*rrrrrrrdWs zDistribution.has_contents_forc sttstd|fzt||}Wn2tyZ}ztd||WYd}~n d}~00|dur|t|ts|t|dn|rt||fdd|DdS)Nz(%s: setting must be a list or tuple (%r) %s: No such distribution setting4: this setting cannot be changed via include/excludecsg|]}|vr|qSrrritemr.rrrqrz.Distribution._exclude_misc..r{sequencer rr[r)r*r-r.oldr_rr$r _exclude_misc`s$  zDistribution._exclude_miscc st|tstd||fzt||Wn2tyZ}ztd||WYd}~n d}~00durrt|||n:ttst|dn"fdd|D}t|||dS)Nz%s: setting must be a list (%r)r r!csg|]}|vr|qSrrr"r'rrrrz.Distribution._include_misc..r%)r*r-r.r_newrr)rrss(   zDistribution._include_misccKs@|D]2\}}t|d|d}|r.||q|||qdS)NZ _exclude_)rPrr()r*rrrexcluderrrr+s  zDistribution.excludecCs,t|tstd|ftt|j|dS)Nz.packages: setting must be a list or tuple (%r))r{r&r rlrr)r*rrrr_exclude_packagess  zDistribution._exclude_packagesc Cs|jj|_|jj|_|d}|d}||vrf||\}}||=ddl}||d|dd<|d}q&t|||}||} t | ddrd|f||d<|durgS|S)NraliasesTrZcommand_consumes_arguments command lineargs) __class__Zglobal_optionsrrshlexr>r_parse_command_optsrr) r*rr/rr-rrr1nargsZ cmd_classrrrr2s"       z Distribution._parse_command_optsc Csi}|jD]\}}|D]\}\}}|dkr4q|dd}|dkr||}|j}|t|di|D]\} } | |krv| }d}qqvtdn |dkrd}|| |i|<qq|S)Nr.rrrrzShouldn't be able to get herer) rrPrCZget_command_objrcopyupdaterr\r) r*dcmdZoptsrrrDZcmdobjrnegposrrrget_cmdline_optionss(     z Distribution.get_cmdline_optionsccsv|jpdD] }|Vq |jpdD] }|Vq |jp4dD]:}t|trN|\}}n|j}|drj|dd}|Vq6dS)Nrmodulei)rrrr{tupler-endswith)r*Zpkgr;extr-Z buildinforrrrs    z$Distribution.iter_distribution_namesc Csddl}|jrt||St|jtjs4t||S|jj dvrPt||S|jj}|jj }|j dkrndppd}|jj }t|j d||||_z(t||Wt|j |||||_St|j |||||_0dS)Nr)rutf8win32rAr)rZ help_commandsrhandle_display_optionsr{stdoutr TextIOWrapperrrerrorsr;line_bufferingdetach)r*Z option_orderrrrDnewlinerErrrrAs2    z#Distribution.handle_display_options)N)N)N)NF)+r __module__ __qualname__r|rZ OrderedSetrrrr staticmethodrrrrrrrrrrrrrrrrr rrrrrrrdr(rr+r,r2r:rrArrrrr[sV5 "    B /     (c@s eZdZdS)rN)rrHrIrrrrrsr)DrrrrrrrZ distutils.logrfZdistutils.coreZ distutils.cmdZdistutils.distZdistutils.commandZdistutils.utilrZdistutils.debugrZdistutils.fancy_getoptrrm collectionsrZemailrZdistutils.errorsr r r Zdistutils.versionr Zsetuptools.externr rrrrZsetuptools.commandrZsetuptools.monkeyrZsetuptools.configrrV __import__rr,r@rErUr<rlr&r`rbrkrprorxrrrrrrZcorerrrrrrrsr             5 H   I