Viewing File: /usr/lib/python3.6/site-packages/setuptools/command/__pycache__/bdist_egg.cpython-36.pyc

3

Xoh	G@sxdZddlmZddlmZmZddlmZddlm	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZddlmZmZmZdd	lmZdd
lmZddlmZyddlmZmZd
dZWn,ek
rddlm Z mZddZYnXddZ!ddZ"ddZ#GdddeZ$e%j&dj'Z(ddZ)ddZ*ddZ+d d!d"Z,d#d$Z-d%d&Z.d'd(Z/d)d*d+d,gZ0d1d/d0Z1dS)2z6setuptools.command.bdist_egg

Build .egg distributions)DistutilsSetupError)remove_treemkpath)log)CodeTypeN)six)get_build_platformDistributionensure_directory)
EntryPoint)Library)Command)get_pathget_python_versioncCstdS)Npurelib)rrr/usr/lib/python3.6/bdist_egg.py_get_purelibsr)get_python_librcCstdS)NF)rrrrrrscCs2d|krtjj|d}|jdr.|dd}|S)N.rmodulei)ospathsplitextendswith)filenamerrrstrip_module#s

rccs:x4tj|D]&\}}}|j|j|||fVqWdS)zbDo os.walk in a reproducible way,
    independent of indeterministic filesystem readdir order
    N)rwalksort)dirbasedirsfilesrrrsorted_walk+sr$c
Cs6tjdj}t|d}|j||WdQRXdS)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)textwrapdedentlstripopenwrite)ZresourcepyfileZ_stub_templatefrrr
write_stub5s
r-c@seZdZdZd*dddefd+d-d.d/gZdddgZddZddZddZ	ddZ
ddZddZd d!Z
d"d#Zd$d%Zd&d'Zd(d)Zd	S)0	bdist_eggzcreate an "egg" distribution
bdist-dir=b1temporary directory for creating the distributionz
plat-name=pz;platform name to embed in generated filenames (default: %s)exclude-source-filesN+remove all .py files from the generated egg	keep-tempkz/keep the pseudo-installation tree around after z!creating the distribution archive	dist-dir=d-directory to put final built distributions in
skip-build2skip rebuilding everything (for testing/debugging)cCs.d|_d|_d|_d|_d|_d|_d|_dS)Nr)	bdist_dir	plat_name	keep_tempdist_dir
skip_build
egg_outputexclude_source_files)selfrrrinitialize_optionsZszbdist_egg.initialize_optionscCs|jd}|_|j|_|jdkr>|jdj}tjj|d|_|jdkrPt	|_|j
dd|jdkrtdd|j
|jt|jjo|jj
}tjj|j|d|_dS)Negg_infoZbdistZeggr?z.egg)r?r?)get_finalized_commandei_cmdrEr<
bdist_baserrjoinr=rZset_undefined_optionsrAr	Zegg_nameZegg_versionrdistributionhas_ext_modulesr?)rCrGrHbasenamerrrfinalize_optionscs


