_d@6dZddlmZmZddlmZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlmZdd lmZdd lmZmZd Zd Zd ZdZGddeZej9dj;ZdZdZ dZ!dddZ"dZ#dZ$dZ%gdZ&ddZ'y)z6setuptools.command.bdist_egg Build .egg distributions) remove_treemkpath)log)CodeTypeN)Library)Command)ensure_directory)get_pathget_python_versionctdS)Npurelib)r >/usr/lib/python3/dist-packages/setuptools/command/bdist_egg.py _get_purelibrs I rc~d|vr"tjj|d}|jdr|dd}|S)N.rmodulei)ospathsplitextendswith)filenames r strip_modulers@ h77##H-a0"CR= Orc#Ktj|D]-\}}}|j|j|||f/yw)zbDo os.walk in a reproducible way, independent of indeterministic filesystem readdir order N)rwalksort)dirbasedirsfiless r sorted_walkr#!sE WWS\ dE  D% sAA ctjdj}t|d5}|j ||zdddy#1swYyxYw)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)resourcepyfile_stub_templatefs r write_stubr/+sU__   fh fc +a )*+++s AAcbeZdZdZgdZgdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZy) bdist_eggzcreate an "egg" distribution))z bdist-dir=bz1temporary directory for creating the distribution)z plat-name=pzdplatform name to embed in generated filenames (by default uses `pkg_resources.get_build_platform()`))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))r5r8r4cfd|_d|_d|_d|_d|_d|_d|_y)Nr) bdist_dir plat_name keep_tempdist_dir skip_build egg_outputexclude_source_filesselfs rinitialize_optionszbdist_egg.initialize_optionsUs4 $(!rcN|jdx}|_|j|_|j@|jdj}t j j|d|_|jddl m }||_|jdd|jt|jt|jj!xr |j}t j j|j"|dz|_ yy) Negg_infobdisteggr)get_build_platform)r=r=) py_versionplatformz.egg)get_finalized_commandei_cmdrEr: bdist_baserrjoinr; pkg_resourcesrHset_undefined_optionsr?_get_egg_basenamer distributionhas_ext_modulesr=)rBrLrMrHbasenames rfinalize_optionszbdist_egg.finalize_options^s#99*EE >> !33G<GGJWW\\*e> ! 8/1DN ""7,DE ?? "//-/**::<O0H !ggll4==(V:KLDO #rc|j|jd_tjj tjj t}|jjgc}|j_ |D]}t|trt|dk(rtjj|dr~tjj |d}tjj |}||k(s"|j|tjzr|t|dzd|df}|jjj!| t#j$d|j|j'ddd||j_ y#||j_ wxYw)Ninstallr rzinstalling package data to %s install_data)forceroot)r:rK install_librrnormcaserealpathrrR data_files isinstancetuplelenisabs startswithsepappendrinfo call_command)rB site_packagesolditemr^ normalizeds rdo_install_datazbdist_egg.do_install_datavsi<@NN""9-9(()9)9,.)IJ ,0,=,=,H,H")T   ) 6D$&3t9>77==a)!ww//Q8H!#!1!1(!;J!]2j6K6K%.7 (M(:Q(>(@A47J    ( ( / / 5 6 / HH4dnn E   nAD  A+.D   (3D   (s 84F>>Gc|jgS)N)r?rAs r get_outputszbdist_egg.get_outputss  rc tD]}|j||j |jd|j|jd|j|j |fi|}|j ||S)z8Invoke reinitialized command `cmdname` with keyword argsr>dry_run)INSTALL_DIRECTORY_ATTRS setdefaultr:r>rqreinitialize_command run_command)rBcmdnamekwdirnamecmds rrhzbdist_egg.call_commandsq. 3G MM'4>> 2 3 lDOO4 i.'d''626 ! rc |jdtjd|j|j d}|j }d|_|j jr|js|jd|jdd}||_|j\}}g|_ g}t|D]\}}tjj|\} } tjj!|jt#| dz} |jj%| tjd ||j&s)t)tjj+|| |j%| |j-tj.d ||<|r|j1||j j2r|j5|j} tjj!| d } |j7| |j j8rJtjj!| d }tjd ||jd|d|j;| tjj!| d}|r{tjd||j&st=|t?|d}|jAdj!||jAd|jCnVtjjE|r7tjd||j&stjF|tItjj!| d |jKtjjMtjj!|jNdrtjPd|jRr|jUtW|jX| |jZ|j&|j]|j^s!ta|j|j&tc|j dgj%dte|jXfy)NrEzinstalling library code to %srW build_clibr\r)warn_dir.pyzcreating stub loader for %s/EGG-INFOscriptszinstalling scripts to %sinstall_scriptsrX) install_dirno_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.)verboserqmoderq dist_filesr1)3rurrgr:rKr[rRhas_c_librariesr>rhget_ext_outputsstubs enumeraterrrrNrrfrqr/rTreplacere byte_compiler_rmrrcopy_metadata_tor r)r*closeisfileunlinkwrite_safety_flagzip_safeexistsrEwarnr@ zap_pyfiles make_zipfiler?r gen_headerr<rgetattrr )rBinstcmdold_rootry all_outputs ext_outputs to_compiler3ext_namerextr, archive_rootrE script_dir native_libs libs_files rrunz bdist_egg.runs $ 0$..A,,Y7<<    , , .t   \ * : #'#7#7#9 [  $[1 ;KAxGG,,X6MHcWW\\$..,x2H52PQF JJ  f % HH2H =<<277++H5v>   f %%--bffc:KN ;    Z (    ' '  "~~ 77<< j9 H    $ $h :J HH/ <   /Zq  Q h'ggll8->?  HH\; /<< - d3  + 67%! WW^^K ( HH]K 0<< +&"'',,|Z@$--/R 77>>"'',,t}}mD E HHP   $ $      OO LLLL"  ~~  = !!<4;; ,. @ rc tjdt|jD]!\}}}|D]}tj j ||}|jdr+tjd|t j||jdsr|}d}tj||}tj j |tj|jddz} tjd|d | d  t j| t j || $y#t$rY(wxYw) Nz+Removing .py files from temporary directoryr}z Deleting %s __pycache__z#(?P.+)\.(?P[^.]+)\.pycname.pyczRenaming file from [z] to [])rrgwalk_eggr:rrrNrdebugrrematchpardirgroupremoveOSErrorrename) rBr r!r"rrpath_oldpatternmpath_news rrzbdist_egg.zap_pyfiless  >?!)$..!9 2 D$ 2ww||D$/=='IImT2IIdO==/#HDG$/A!ww||D"))QWWV_v=UVHHH(HUV (+IIh1% 2 2"#sE EEct|jdd}||Stjdt |j |j S)Nrz4zip_safe flag not set; analyzing archive contents...)rrRrr analyze_eggr:r)rBsafes rrzbdist_egg.zip_safesCt((*d;  K GH4>>4::66rcy)Nr%rrAs rrzbdist_egg.gen_header srctjj|j}tjj |d}|j j jD]]}|j|stjj ||t|d}t||j||_y)z*Copy metadata (egg info) to the target_dirN) rrnormpathrErNrLfilelistr"rdrbr copy_file)rB target_dir norm_egg_infoprefixrtargets rrzbdist_egg.copy_metadata_tos((7 mR0KK((.. -Dv&j$s6{}2EF (tV,  -rc|g}g}|jdi}t|jD]\}}}|D]P}tjj |dj t vs:|j|||zR|D].}|||zdz|tjj||<0|jjr|jd}|jD]} t| tr|j| j } |j#| }tjj%|j'drotjj)tjj|j|s|j|||fS)zAGet a list of relative paths to C extensions in the output distrorrXr~ build_extzdl-)r:r#rrrlowerNATIVE_EXTENSIONSrfrNrRrSrK extensionsr`rget_ext_fullnamerget_ext_filenamerTrdr) rBrrpathsr r!r"r build_cmdrfullnames rrzbdist_egg.get_ext_outputss  $!,T^^!< S D$! ?77##H-a0668 ?! S6;DkH6Ls6Rbggll423 S  S    , , .22;?I ++ 5c7+$55chh?$55h?ww''1<>8&LM#**84 5K''rN)__name__ __module__ __qualname__ description user_optionsboolean_optionsrCrUrmrorhrrrrrrrrrr1r1=sP2KL&JO)M0/2!Q f2.7 -(rr1z.dll .so .dylib .pydc#Kt|}t|\}}}d|vr|jd|||f|D]}|yw)z@Walk an unpacked egg's contents, skipping the metadata directoryrN)r#nextr)egg_dirwalkerr r!r"bdfs rrr;sU  !FV D$T J e  sAActjD]G\}}tjj tjj |d|sE|cSt syd}t|D]e\}}}|D]Z}|jds|jdr&|jds|jdsIt||||xr|}\g|S)NrFTr}z.pywrz.pyo) safety_flagsitemsrrrrNcan_scanrr scan_module) rrflagfnrr r!r"rs rrrFs &&(b 77>>"'',,w B? @K : D%g.HdE HD}}U#t}}V'<v&$--*?"7D$>G4  HH KrctjD]\}}tjj ||}tjj |r'|t ||k7sVtj|l|ot ||k(s~t|d}|jd|jy)Nrr) rrrrrNrboolrr)r*r)rrrrr.s rrrXs &&(b WW\\'2 & 77>>" |tDzT1 "  $t*"4RA GGDM GGIrzzip-safez not-zip-safe)TFctjj||}|dd|vry|t|dzdj tj d}||xrdxsdztjj |dz}tjdkrd }nd }t|d }|j|tj|} |jd} tjt!| } d D] } | | vst#j$d || d} "d| vr%dD] } | | vst#j$d|| d} "| S)z;Check whether module possibly uses unsafe-for-zipfile stuffNTrXrrr) rb)__file____path__z%s: module references %sFinspect) getsource getabsfile getsourcefilegetfilegetsourcelines findsource getcomments getframeinfogetinnerframesgetouterframesstacktracez"%s: module MAY be using inspect.%s)rrrNrbrrersys version_infor)readmarshalloadrdictfromkeys iter_symbolsrr) rr rrrpkgrskipr.codersymbolsbads rrrksFww||D$'H} s7|a! " * *2663 7C CKC%2 &)9)9$)?)B BF &  XtAFF4L <<?DGGI DmmL./G' '> HH/ =DG   Cg~=vsK  Krc#K|jD]}||jD]<}t|tr|t|ts)t |D]}|>yw)zBYield names and strings used by `code` and its nested code objectsN)co_names co_constsr`strrr)rrconsts rrrsc   eS !K x ($U+    s A A$ A$ctjjdstjdk7rytjdtjdy)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)rrJrdrrrrrrrsA << " "6 *s||u/DHH @AHH Dr)r\rrY install_basecddl}ttjj |t j d|fd}|r |jn |j}sD|j|||} tD]\} } } || | | | j|StD]\} } } |d| | |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. rNrz#creating '%s' and adding '%s' to itcD|D]}tjjtjj||}tjj |s`|t dzd}s|j ||tjd|y)NrXz adding '%s') rrrrNrrbr*rr)zrxnamesrrr3base_dirrqs rvisitzmake_zipfile..visitsz ,D77##BGGLL$$?@Dww~~d#X*,-GGD!$ -+  ,r) compression) zipfilerrrrxrrg ZIP_DEFLATED ZIP_STOREDZipFiler#r) zip_filenamerrrqcompressrrrrrrxr!r"s ` ` rrrs 277??< (':HH 2L(K,+3'&&8J8JK  OOL$KO H$/$9 % GT5 !We $ %   %0$9 ( GT5 $ ' ( r)rrTr%)(__doc__distutils.dir_utilrr distutilsrtypesrrrrr&rsetuptools.extensionr setuptoolsr_pathr sysconfigr r rrr#r/r1rrsplitrrrrrrrrrrrrrrr&s3 ($2 +$x(x(vMM"8">">"@A$    'T Yr