��Qc@sdZddlmZdZddlZddlZddlZddlTddlm Z ddl
mZddlm
Z
dd lmZdd
lmZddlmZmZmZddlmZdd
lmZddlmZddlmZejdkr1idd6dd6dd6dd6dd6Zn)idd6dd6dd6dd6dd6Zi
idd6dd6dd6dd6dd6d6idd6dd6d d6dd6dd6d!6id"d6d"d6d#d6d$d6d%d6d&6ed'6id"d6d"d6d(d6d)d6d%d6d*6idd6dd6dd6dd6dd6d+6id"d6d"d6d#d6d$d6d%d6d,6idd6dd6dd6d-d6dd6d.6idd6dd6d d6d-d6dd6d/6id"d6d"d6d#d6d0d6d%d6d16Zd4Zd2e fd3��YZdS(5sFdistutils.command.install
Implements the Distutils 'install' command.i�(tlogs$Id$N(t*(tCommand(tDEBUG(tget_config_vars(tDistutilsPlatformError(t
write_file(tconvert_patht
subst_varstchange_root(tget_platform(tDistutilsOptionError(t USER_BASE(t USER_SITEs2.2s$basetpurelibtplatlibs$base/Include/$dist_nametheaderss
$base/Scriptstscriptstdatas$base/Lib/site-packagess/$base/lib/python$py_version_short/site-packagess3$platbase/lib/python$py_version_short/site-packagess0$base/include/python$py_version_short/$dist_names $base/bintunix_prefixs$base/lib/pythons$base/include/python/$dist_namet unix_homes $usersites4$userbase/include/python$py_version_short/$dist_names
$userbase/bins $userbaset unix_usertnts4$userbase/Python$py_version_nodot/Include/$dist_names$userbase/Scriptstnt_usertos2tos2_homes/rc/bintplan9_prefixt
plan9_homes$userbase/bin/rct
plan9_usertinstallcBs�eZdZdHdIdJddGdefdKddGdd
fdLdMdNddGddfdOdPdQdRdSdTdUdVdWgZdd%d(dgZidd 6Zd,�Zd-�Z d.�Z
d/�Zd0�Zd1�Z
d2�Zd3�Zd4�Zd5�Zd6�Zd7�Zd8�Zd9�Zd:�Zd;�Zd<�Zd=�Zd>�Zd?�Zd@�ZdAefdBefdCefdDefdEdF�fgZRS(Xs'install everything from build directorysprefix=sinstallation prefixsexec-prefix=s.(Unix only) prefix for platform-specific filesshome=s+(Unix only) home directory to install undertusers!install in user site-package '%s's
install-base=s;base installation directory (instead of --prefix or --home)sinstall-platbase=s8base installation directory for platform-specific files s$(instead of --exec-prefix or --home)sroot=s<install everything relative to this alternate root directorysinstall-purelib=s;installation directory for pure Python module distributionssinstall-platlib=s8installation directory for non-pure module distributionssinstall-lib=s4installation directory for all module distributions s3(overrides --install-purelib and --install-platlib)sinstall-headers=s(installation directory for C/C++ headerssinstall-scripts=s)installation directory for Python scriptss
install-data=s%installation directory for data filestcompiletcscompile .py to .pyc [default]s
no-compilesdon't compile .py filess optimize=tOslalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]tforcetfs1force installation (overwrite any existing files)s
skip-builds2skip rebuilding everything (for testing/debugging)srecord=s3filename in which to record list of installed filescCs�d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_
d|_d|_d|_
t|_t|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_dS(Nii(tNonetprefixtexec_prefixthomeRtinstall_basetinstall_platbasetroottinstall_purelibtinstall_platlibtinstall_headerstinstall_libtinstall_scriptstinstall_dataRtinstall_userbaseR
tinstall_usersiteRtoptimizet
extra_pathtinstall_path_fileR"t
skip_buildtwarn_dirt
build_baset build_libtrecord(tself((s//sys/lib/python2.7/distutils/command/install.pytinitialize_options�s2
cCsL|js|js|jr=|js-|jr=tdd�n|jrd|jsX|jrdtd�n|jr�|js�|js�|js�|js�|jr�td��ntjdkr�|jr�|j d�d|_q�n|jd�tjdkr|j�n
|j
�|jd�tjtj�d }td
d�\}}i|jj�d6|jj�d
6|jj�d6|d6|d d!d6|d |dd6|d6|d
6|d6|d6|jd6|jd6|_|j�|jd�|j|jd<|j|jd<tr;ddlm}dGH||j�n|j�|jd�|jrh|j�n|jdkr�|jj r�|j!|_q�|j"|_n|j#dd d!d"d#d$dd�|j$�|j|_%tj&j'|j|j(�|_|j)dk r(|j*d%dd d!d"d#d$�n|jd&�|j+d'd*d+�dS(,Ns.must supply either prefix/exec-prefix/home or s)install-base/install-platbase -- not boths9must supply either home or prefix/exec-prefix -- not bothsGcan't combine user with prefix, exec_prefix/home, or install_(plat)basetposixs+exec-prefix option ignored on this platformspre-finalize_{unix,other}spost-finalize_{unix,other}()iR%R&t dist_nametdist_versiont
dist_fullnamet
py_versionitpy_version_shortitpy_version_nodott
sys_prefixtsys_exec_prefixtuserbasetusersitespost-expand_basedirs()tbasetplatbasei�(tpprintsconfig vars:spost-expand_dirs()tlibRRRRRtlibbasesafter prepending roottbuildR8R9(s
build_bases
build_base(s build_libs build_lib(,R%R&R'R(R)RRtostnametwarnR$t dump_dirst
finalize_unixtfinalize_othertstringtsplittsystversionRtdistributiontget_nametget_versiontget_fullnameR1R2tconfig_varstexpand_basedirsRRJtexpand_dirstcreate_home_pathR.text_modulesR,R+t
convert_pathsthandle_extra_pathtinstall_libbasetpathtjoint
extra_dirsR*tchange_rootstset_undefined_options(R;RAR%R&RJ((s//sys/lib/python2.7/distutils/command/install.pytfinalize_optionss~
$
cCs�tr�ddlm}|dGHx�|jD]�}|d}|ddkrY|dd!}n||jkr�tj|j||�}t||�}n!tj||�}t||�}d||fGHq)WndS(Ni�(t
longopt_xlatet:it=s %s: %s(Rtdistutils.fancy_getoptRjtuser_optionstnegative_optRTt translatetgetattr(R;tmsgRjtopttopt_nametval((s//sys/lib/python2.7/distutils/command/install.pyRQ�s
c Cs�d}tjdkrd}n|jdk s<|jdk r�|jdkri|jdkri|jdks�|jdks�|j dks�|j
dkr�td�ndS|jr�j
dkr�td��n|j
|_|_|j|d�n�|jdk r*|j|_|_|j|d�n�|jdkr�|jdk rTtd�ntjjtj�|_tjjtj�|_n|jdkr�|j|_n|j|_|j|_|j|d�dS( Ntunixtplan9sPinstall-base or install-platbase supplied, but installation scheme is incompletes$User base directory is not specifiedt_usert_homes*must not supply exec-prefix without prefixt_prefix(RVtplatformR(R$R)R.R+R,R-R/R0RRR1Rt
select_schemeR'R%R&RNRdtnormpath(R;R{((s//sys/lib/python2.7/distutils/command/install.pyRR�sB cCs�|jrQ|jdkr'td��n|j|_|_|jtjd�n�|j dk r�|j |_|_|jd�nu|j
dkr�tjjt
j
�|_
n|j
|_|_y|jtj�Wn!tk
r�tdtj�nXdS(Ns$User base directory is not specifiedRxRs)I don't know how to install stuff on '%s'(RR1R$RR(R)R|RNROR'R%RdR}RVtKeyError(R;((s//sys/lib/python2.7/distutils/command/install.pyRS�s"
cCsUt|}xDtD]<}d|}t||�dkrt||||�qqWdS(Ntinstall_(tINSTALL_SCHEMEStSCHEME_KEYSRqR$tsetattr(R;ROtschemetkeytattrname((s//sys/lib/python2.7/distutils/command/install.pyR|�s
cCs�x�|D]y}t||�}|dk rtjdksFtjdkr[tjj|�}nt||j�}t|||�qqWdS(NR=R( RqR$RNRORdt
expanduserRR\R�(R;tattrstattrRu((s//sys/lib/python2.7/distutils/command/install.pyt
_expand_attrs�s
cCs|jdddg�dS(NR(R)R*(R�(R;((s//sys/lib/python2.7/distutils/command/install.pyR]s cCs#|jddddddg�dS(NR+R,R.R-R/R0(R�(R;((s//sys/lib/python2.7/distutils/command/install.pyR^s cGs>x7|D]/}d|}t||tt||���qWdS(NR(R�RRq(R;tnamesROR�((s//sys/lib/python2.7/distutils/command/install.pyRas
cCs�|jdkr!|jj|_n|jdk r�t|j�tkr`tj|jd�|_nt|j�dkr�|jd}}n0t|j�dkr�|j\}}n td�t |�}nd}d}||_
||_dS(Nt,iiisY'extra_path' option must be a list, tuple, or comma-separated string with 1 or 2 elementst(R4R$RXttypet
StringTypeRTRUtlenRRt path_fileRf(R;R�Rf((s//sys/lib/python2.7/distutils/command/install.pyRbs c GsDx=|D]5}d|}t||t|jt||���qWdS(NR(R�R R*Rq(R;R�ROR�((s//sys/lib/python2.7/distutils/command/install.pyRg7s
cCs�|js
dSttjjd��}xc|jj�D]R\}}|j|�r5tjj|�r5|j d|�tj
|d�q5q5WdS(s#Create directories under ~
Nt~sos.makedirs('%s', 0700)i�(RRRNRdR�R\t iteritemst
startswithtisdirtdebug_printtmakedirs(R;R'RORd((s//sys/lib/python2.7/distutils/command/install.pyR_<s "cCs�|jsU|jd�|jjd�j}|jrU|t�krUtd��qUnx!|j�D]}|j|�qbW|j r�|j
�n|jr|j�}|j
r�|j
�}x/tt|��D]}|||||<q�Wn|jt|j|fd|j�nttjjtj�}ttjj|�}tjjtjj|j��}|jr�|j oz|jr�||kr�tjd|j�ndS(NRMs"Can't install when cross-compilings'writing list of installed files to '%s's�modules installed to '%s', which is not in Python's module search path (sys.path) -- you'll have to change the search path yourself(R6trun_commandRXtget_command_objt plat_nameR7R
Rtget_sub_commandsR�tcreate_path_fileR:tget_outputsR*R�txrangetexecuteRtmapRNRdR}RVtnormcaseR.R5Rtdebug(R;t
build_plattcmd_nametoutputstroot_lentcountertsys_pathR.((s//sys/lib/python2.7/distutils/command/install.pytrunIs6
! cCsctjj|j|jd�}|jrN|jt||jgfd|�n|j d|�dS(Ns.pthscreating %sspath file '%s' not created(
RNRdReRcR�R5R�RRfRP(R;tfilename((s//sys/lib/python2.7/distutils/command/install.pyR�ws cCs�g}xV|j�D]H}|j|�}x0|j�D]"}||kr5|j|�q5q5WqW|jr�|jr�|jtjj|j |jd��n|S(Ns.pth(
R�tget_finalized_commandR�tappendR�R5RNRdReRc(R;R�R�tcmdR�((s//sys/lib/python2.7/distutils/command/install.pyR��scCsCg}x6|j�D](}|j|�}|j|j��qW|S(N(R�R�textendt
get_inputs(R;tinputsR�R�((s//sys/lib/python2.7/distutils/command/install.pyR��s
cCs|jj�p|jj�S(sRReturn true if the current distribution has any Python
modules to install.(RXthas_pure_modulesthas_ext_modules(R;((s//sys/lib/python2.7/distutils/command/install.pythas_lib�scCs
|jj�S(N(RXthas_headers(R;((s//sys/lib/python2.7/distutils/command/install.pyR��scCs
|jj�S(N(RXthas_scripts(R;((s//sys/lib/python2.7/distutils/command/install.pyR��scCs
|jj�S(N(RXthas_data_files(R;((s//sys/lib/python2.7/distutils/command/install.pythas_data�sR.R-R/R0tinstall_egg_infocCstS(N(tTrue(R;((s//sys/lib/python2.7/distutils/command/install.pyt<lambda>�sN(sprefix=Nsinstallation prefix(sexec-prefix=Ns.(Unix only) prefix for platform-specific files(shome=Ns+(Unix only) home directory to install under(s
install-base=Ns;base installation directory (instead of --prefix or --home)(sroot=Ns<install everything relative to this alternate root directory(sinstall-purelib=Ns;installation directory for pure Python module distributions(sinstall-platlib=Ns8installation directory for non-pure module distributions(sinstall-headers=Ns(installation directory for C/C++ headers(sinstall-scripts=Ns)installation directory for Python scripts(s
install-data=Ns%installation directory for data files(scompileR scompile .py to .pyc [default](s
no-compileNsdon't compile .py files(s optimize=R!slalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0](sforceR#s1force installation (overwrite any existing files)(s
skip-buildNs2skip rebuilding everything (for testing/debugging)(srecord=Ns3filename in which to record list of installed files(t__name__t
__module__tdescriptionR$R
Rntboolean_optionsRoR<RiRQRRRSR|R�R]R^RaRbRgR_R�R�R�R�R�R�R�R�tsub_commands(((s//sys/lib/python2.7/distutils/command/install.pyRss�
M � 0
"
.
(spurelibsplatlibsheaderssscriptssdata( t__doc__t distutilsRt__revision__RVRNRTttypestdistutils.coreRtdistutils.debugRtdistutils.sysconfigRtdistutils.errorsRtdistutils.file_utilRtdistutils.utilRRR R
RtsiteRR
RWtWINDOWS_SCHEMER�R�R(((s//sys/lib/python2.7/distutils/command/install.pyt<module>s�$
|