zbdist_egg.finalize_optionscCs|j|jd_tjjtjjt}|jj	g}|j_	x|D]}t
|trt|dkrtjj
|drtjj|d}tjj|}||ks|j|tjr|t|dd|df}|jj	j|q<Wz"tjd|j|jddddWd||j_	XdS)Ninstallrzinstalling package data to %sinstall_data)forceroot)r<rFinstall_librrnormcaserealpathrrJ
data_files
isinstancetuplelenisabs
startswithsepappendrinfocall_command)rCZ
site_packagesolditemrVZ
normalizedrrrdo_install_data{s 
zbdist_egg.do_install_datacCs|jgS)N)rA)rCrrrget_outputsszbdist_egg.get_outputscKsTxtD]}|j||jqW|jd|j|jd|j|j|f|}|j||S)z8Invoke reinitialized command `cmdname` with keyword argsr@dry_run)INSTALL_DIRECTORY_ATTRS
setdefaultr<r@reZreinitialize_commandrun_command)rCZcmdnamekwdirnamecmdrrrr`s

zbdist_egg.call_commandcCs|jdtjd|j|jd}|j}d|_|jjrJ|jrJ|jd|j	ddd}||_|j
\}}g|_g}xt|D]|\}}t
jj|\}	}
t
jj|jt|	d}|jj|tjd	||jstt
jj|||j||jt
jd
||<q~W|r|j||jjr |j|j}t
jj|d}
|j|
|jjrrt
jj|
d}tjd
||j	d|dd|j|
t
jj|
d}|rtjd||jst|t|d}|j dj||j d|j!n,t
jj"|rtjd||jst
j#|t$t
jj|d|j%t
jj&t
jj|j'drBtj(d|j)rR|j*t+|j,||j-|j|j.d|j/st0|j|jdt1|jdgjdt2|j,fdS)NrEzinstalling library code to %srNZ
build_clibrTr)Zwarn_dirz.pyzcreating stub loader for %s/zEGG-INFOscriptszinstalling scripts to %sZinstall_scriptsrP)install_dirZno_epznative_libs.txtz
writing %swt
zremoving %szdepends.txtzxWARNING: 'depends.txt' will not be used by setuptools 0.6!
Use the install_requires/extras_require setup() args instead.)verboseremode)reZ
dist_filesr.)3rhrr_r<rFrSrJZhas_c_librariesr@r`get_ext_outputsstubs	enumeraterrrrIrr^rer-rLreplacer]Zbyte_compilerWrcrrmcopy_metadata_tor
r)r*closeisfileunlinkwrite_safety_flagzip_safeexistsrEwarnrBzap_pyfilesmake_zipfilerArq
gen_headerr>rgetattrr)rCZinstcmdZold_rootrkall_outputsext_outputsZ
to_compiler2Zext_namerextr+Zarchive_rootrEZ
script_dirZnative_libsZ	libs_filerrrrunsz












z
bdist_egg.runc

Cstjdxt|jD]\}}}x|D]}tjj||}|jdrXtjd|tj	||jdr&|}d}t
j||}tjj|tj|j
dd}	tjd||	fytj|	Wntk
rYnXtj||	q&WqWdS)	Nz+Removing .py files from temporary directoryz.pyzDeleting %s__pycache__z#(?P<name>.+)\.(?P<magic>[^.]+)\.pycnamez.pyczRenaming file from [%s] to [%s])rr_walk_eggr<rrrIrdebugrzrematchpardirgroupremoveOSErrorrename)
rCr!r"r#rrZpath_oldpatternmZpath_newrrrrs*




zbdist_egg.zap_pyfilescCs2t|jdd}|dk	r|Stjdt|j|jS)Nr|z4zip_safe flag not set; analyzing archive contents...)rrJrr~analyze_eggr<rt)rCsaferrrr|s

zbdist_egg.zip_safec
Cstj|jjpd}|jdijd}|dkr0dS|js>|jrLtd|ftj	dd}|j
}dj|j}|jd}tj
j|j}d	t}|jsttj
j|j|jd
t|jd}	|	j||	jdS)Nzsetuptools.installationZeggsecutabler%zGeggsecutable entry point (%r) cannot have 'extras' or refer to a modulerraH#!/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
)rea)rZ	parse_maprJZentry_pointsgetZattrsZextrasrsysversionZmodule_namerIrrrLrAlocalsrerrjr)r*rx)
rCZepmZepZpyverpkgZfullr!rLheaderr,rrrrs*


zbdist_egg.gen_headercCsltjj|j}tjj|d}xJ|jjjD]<}|j|r(tjj||t	|d}t
||j||q(WdS)z*Copy metadata (egg info) to the target_dirrN)rrnormpathrErIrGZfilelistr#r\rZr
Z	copy_file)rCZ
target_dirZ
norm_egg_infoprefixrtargetrrrrw:s
zbdist_egg.copy_metadata_tocCsg}g}|jdi}x|t|jD]n\}}}x6|D].}tjj|djtkr.|j|||q.Wx*|D]"}|||d|tjj||<qfWqW|j	j
r|jd}xd|jD]Z}	t
|	trq|j|	j}
|j|
}tjj|jdstjjtjj|j|r|j|qW||fS)zAGet a list of relative paths to C extensions in the output distrorrPrlZ	build_extzdl-)r<r$rrrlowerNATIVE_EXTENSIONSr^rIrJrKrF
extensionsrXrZget_ext_fullnamerZget_ext_filenamerLr\r})rCrrpathsr!r"r#rZ	build_cmdrfullnamerrrrsFs(


