U âQab Gã@sxdZddlmZddlmZmZddlmZddlm Z ddl Z ddl Z ddl Z ddl Z ddlZddlmZddlmZmZmZdd lmZdd lmZdd lmZzdd lmZmZd d„ZWn,ek rìddlm Z mZdd„ZYnXdd„Z!dd„Z"dd„Z#Gdd„deƒZ$e% &d '¡¡Z(dd„Z)dd„Z*dd„Z+d d!d"œZ,d#d$„Z-d%d&„Z.d'd(„Z/d)d*d+d,gZ0d1d/d0„Z1dS)2z6setuptools.command.bdist_egg Build .egg distributionsé)ÚDistutilsSetupError)Ú remove_treeÚmkpath)Úlog)ÚCodeTypeN)Úsix)Úget_build_platformÚ DistributionÚensure_directory)Ú EntryPoint)ÚLibrary)ÚCommand)Úget_pathÚget_python_versioncCstdƒS)NZpurelib)r©rrú@/usr/lib/python3.8/site-packages/setuptools/command/bdist_egg.pyÚ _get_purelibsr)Úget_python_librcCstdƒS)NF)rrrrrrscCs2d|krtj |¡d}| d¡r.|dd…}|S)NÚ.rÚmoduleiúÿÿÿ)ÚosÚpathÚsplitextÚendswith)ÚfilenamerrrÚ strip_module#s   rccs6t |¡D]&\}}}| ¡| ¡|||fVq dS)zbDo os.walk in a reproducible way, independent of indeterministic filesystem readdir order N)rÚwalkÚsort)ÚdirÚbaseÚdirsÚfilesrrrÚ sorted_walk+sr"c Cs6t d¡ ¡}t|dƒ}| ||¡W5QRXdS)NaR def __bootstrap__(): global __bootstrap__, __loader__, __file__ import sys, pkg_resources, imp __file__ = pkg_resources.resource_filename(__name__, %r) __loader__ = None; del __bootstrap__, __loader__ imp.load_dynamic(__name__,__file__) __bootstrap__() Úw)ÚtextwrapÚdedentÚlstripÚopenÚwrite)ÚresourceÚpyfileZ_stub_templateÚfrrrÚ write_stub5s r,c@sŽeZdZdZddddeƒfdddd gZd d d gZd d„Zdd„Zdd„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd „Zd!d"„Zd#S)$Ú bdist_eggzcreate an "egg" distribution)z bdist-dir=Úbz1temporary directory for creating the distributionz plat-name=Úpz;platform name to embed in generated filenames (default: %s))úexclude-source-filesNz+remove all .py files from the generated egg)ú keep-tempÚkzPkeep the pseudo-installation tree around after creating the distribution archive)z dist-dir=Údz-directory to put final built distributions in)ú skip-buildNz2skip rebuilding everything (for testing/debugging)r1r4r0cCs.d|_d|_d|_d|_d|_d|_d|_dS)Nr)Ú bdist_dirÚ plat_nameÚ keep_tempÚdist_dirÚ skip_buildÚ egg_outputÚexclude_source_files©ÚselfrrrÚinitialize_optionsZszbdist_egg.initialize_optionscCs¨| d¡}|_|j|_|jdkr>| d¡j}tj |d¡|_|jdkrPt ƒ|_|  dd¡|j dkr¤t dd|j |jtƒ|j ¡o†|jƒ  ¡}tj |j|d¡|_ dS)NÚegg_infoZbdistZegg)r8r8z.egg)Úget_finalized_commandÚei_cmdr?r5Ú bdist_baserrÚjoinr6rZset_undefined_optionsr:r Zegg_nameZ egg_versionrÚ distributionÚhas_ext_modulesr8)r=rArBÚbasenamerrrÚfinalize_optionscs$     ýzbdist_egg.finalize_optionscCsö|j| d¡_tj tj tƒ¡¡}|jj g}|j_ |D]ˆ}t |t ƒr´t |ƒdkr´tj  |d¡r´tj |d¡}tj |¡}||ks˜| |tj¡r´|t |ƒdd…|df}|jj  |¡q:z"t d|j¡|jddddW5||j_ XdS)NÚinstallérézinstalling package data to %sÚ install_data)ÚforceÚroot)r5r@Ú install_librrÚnormcaseÚrealpathrrDÚ data_filesÚ isinstanceÚtupleÚlenÚisabsÚ startswithÚsepÚappendrÚinfoÚ call_command)r=Z site_packagesÚoldÚitemrPZ normalizedrrrÚdo_install_data{s"  ÿzbdist_egg.do_install_datacCs|jgS)N)r:r<rrrÚ get_outputs”szbdist_egg.get_outputscKsPtD]}| ||j¡q| d|j¡| d|j¡|j|f|Ž}| |¡|S)z8Invoke reinitialized command `cmdname` with keyword argsr9Údry_run)ÚINSTALL_DIRECTORY_ATTRSÚ setdefaultr5r9r_Zreinitialize_commandÚ run_command)r=ZcmdnameÚkwÚdirnameÚcmdrrrrZ—s zbdist_egg.call_commandcCs¢| d¡t d|j¡| d¡}|j}d|_|j ¡rH|jsH| d¡|j ddd}||_|  ¡\}}g|_ g}t |ƒD]|\}}t j |¡\} } t j |jt| ƒd¡} |j  | ¡t d |¡|jsÚtt j |¡| ƒ| | ¡| t jd ¡||<qz|r| |¡|jjr| ¡|j} t j | d ¡} | | ¡|jjrlt j | d ¡}t d |¡|j d|dd| | ¡t j | d¡}|rÔt d|¡|jst|ƒt|dƒ}|  d |¡¡|  d¡| !¡n,t j "|¡rt d|¡|jst  #|¡t$t j | d ¡| %¡ƒt j &t j |j'd¡¡r.+)\.(?P[^.]+)\.pycÚnameú.pyczRenaming file from [%s] to [%s])rrYÚwalk_eggr5rrrCrÚdebugrwÚreÚmatchÚpardirÚgroupÚremoveÚOSErrorÚrename) r=rr r!r…rZpath_oldÚpatternÚmZpath_newrrrr|òs4       ÿÿÿzbdist_egg.zap_pyfilescCs2t|jddƒ}|dk r|St d¡t|j|jƒS)Nryz4zip_safe flag not set; analyzing archive contents...)rrDrr{Ú analyze_eggr5rq)r=Úsaferrrry s  zbdist_egg.zip_safec CsÊt |jjpd¡}| di¡ d¡}|dkr0dS|jr<|jrJtd|fƒ‚djt j Ž}|j }d  |j¡}|jd}t j |j¡}d tƒ}|jsÆtt j |j¡|jd t|jdƒ} |  |¡|  ¡d S) NÚzsetuptools.installationZ eggsecutabler#zGeggsecutable entry point (%r) cannot have 'extras' or refer to a modulez{}.{}rraH#!/bin/sh if [ `basename $0` = "%(basename)s" ] then exec python%(pyver)s -c "import sys, os; sys.path.insert(0, os.path.abspath('$0')); from %(pkg)s import %(base)s; sys.exit(%(full)s())" "$@" else echo $0 is not the correct name for this egg file. echo Please rename it back to %(basename)s and try again. exec false fi roÚa)r Z parse_maprDZ entry_pointsÚgetZattrsZextrasrÚformatÚsysÚ version_infoZ module_namerCrrrFr:Úlocalsr_rrdr'r(ru) r=ZepmZepZpyverÚpkgZfullrrFÚheaderr+rrrr~s0 ÿÿ    ô  zbdist_egg.gen_headercCshtj |j¡}tj |d¡}|jjjD]<}| |¡r&tj ||t |ƒd…¡}t |ƒ|  ||¡q&dS)z*Copy metadata (egg info) to the target_dirr”N) rrÚnormpathr?rCrAZfilelistr!rVrTr Z copy_file)r=Z target_dirZ norm_egg_infoÚprefixrÚtargetrrrrt:s zbdist_egg.copy_metadata_toc Csg}g}|jdi}t|jƒD]f\}}}|D].}tj |¡d ¡tkr*| |||¡q*|D]"}|||d|tj ||¡<q^q|j   ¡rú|  d¡}|j D]Z} t | tƒr®qž| | j¡} | | ¡}tj |¡ d¡sžtj tj |j|¡¡rž| |¡qž||fS)zAGet a list of relative paths to C extensions in the output distror”rJrgZ build_extzdl-)r5r"rrrÚlowerÚNATIVE_EXTENSIONSrXrCrDrEr@Ú extensionsrRr Zget_ext_fullnamer…Zget_ext_filenamerFrVrz) r=r€rÚpathsrr r!rZ build_cmdr‚ÚfullnamerrrrpFs0 ÿÿ       zbdist_egg.get_ext_outputsN)Ú__name__Ú __module__Ú __qualname__Ú descriptionrZ user_optionsZboolean_optionsr>rGr]r^rZrƒr|ryr~rtrprrrrr-Cs2ÿôÿ  Q' r-z.dll .so .dylib .pydccsHt|ƒ}t|ƒ\}}}d|kr(| d¡|||fV|D] }|Vq8dS)z@Walk an unpacked egg's contents, skipping the metadata directoryrhN)r"Únextr)Úegg_dirZwalkerrr r!Zbdfrrrr‡fs  r‡c Cs t ¡D](\}}tj tj |d|¡¡r|Sqtƒst|ƒ|krzt |¡q|dk rt|ƒ|krt|dƒ}|  d¡|  ¡qdS)Nrkrl) r«r¬rrrCrzÚboolrwr'r(ru)rªr“r¯r°r+rrrrxƒs    rxzzip-safez not-zip-safe)TFc Cstj ||¡}|dd…|kr"dS|t|ƒdd… tjd¡}||rJdpLdtj |¡d}tjrld}nt j d kr|d }nd }t |d ƒ}|  |¡t  |¡} | ¡d} t t| ƒ¡} d D]} | | kr¼t d|| ¡d} q¼d| kr dD]} | | krêt d|| ¡d} qê| S)z;Check whether module possibly uses unsafe-for-zipfile stuffNéÿÿÿÿTrJrr”ré)ééé éÚrb)Ú__file__Ú__path__z%s: module references %sFÚinspect) Z getsourceZ getabsfileZ getsourcefileZgetfilegetsourcelinesZ findsourceZ getcommentsZ getframeinfoZgetinnerframesZgetouterframesÚstackZtracez"%s: module MAY be using inspect.%s)rrrCrTrsrWrrZPY2r˜r™r'ÚreadÚmarshalÚloadruÚdictÚfromkeysÚ iter_symbolsrr{) rªrr…rqrr›rÚskipr+Úcoder“ZsymbolsZbadrrrr®–s4      r®ccsT|jD] }|Vq|jD]6}t|tjƒr0|Vqt|tƒrt|ƒD] }|VqBqdS)zBYield names and strings used by `code` and its nested code objectsN)Úco_namesÚ co_constsrRrZ string_typesrrÂ)rÄr…Úconstrrrrºs     rÂcCs2tj d¡stjdkrdSt d¡t d¡dS)NÚjavaZcliTz1Unable to analyze compiled code on this platform.zfPlease ask the author to include a 'zip_safe' setting (either True or False) in the package's setup.py)r˜ÚplatformrVrr{rrrrr­Æs r­rNrjrKZ install_baseTr#c sªddl}ttj |¡ˆdt d|ˆ¡‡‡fdd„}|rB|jn|j}ˆs†|j |||d} t ˆƒD]\} } } || | | ƒqd|   ¡n t ˆƒD]\} } } |d| | ƒqŽ|S)aqCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. rNroz#creating '%s' and adding '%s' to itcs`|D]V}tj tj ||¡¡}tj |¡r|tˆƒdd…}ˆsN| ||¡t d|¡qdS)NrJz adding '%s') rrrrCrvrTr(rrˆ)ÚzrdÚnamesr…rr/©Úbase_dirr_rrÚvisitäs  zmake_zipfile..visit)Ú compression) ÚzipfilerrrrdrrYZ ZIP_DEFLATEDZ ZIP_STOREDZZipFiler"ru) Z zip_filenamerÍrmr_ÚcompressrnrÐrÎrÏrÊrdr r!rrÌrr}×s  r})rrTr#)2Ú__doc__Zdistutils.errorsrZdistutils.dir_utilrrZ distutilsrÚtypesrr˜rr‰r$r¾Zsetuptools.externrZ pkg_resourcesrr r r Zsetuptools.extensionr Z setuptoolsr Z sysconfigrrrÚ ImportErrorZdistutils.sysconfigrrr"r,r-rÀrÁÚsplitr¡r‡r’rxr«r®rÂr­r`r}rrrrÚsX         " þ$  ÿÿ