Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/distutils/command/build_ext.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
��c@s�dZdZddkZddkZddkZddkZddkTddklZddk	Tddk
lZlZddk
lZddklZdd	klZeid
�Zd�Zdefd
��YZdS(s�distutils.command.build_ext

Implements the Distutils 'build_ext' command, for building extension
modules (currently limited to C extensions, should accommodate C++
extensions ASAP).s;$Id: build_ext.py 54332 2007-03-13 10:19:35Z georg.brandl $i�N(t*(tCommand(tcustomize_compilertget_python_version(tnewer_group(t	Extension(tlogs3^[a-zA-Z_][a-zA-Z_0-9]*(\.[a-zA-Z_][a-zA-Z_0-9]*)*$cCsddkl}|�dS(Ni�(tshow_compilers(tdistutils.ccompilerR(R((s./sys/lib/python/distutils/command/build_ext.pyRst	build_extcBseZdZdeiZd@dAdd	d
dfdd
defdBdCdDdddefdEdFdGdHdIdKdLdMgZdd!d$d*gZd0dJd1e	fgZ
d2�Zd3�Zd4�Z
d5�Zd6�Zd7�Zd8�Zd9�Zd:�Zd;�Zd<�Zd=�Zd>�Zd?�ZRS(Ns8build C/C++ extensions (compile/link to build directory)s (separated by '%s')s
build-lib=tbs(directory for compiled extension modulessbuild-temp=tts1directory for temporary files (build by-products)tinplacetis=ignore build-lib and put compiled extensions into the source s,directory alongside your pure Python moduless
include-dirs=tIs.list of directories to search for header filessdefine=tDsC preprocessor macros to definesundef=tUs!C preprocessor macros to undefines
libraries=tls!external C libraries to link withs
library-dirs=tLs.directories to search for external C librariessrpath=tRs7directories to search for shared C libraries at runtimes
link-objects=tOs2extra explicit link objects to include in the linktdebugtgs'compile/link with debugging informationtforcetfs2forcibly build everything (ignore file timestamps)s	compiler=tcsspecify the compiler typesswig-cpps)make SWIG create C++ files (default is C)s
swig-opts=s!list of SWIG command line optionssswig=spath to the SWIG executables
help-compilerslist available compilerscCs�d|_d|_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_d|_d|_d|_d|_dS(Ni(tNonet
extensionst	build_libt
build_tempRtpackagetinclude_dirstdefinetundeft	librariestlibrary_dirstrpathtlink_objectsRRtcompilertswigtswig_cppt	swig_opts(tself((s./sys/lib/python/distutils/command/build_ext.pytinitialize_optionsas$																	c	Cs�ddkl}|idd"d#d$d%d&�|idjo|ii|_n|ii|_|i	�}|i	d	d
�}|i
djo|ii
pg|_
nt|i
�tjot
i|i
ti�|_
n|i
i|�||jo|i
i|�nt|i�tjo|ig|_n|idjo
g|_n|idjo
g|_n6t|i�tjot
i|iti�|_n|idjo
g|_n6t|i�tjot
i|iti�|_ntidjo�|iitiitid��|iotii|id
�|_ntii|id�|_|i
itiitid��|iitiitid��ntidjo&|iitiitid��ntid djptid djoltiitiitid��o3|iitiitiddt �d��q~|iid�ntiid�ptiid�of|i!d�oVtiitiitid��o|ii|i!d��q
|iid�n|i"o.t
i|i"d�}t#d �|�|_"n|i$ot
i|i$d�|_$n|i%djo
g|_%n|i%id!�|_%dS('Ni�(t	sysconfigtbuildRRR&RRt
plat_specificitnttlibstDebugtReleasetPCtPCBuildtos2tConfigitcygwintatheostbintlibtpythontconfigt.tlinuxtgnutPy_ENABLE_SHAREDtLIBDIRt,cSs
|dfS(t1((tsymbol((s./sys/lib/python/distutils/command/build_ext.pyt<lambda>�st (s	build_libs	build_lib(s
build_temps
build_temp(scompilerscompiler(sdebugsdebug(sforcesforce(&t	distutilsR,tset_undefined_optionsRRtdistributiontext_packagetext_modulesRtget_python_incRttypet
StringTypetstringtsplittostpathseptappendR"R#R$tnametpathtjointsystexec_prefixRRtplatformt
executablet
startswithtprefixRtget_config_varR tmapR!R)(R*R,t
py_includetplat_py_includetdefines((s./sys/lib/python/distutils/command/build_ext.pytfinalize_optionsvsv	



"
"&&(%
&%


c
Cs�ddkl}|ipdSn|ii�oC|id�}|ii|i�pg�|i	i
|i�n|d|id|i
d|id|i�|_t|i�|idj	o|ii|i�n|idj	o1x.|iD]\}}|ii||�q�|idj	o(x%|iD]}|ii|�q4Wn|idj	o|ii|i�n|i	dj	o|ii|i	�n|idj	o|ii|i�n|idj	o|ii|i�n|i�dS(Ni�(tnew_compilert
build_clibR&tverbosetdry_runR(RRcRRIthas_c_librariestget_finalized_commandR"textendtget_library_namesR#RSRdR&ReRfRRRRtset_include_dirsR tdefine_macroR!tundefine_macrot
set_librariestset_library_dirsR$tset_runtime_library_dirsR%tset_link_objectstbuild_extensions(R*RcRdRTtvaluetmacro((s./sys/lib/python/distutils/command/build_ext.pytrun�s>
		


c
Csft|�tj	o
td�nx?tt|��D]+}||}t|t�oq3n|\}}tid|�t|�t	j	o t|�djo
td�nt|�t
jo
ti|�p
td�nt|�t
j	o
td�nt||d�}x>dD]6}|i|�}|dj	ot|||�qqW|id�|_|id�otid�n|id�}|o�g|_g|_x�|D]�}	t|	�t	jo!dt|	�jo
djnp
td�nt|	�djo|ii|	d�q�t|	�djo|ii|	�q�q�Wn|||<q3WdS(s�Ensure that the list of extensions (presumably provided as a
        command option 'extensions') is valid, i.e. it is a list of
        Extension objects.  We also support the old-style list of 2-tuples,
        where the tuples are (ext_name, build_info), which are converted to
        Extension instances here.

        Raise DistutilsSetupError if the structure is invalid anywhere;
        just returns otherwise.
        s:'ext_modules' option must be a list of Extension instancessuold-style (ext_name, build_info) tuple found in ext_modules for extension '%s'-- please convert to Extension instanceisMeach element of 'ext_modules' option must be an Extension instance or 2-tuplesRfirst element of each tuple in 'ext_modules' must be the extension name (a string)sOsecond element of each tuple in 'ext_modules' must be a dictionary (build info)tsourcesRR#R"t
extra_objectstextra_compile_argstextra_link_argsR$tdef_files9'def_file' element of build info dict no longer supportedtmacrosis9'macros' element of build info dict must be 1- or 2-tupleiN(sinclude_dirsslibrary_dirss	librariess
extra_objectssextra_compile_argssextra_link_args(RMtListTypetDistutilsSetupErrortrangetlent
isinstanceRRtwarnt	TupleTypeRNtextension_name_retmatchtDictionaryTypetgetRtsetattrtruntime_library_dirsthas_keyt
define_macrostundef_macrosRS(
R*RR
texttext_namet
build_infotkeytvalR{Rt((s./sys/lib/python/distutils/command/build_ext.pytcheck_extensions_list'sd


	&



		$
cCs>|i|i�g}x!|iD]}|i|i�q W|S(N(R�RRiRv(R*t	filenamesR�((s./sys/lib/python/distutils/command/build_ext.pytget_source_files}s
cCsh|i|i�g}xK|iD]@}|i|i�}|itii|i|i	|���q W|S(N(
R�Rtget_ext_fullnameRTRSRQRURVRtget_ext_filename(R*toutputsR�tfullname((s./sys/lib/python/distutils/command/build_ext.pytget_outputs�s
cCs5|i|i�x|iD]}|i|�qWdS(N(R�Rtbuild_extension(R*R�((s./sys/lib/python/distutils/command/build_ext.pyRr�s
cCs�|i}|djpt|�ttfjotddd|i�nt|�}|i|i�}|i	out
i|d�}t
i|dd!d�}|d}|i
d�}|i|�}tii||i|��}	n"tii|i|i|��}	||i}
|ipt|
|	d�ptid	|i�dSntid
|i�|i||�}|ipg}|i}x!|iD]}
|i|
f�q�W|ii|d|i d|d
|i!d|id|d|i�}||_"|i#o|i$|i#�n|i%pg}|i&p|ii'|�}|ii(||	d|i)|�d|i*d|i+d|d|i,|�d|id|i d|�dS(Ns*in 'ext_modules' option (extension '%s'), s&'sources' must be present and must be sa list of source filenamesR=ii�tbuild_pytnewers$skipping '%s' extension (up-to-date)sbuilding '%s' extensiont
output_dirR{RRtextra_postargstdependsR"R#R�texport_symbolsRttarget_lang(-RvRRMR|R�R}RTtlistR�RRORPRVRhtget_package_dirRQRUR�RR�RRRRtinfotswig_sourcesRxR�R�RSR&tcompileRRt_built_objectsRwRiRytlanguagetdetect_languagetlink_shared_objectt
get_librariesR#R�tget_export_symbols(R*R�RvR�tmodpathRtbaseR�tpackage_dirtext_filenameR�t
extra_argsR{R!tobjectsR�((s./sys/lib/python/distutils/command/build_ext.pyR��sd	&




			

						c
Cs�g}g}h}|iotid�n|ipd|ijo
d}nd}xt|D]l}tii|�\}}	|	djo4|i|d|�|i|�|d||<q^|i|�q^W|p|Sn|ip
|i	�}
|
dg}|i
|i�|io|id�n|ip%x"|iD]}|i|�q>WnxE|D]=}||}
tid	||
�|i|d
|
|g�q`W|S(s�Walk the list of source files in 'sources', looking for SWIG
        interface (.i) files.  Run SWIG on all that are found, and
        return a modified 'sources' list with SWIG source files replaced
        by the generated C (or C++) files.
        s/--swig-cpp is deprecated - use --swig-opts=-c++s-c++s.cpps.cs.it_wrapi�s-pythonsswigging %s to %ss-o(
R(RR�R)RQRUtsplitextRSR't	find_swigRiR�tspawn(R*Rvt	extensiontnew_sourcesR�tswig_targetst
target_exttsourceR�R�R'tswig_cmdtottarget((s./sys/lib/python/distutils/command/build_ext.pyR�sB







cCs�tidjodSn�tidjoMxrdD]:}tiid|d�}tii|�o|Sq/q/WdSn)tid	jodSntd
ti�dS(
s�Return the name of the SWIG executable.  On Unix, this is
        just "swig" -- it should be in the PATH.  Tries a bit harder on
        Windows.
        tposixR'R/s1.3s1.2s1.1s	c:\swig%ssswig.exeR5s>I don't know how to find (much less run) SWIG on platform '%s'N(s1.3s1.2s1.1(RQRTRURVtisfiletDistutilsPlatformError(R*tverstfn((s./sys/lib/python/distutils/command/build_ext.pyR�=scCs+|idjo|Sn|id|SdS(NR=(RR(R*R�((s./sys/lib/python/distutils/command/build_ext.pyR�_scCs�ddkl}ti|d�}tidjo*|t|�dd |t|�d<n|d�}tidjo)|iotti	i
|�d	|Sntti	i
|�|S(
s�Convert the name of an extension (eg. "foo.bar") into the name
        of the file from which it will be loaded (eg. "foo/bar.so", or
        "foo\bar.pyd").
        i�(R]R=R5iitSOR/t_d(tdistutils.sysconfigR]RORPRQRTRRtapplyRURV(R*R�R]text_pathtso_ext((s./sys/lib/python/distutils/command/build_ext.pyR�es*cCsHdti|id�d}||ijo|ii|�n|iS(sReturn the list of symbols that a shared extension has to
        export.  This either uses 'ext.export_symbols' or, if it's not
        provided, "init" + module_name.  Only relevant on Windows, where
        the .pyd file (DLL) must export the module "init" function.
        tinitR=i�(RORPRTR�RS(R*R�t
initfunc_name((s./sys/lib/python/distutils/command/build_ext.pyR�vscCsetidjo�ddkl}t|i|�pRd}|io|d}n|tid?tid?d@f}|i|gSqa|iSn�tid	jo:d}|tid?tid?d@f}|i|gSn�tid
 djo:d}|tid?tid?d@f}|i|gSn:tid
 d
jo�ddk	l
}d}|tid?tid?d@f}g}xO|id�i�D]8}|i
d�o|i|d�q�|i|�q�W|i|dg|Sn}tidjo|iSnbddk	l
}|id�o:d}|tid?tid?d@f}|i|gSn|iSdS(s�Return the list of libraries to link against when building a
        shared extension.  On most platforms, this is just 'ext.libraries';
        on Windows and OS/2, we add the Python library (eg. python20.dll).
        twin32i�(tMSVCCompilers
python%d%dR�iii�tos2emxiR7spython%d.%dR8(R,tSHLIBSs-litmtdarwinR@N(RWRYtdistutils.msvccompilerR�R�R&Rt
hexversionR"RGR,R]RPR[RS(R*R�R�ttemplatet	pythonlibR,textraR:((s./sys/lib/python/distutils/command/build_ext.pyR��sR

(s
build-lib=R
s(directory for compiled extension modules(sbuild-temp=Rs1directory for temporary files (build by-products)(sdefine=RsC preprocessor macros to define(sundef=Rs!C preprocessor macros to undefine(s
libraries=Rs!external C libraries to link with(srpath=Rs7directories to search for shared C libraries at runtime(s
link-objects=Rs2extra explicit link objects to include in the link(sdebugRs'compile/link with debugging information(sforceRs2forcibly build everything (ignore file timestamps)(s	compiler=Rsspecify the compiler typeN(sswig-cppNs)make SWIG create C++ files (default is C)(s
swig-opts=Ns!list of SWIG command line options(sswig=Nspath to the SWIG executable(t__name__t
__module__tdescriptionRQRRtsep_byRtuser_optionstboolean_optionsRthelp_optionsR+RbRuR�R�R�RrR�R�R�R�R�R�R�(((s./sys/lib/python/distutils/command/build_ext.pyR	sh


			r	?	V				b	9	"			(t__doc__t__revision__RWRQROtrettypestdistutils.coreRtdistutils.errorsR�RRtdistutils.dep_utilRtdistutils.extensionRRGRR�R�RR	(((s./sys/lib/python/distutils/command/build_ext.pys<module>s0

		

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.