&


zbdist_egg.get_ext_outputs)r/r0r1)r3Nr4Pkeep the pseudo-installation tree around after creating the distribution archive)r5r6r)r7r8r9)r:Nr;)__name__
__module____qualname__descriptionrZuser_optionsZboolean_optionsrDrMrcrdr`rrr|rrwrsrrrrr.Cs4
	
Q'r.z.dll .so .dylib .pydccsLt|}t|\}}}d|kr(|jd|||fVx|D]
}|Vq:WdS)z@Walk an unpacked egg's contents, skipping the metadata directoryzEGG-INFON)r$nextr)egg_dirZwalkerr!r"r#Zbdfrrrrfs

rc	Csx0tjD]$\}}tjjtjj|d|r
|Sq
Wts<dSd}xbt|D]V\}}}xJ|D]B}|jdsZ|jdrvqZqZ|jds|jdrZt	||||o|}qZWqJW|S)NzEGG-INFOFTz.pyz.pywz.pycz.pyo)
safety_flagsitemsrrr}rIcan_scanrrscan_module)	rrtflagfnrr!r"r#rrrrrqs
rcCsx~tjD]r\}}tjj||}tjj|rL|dks@t||kr|tj|q
|dk	r
t||kr
t|d}|j	d|j
q
WdS)Nrorp)rrrrrIr}boolrzr)r*rx)rrrrr,rrrr{s

r{zzip-safeznot-zip-safe)TFc
Cstjj||}|dd|kr"dS|t|ddjtjd}||rJdpLdtjj|d}tjdkrpd}ntjd krd
}nd}t	|d}|j
|tj|}	|j
d}
tjt|	}x&d!D]}||krtjd||d}
qWd|krx*d"D]"}||krtjd||d}
qW|
S)#z;Check whether module possibly uses unsafe-for-zipfile stuffNrPTrrrrrb__file____path__z%s: module references %sFinspect	getsource
getabsfile
getsourcefilegetfilegetsourcelines
findsourcegetcommentsgetframeinfogetinnerframesgetouterframesstacktracez"%s: module MAY be using inspect.%s)rr)rr)rr)rrrrrrrrrrr)rrrIrZrvr]rrversion_infor)readmarshalloadrxdictfromkeysiter_symbolsrr~)
rr!rrtrrrskipr,coderZsymbolsZbadrrrrs: 








rccs`x|jD]
}|VqWxD|jD]:}t|tjr6|Vqt|trxt|D]
}|VqJWqWdS)zBYield names and strings used by `code` and its nested code objectsN)co_names	co_constsrXrZstring_typesrr)rrconstrrrrs

rcCs4tjjdrtjdkrdStjdtjddS)NjavaZcliTz1Unable 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)rplatformr\rr~rrrrrs
rrTrnrQZinstall_baseTr%c
sddl}ttjj|dtjd|fdd}|rB|jn|j}s|j	|||d}	x"t
D]\}
}}||	|
|qfW|	jn$x"t
D]\}
}}|d|
|qW|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.
    rN)rez#creating '%s' and adding '%s' to itcsdx^|D]V}tjjtjj||}tjj|r|tdd}sP|j||tjd|qWdS)NrPzadding '%s')	rrrrIryrZr*rr)zrjnamesrrr2)base_dirrerrvisits
zmake_zipfile.<locals>.visit)compression)zipfilerrrrjrr_ZZIP_DEFLATEDZ
ZIP_STOREDZZipFiler$rx)
Zzip_filenamerrqrecompressrrrrrrrjr"r#r)rrerrs	
r)rrTr%)2__doc__Zdistutils.errorsrZdistutils.dir_utilrrZ	distutilsrtypesrrrrr&rZsetuptools.externrZ
pkg_resourcesrr	r
rZsetuptools.extensionrZ
setuptoolsr
	sysconfigrrrImportErrorZdistutils.sysconfigrrr$r-r.rrsplitrrrr{rrrrrfrrrrr<module>sL
"$

Back to Directory File Manager