o ~Re@@s"dZddlmZmZddlmZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl mZmZmZddlmZddlmZdd lmZmZd d Zd d ZddZddZGdddeZedZ ddZ!ddZ"ddZ#dddZ$ddZ%d d!Z&d"d#Z'gd$Z( % &d)d'd(Z)dS)*z6setuptools.command.bdist_egg Build .egg distributions) remove_treemkpath)log)CodeTypeN)get_build_platform Distributionensure_directory)Library)Command)get_pathget_python_versioncCstdS)Npurelib)r rr/builddir/build/BUILDROOT/alt-python310-setuptools-58.3.0-2.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/setuptools/command/bdist_egg.py _get_purelibrcCs2d|vr tj|d}|dr|dd}|S)N.rmodulei)ospathsplitextendswith)filenamerrr strip_modules   rccs8t|D]\}}}|||||fVqdS)zbDo os.walk in a reproducible way, independent of indeterministic filesystem readdir order N)rwalksort)dirbasedirsfilesrrr sorted_walk!s r cCsLtd}t|d}|||WddS1swYdS)Na def __bootstrap__(): global __bootstrap__, __loader__, __file__ import sys, pkg_resources, importlib.util __file__ = pkg_resources.resource_filename(__name__, %r) __loader__ = None; del __bootstrap__, __loader__ spec = importlib.util.spec_from_file_location(__name__,__file__) mod = importlib.util.module_from_spec(spec) spec.loader.exec_module(mod) __bootstrap__() w)textwrapdedentlstripopenwrite)resourcepyfileZ_stub_templatefrrr write_stub+s   "r*c@seZdZdZddddefdddd gZgd Zd d Zd dZddZ ddZ ddZ ddZ ddZ ddZddZddZdd 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-tempkzPkeep 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))r/r2r.cCs.d|_d|_d|_d|_d|_d|_d|_dS)Nr) bdist_dir plat_name keep_tempdist_dir skip_build egg_outputexclude_source_filesselfrrrinitialize_optionsRs zbdist_egg.initialize_optionscCs|d}|_|j|_|jdur|dj}tj|d|_|jdur(t |_| dd|j durTt dd|j |jt|joC|j }tj|j|d|_ dSdS)Negg_infobdistegg)r6r6z.egg)get_finalized_commandei_cmdr=r3 bdist_baserrjoinr4rset_undefined_optionsr8regg_nameZ egg_versionr distributionhas_ext_modulesr6)r;rArBbasenamerrrfinalize_options[s$      zbdist_egg.finalize_optionscCs|j|d_tjtjt}|jj g}|j_ |D]D}t |t rZt |dkrZtj |drZtj|d}tj|}||ksL||tjrZ|t |dd|df}|jj |qztd|j|jddddW||j_ dS||j_ w)Ninstallrzinstalling package data to %s install_data)forceroot)r3r@ install_librrnormcaserealpathrrF data_files isinstancetuplelenisabs startswithsepappendrinfo call_command)r; site_packagesolditemrR normalizedrrrdo_install_datass"  zbdist_egg.do_install_datacCs|jgS)N)r8r:rrr get_outputsrzbdist_egg.get_outputscKsTtD] }|||jq|d|j|d|j|j|fi|}|||S)z8Invoke reinitialized command `cmdname` with keyword argsr7dry_run)INSTALL_DIRECTORY_ATTRS setdefaultr3r7rcreinitialize_command run_command)r;Zcmdnamekwdirnamecmdrrrr\s zbdist_egg.call_commandcCs|dtd|j|d}|j}d|_|jr$|js$|d|j ddd}||_| \}}g|_ g}t |D]>\}}t j|\} } t j|jt| d} |j | td ||jsmtt j|| || |t jd ||<q=|r|||jjr||j} t j| d } || |jjrt j| d }td ||j d|dd|| t j| d}|rtd||jst|t|d}| d|| d|!nt j"|rtd||jst #|t$t j| d |%t j&t j|j'drt(d|j)r|*t+|j,| |j-|j|.d|j/s9t0|j|jdt1|jdgdt2|j,fdS)Nr=zinstalling library code to %srJ build_clibrPr)warn_dir.pyzcreating stub loader for %s/EGG-INFOscriptszinstalling scripts to %sinstall_scriptsrL) install_dirZno_epznative_libs.txtz writing %swt z removing %sz depends.txtzxWARNING: 'depends.txt' will not be used by setuptools 0.6! Use the install_requires/extras_require setup() args instead.)verbosercmoderc dist_filesr+)3rgrr[r3r@rOrFhas_c_librariesr7r\get_ext_outputsstubs enumeraterrrrCrrZrcr*rHreplacerY byte_compilerSrarrpcopy_metadata_torr%r&closeisfileunlinkwrite_safety_flagzip_safeexistsr=warnr9 zap_pyfiles make_zipfiler8ru gen_headerr5rgetattrr )r;ZinstcmdZold_rootrj all_outputs ext_outputsZ to_compiler-Zext_namerextr(Z archive_rootr=Z script_dirZ native_libsZ libs_filerrrruns                    z bdist_egg.runc Cstdt|jD]^\}}}|D]V}tj||}|dr*td|t ||drg|}d}t ||}tj|tj | dd} td|| fzt| Wn ty`Ynwt|| qq dS) Nz+Removing .py files from temporary directoryrmz Deleting %s __pycache__z#(?P.+)\.(?P[^.]+)\.pycname.pyczRenaming file from [%s] to [%s])rr[walk_eggr3rrrCrdebugrrematchpardirgroupremoveOSErrorrename) r;rrrrrZpath_oldpatternmZpath_newrrrrs8        zbdist_egg.zap_pyfilescCs2t|jdd}|dur |Stdt|j|jS)Nrz4zip_safe flag not set; analyzing archive contents...)rrFrr analyze_eggr3r{)r;saferrrrs  zbdist_egg.zip_safecCsdS)Nr!rr:rrrr szbdist_egg.gen_headercCshtj|j}tj|d}|jjjD]}||r1tj||t |d}t || ||qdS)z*Copy metadata (egg info) to the target_dirN) rrnormpathr=rCrAfilelistrrXrVr copy_file)r; target_dirZ norm_egg_infoprefixrtargetrrrrs  zbdist_egg.copy_metadata_toc Csg}g}|jdi}t|jD]3\}}}|D]}tj|dtvr,||||q|D]}|||d|tj||<q/q|j r}| d}|j D]-} t | trWqO|| j} || }tj|ds|tjtj|j|r|||qO||fS)zAGet a list of relative paths to C extensions in the output distrorrLrn build_extzdl-)r3r rrrlowerNATIVE_EXTENSIONSrZrCrFrGr@ extensionsrTr Zget_ext_fullnamerZget_ext_filenamerHrXr) r;rrpathsrrrrZ build_cmdrfullnamerrrrzs6        zbdist_egg.get_ext_outputsN)__name__ __module__ __qualname__ descriptionr user_optionsboolean_optionsr<rIrarbr\rrrrrrzrrrrr+;s.  Q r+z.dll .so .dylib .pydccsJt|}t|\}}}d|vr|d|||fV|D]}|VqdS)z@Walk an unpacked egg's contents, skipping the metadata directoryroN)r nextr)egg_dirwalkerrrrZbdfrrrr:s  rc CstD]\}}tjtj|d|r|SqtsdSd}t|D](\}}}|D] }|ds7|dr8q+|dsB|drKt ||||oJ|}q+q$|S)NroFTrmz.pywrz.pyo) safety_flagsitemsrrrrCcan_scanrr scan_module) rr{flagfnrrrrrrrrrEs rcCstD]9\}}tj||}tj|r%|dust||kr$t|q|dur=t||kr=t|d}| d| qdS)Nrsrt) rrrrrCrboolrr%r&r)rrrrr)rrrrWs    rzzip-safez not-zip-safe)TFc Cstj||}|dd|vrdS|t|ddtjd}||r%dp&dtj|d}tjdkr8d }nd }t |d }| |t |} | d} tt| } d D]} | | vrgtd || d} qXd| vr~dD]} | | vr}td|| d} qn| S)z;Check whether module possibly uses unsafe-for-zipfile stuffNTrLrrr) rb)__file____path__z%s: module references %sFinspect) getsource getabsfile getsourcefileZgetfilegetsourcelines findsource getcomments getframeinfogetinnerframesgetouterframesstacktracez"%s: module MAY be using inspect.%s)rrrCrVr}rYrsys version_infor%readmarshalloadrdictfromkeys iter_symbolsrr) rrrr{rpkgrskipr)codersymbolsbadrrrrjs4     rccsT|jD]}|Vq|jD]}t|tr|Vq t|tr't|D]}|Vq!q dS)zBYield names and strings used by `code` and its nested code objectsN)co_names co_constsrTstrrr)rrconstrrrrs     rcCs2tjds tjdkr dStdtddS)NjavacliTz1Unable 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)rplatformrXrrrrrrrs r)rPrrrM install_baseTr!c sddl}ttj|dtd|fdd}|r!|jn|j}sD|j |||d} t D] \} } } || | | q2| |St D] \} } } |d| | qH|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. rNrwz#creating '%s' and adding '%s' to itcs`|D]+}tjtj||}tj|r-|tdd}s'|||td|qdS)NrLz adding '%s') rrrrCrrVr&rr)zrinamesrrr-base_dirrcrrvisits   zmake_zipfile..visit) compression) zipfilerrrrirr[ ZIP_DEFLATED ZIP_STOREDZipFiler r) zip_filenamerrurccompressrvrrrrrirrrrrrs r)rrTr!)*__doc__distutils.dir_utilrr distutilsrtypesrrrrr"r pkg_resourcesrrrZsetuptools.extensionr setuptoolsr sysconfigr r rrr r*r+rrsplitrrrrrrrrrdrrrrrsB     } "