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

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


�
��c@s�dZdZddkZddkZddkZddkTddklZddklZddk	Tddk
lZddkl
Z
d	efd
��YZdS(sHdistutils.command.build_py

Implements the Distutils 'build_py' command.s4$Id: build_py.py 37828 2004-11-10 22:23:15Z loewis $i�N(t*(tglob(tCommand(tconvert_path(tlogtbuild_pycBs�eZdZd#d$d&d'd(gZddgZhdd<Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zd �Zd!�Zd"�ZRS()s5"build" pure Python modules (copy to build directory)s
build-lib=tdsdirectory to "build" (copy) totcompiletcscompile .py to .pycs
no-compiles!don't compile .py files [default]s	optimize=tOslalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0]tforcetfs2forcibly build everything (ignore file timestamps)cCsLd|_d|_d|_d|_d|_d|_d|_d|_dS(Ni(	tNonet	build_libt
py_modulestpackagetpackage_datatpackage_dirRtoptimizeR
(tself((s-/sys/lib/python/distutils/command/build_py.pytinitialize_options$s							cCs |iddd�|ii|_|ii|_|ii|_h|_|iio:x7|iii�D]\}}t|�|i|<qiWn|i�|_	t
|i�tj	ogy>t
|i�|_d|ijo
djnpt�Wqttfj
otd�qXndS(	NtbuildR
R
iisoptimize must be 0, 1, or 2(s	build_libs	build_lib(sforcesforce(tset_undefined_optionstdistributiontpackagesRRRtitemsRtget_data_filest
data_filesttypeRtIntTypetinttAssertionErrort
ValueErrortDistutilsOptionError(Rtnametpath((s-/sys/lib/python/distutils/command/build_py.pytfinalize_options.s$		
,cCsW|io|i�n|io|i�|i�n|i|idd��dS(Ntinclude_bytecodei(Rt
build_modulesRtbuild_packagestbuild_package_datatbyte_compiletget_outputs(R((s-/sys/lib/python/distutils/command/build_py.pytrunGs


c	Cs�g}|ip|Snx�|iD]�}|i|�}tii|ig|id��}t|�d}g}|i||�D]}|||q�~}|i	||||f�q"W|S(s?Generate list of '(package,src_dir,build_dir,filenames)' tuplest.i(
Rtget_package_dirtosR#tjoinR
tsplittlentfind_data_filestappend(	RtdataRtsrc_dirt	build_dirtplent_[1]tfilet	filenames((s-/sys/lib/python/distutils/command/build_py.pyRhs

%1c	Cs�|iidg�|ii|g�}g}xh|D]`}ttii|t|���}|ig}|D]}||jo||qmqm~�q5W|S(s6Return filenames for package's data files in 'src_dir't(RtgetRR.R#R/Rtextend(	RRR5tglobstfilestpatterntfilelistR8tfn((s-/sys/lib/python/distutils/command/build_py.pyR2~s!=cCs�d}x�|iD]v\}}}}xa|D]Y}tii||�}|itii|��|itii||�|dt�q)WqWdS(s$Copy data files into build directoryt
preserve_modeN(	RRR.R#R/tmkpathtdirnamet	copy_filetFalse(RtlastdirRR5R6R:tfilenamettarget((s-/sys/lib/python/distutils/command/build_py.pyR(�s
cCs!ti|d�}|ip&|ottii|�SqdSn�g}x�|ouy|iti|d�}Wn.tj
o"|id|d�|d=qKX|id|�ttii|�SqKW|ii	d�}|dj	o|id|�n|ottii|�SndSdS(s�Return the directory, relative to the top of the source
           distribution, where package 'package' should be found
           (at least according to the 'package_dir' option, if any).R,R;ii�N(tstringR0RtapplyR.R#R/tKeyErrortinsertR<R(RRR#ttailtpdir((s-/sys/lib/python/distutils/command/build_py.pyR-�s(

	
cCs�|djoPtii|�ptd|�ntii|�ptdd|�q]n|oHtii|d�}tii|�o|Sq�tidd|�ndS(NR;s%package directory '%s' does not exists(supposed package directory '%s' exists, sbut is not a directorys__init__.pys!package init file '%s' not found s(or not a regular file)(
R.R#texiststDistutilsFileErrortisdirR/tisfileRtwarnR(RRRtinit_py((s-/sys/lib/python/distutils/command/build_py.pyt
check_package�s
	cCs6tii|�ptid||�dSndSdS(Ns!file %s (for module %s) not foundii(R.R#RTRRU(Rtmoduletmodule_file((s-/sys/lib/python/distutils/command/build_py.pytcheck_module�sc	Cs�|i||�ttii|d��}g}tii|ii�}xz|D]r}tii|�}||jo<tiitii	|��d}|i
|||f�qP|id|�qPW|S(Ns*.pyisexcluding %s(RWRR.R#R/tabspathRtscript_nametsplitexttbasenameR3tdebug_print(	RRRtmodule_filestmodulestsetup_scriptRtabs_fRX((s-/sys/lib/python/distutils/command/build_py.pytfind_package_modules�s
"c	Cs/h}g}x|iD]}ti|d�}ti|dd!d�}|d}y||\}}Wn(tj
o|i|�}d}nX|pG|i||�}	|df||<|	o|i|d|	f�q�nti	i||d�}
|i
||
�pqn|i|||
f�qW|S(s�Finds individually-specified Python modules, ie. those listed by
        module name in 'self.py_modules'.  Returns a list of tuples (package,
        module_base, filename): 'package' is a tuple of the path through
        package-space to the module; 'module_base' is the bare (no
        packages, no dots) module name, and 'filename' is the path to the
        ".py" file (relative to the distribution root) that implements the
        module.
        R,ii�it__init__s.py(RRKR0R/RMR-RWR3R.R#RZ(RRRaRXR#Rtmodule_baseRtcheckedRVRY((s-/sys/lib/python/distutils/command/build_py.pytfind_modules�s,

cCs{g}|io|i|i��n|ioFxC|iD]4}|i|�}|i||�}|i|�q;Wn|S(s4Compute the list of all modules that will be built, whether
        they are specified one-module-at-a-time ('self.py_modules') or
        by whole packages ('self.packages').  Return a list of tuples
        (package, module, module_file), just like 'find_modules()' and
        'find_package_modules()' do.(RR=RhRR-Rd(RRaRRtm((s-/sys/lib/python/distutils/command/build_py.pytfind_all_modules1s


cCs8|i�}g}x|D]}|i|d�qW|S(Ni�(RjR3(RRaR:RX((s-/sys/lib/python/distutils/command/build_py.pytget_source_filesFscCs1|gt|�|dg}ttii|�S(Ns.py(tlistRLR.R#R/(RR6RRXtoutfile_path((s-/sys/lib/python/distutils/command/build_py.pytget_module_outfilePsic
Cs|i�}g}x�|D]�\}}}ti|d�}|i|i||�}|i|�|oH|io|i|d�n|idjo|i|d�q�qqW|g}|iD]5\}}	}
}|D]}|t	i
i|
|�q�q�~7}|S(NR,Rito(RjRKR0RnR
R3RRRR.R#R/(RR%RatoutputsRRXRYRIR8R5R6R:((s-/sys/lib/python/distutils/command/build_py.pyR*Us"

-cCs�t|�tjoti|d�}n't|�ttfjo
td�n|i|i||�}t	i
i|�}|i|�|i
||dd�S(NR,s:'package' must be a string (dot-separated), list, or tupleRCi(Rt
StringTypeRKR0tListTypet	TupleTypet	TypeErrorRnR
R.R#RERDRF(RRXRYRtoutfiletdir((s-/sys/lib/python/distutils/command/build_py.pytbuild_moduleks

cCs=|i�}x*|D]"\}}}|i|||�qWdS(N(RhRw(RRaRRXRY((s-/sys/lib/python/distutils/command/build_py.pyR&{scCszxs|iD]h}|i|�}|i||�}x>|D]6\}}}||jpt�|i|||�q8Wq
WdS(N(RR-RdRRw(RRRRatpackage_RXRY((s-/sys/lib/python/distutils/command/build_py.pyR'�s
cCs�ddkl}|i}|dtijo|ti}n|io,||ddd|id|d|i�n|idjo/||d|id|id|d|i�ndS(Ni�(R)RiR
tprefixtdry_run(	tdistutils.utilR)R
R.tsepRR
RzR(RR?R)Ry((s-/sys/lib/python/distutils/command/build_py.pyR)�s	
(s
build-lib=Rsdirectory to "build" (copy) to(scompileRscompile .py to .pycN(s
no-compileNs!don't compile .py files [default](s	optimize=R	slalso compile with optimization: -O1 for "python -O", -O2 for "python -OO", and -O0 to disable [default: -O0](sforceRs2forcibly build everything (ignore file timestamps)(t__name__t
__module__tdescriptionRtuser_optionstboolean_optionstnegative_optRR$R+RR2R(R-RWRZRdRhRjRkRnR*RwR&R'R)(((s-/sys/lib/python/distutils/command/build_py.pyRs8		
		!			
	+		
		9		
				(t__doc__t__revision__tsysRKR.ttypesRtdistutils.coreRtdistutils.errorsR{Rt	distutilsRR(((s-/sys/lib/python/distutils/command/build_py.pys<module>s$



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].