Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241697 views
�
:-Yc@s�ddlZddlZddlmZddlZd�Zd�Zdejfd��YZd�Zd�Zd	�Z	d
�Z
d�ZdS(i����N(tsetupcCs4ytjj|�SWntk
r/}|GHdSXdS(Ni(tostpathtgetmtimetOSError(tfilenametmsg((sN/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/build_system.pyt
time_stamps
cCs'|jd�st�tjj|�\}}|dkr?dnd}tjj|�dd|}|d|}|s�tjj|�r�t|�t|�kr�|gfSn|jdtj	d	�|jd
tj	d	�dj
g|D]}	d|	^q��}
d
||
||f}||gfS(Ns.pyxsc++tcpptcit.t/s%s/src/sage/ext/t	SAGE_ROOTs%s/src/ts-I '%s' sXcd %s && python `which cython` --embed-positions --directive cdivision=False %s -o %s %s(tendswithtAssertionErrorRRtsplittsplitexttexistsRtappendtenvirontjoin(tf_pyxtlanguagetinclude_dirstforcetdirtftexttoutfiletfull_outfiletxtincludestcmd((sN/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/build_system.pytcython&s*
&t	ExtensioncBseZded�ZRS(R	c	Ks�g|_xvtt|��D]b}||}|jd�rt||||�\||<}	x!|	D]}
|jj|
�qaWqqWtjj|||d|d||�dS(Ns.pyxRR(	tcython_cmdstrangetlenRR"Rt
setuptoolsR#t__init__(tselftmoduletsourcesRRRtkwdstiRtcmdsR	((sN/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/build_system.pyR(:s	

(t__name__t
__module__tFalseR((((sN/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/build_system.pyR#9scCs|d|d�S(s�
    Given a pair p consisting of a function and a value, apply
    the function to the value.

    This exists solely because we can't pickle an anonymous function
    in execute_list_of_commands_in_parallel below.
    ii((tp((sN/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/build_system.pyt
apply_pairFscCs�dt|�tt|�|�fGHddlm}||�}|GHx9|jt|�D]%}|rXd|GHtjd�qXqXWdS(s�
    INPUT:
        command_list -- a list of pairs, consisting of a
             function to call and its argument
        nthreads -- integer; number of threads to use

    OUTPUT:
        Executes the given list of commands, possibly in parallel,
        using nthreads threads.  Terminates setup.py with an exit code of 1
        if an error occurs in any subcommand.

    WARNING: commands are run roughly in order, but of course successive
    commands may be run at the same time.
    s&Execute %s commands (using %s threads)i����(tPools%Parallel build failed with status %s.iN(R&tmintmultiprocessingR4timapR3tsystexit(tcommand_listtnthreadsR4R2tr((sN/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/build_system.pyt$execute_list_of_commands_in_parallelPs$	cCs�ttd�rRtjjd�rRtjd�}t|t�rR|dkrR|Sny'ttjd�dj�j	��SWndSXdS(s�
    Try to determine the number of threads one can run at once on this
    system (e.g., the number of cores).  If successful return that
    number.  Otherwise return 0 to indicate failure.

    OUTPUT:
        int
    tsysconftSC_NPROCESSORS_ONLNissysctl -n hw.ncpuiN(
thasattrRt
sysconf_namesthas_keyR>t
isinstancetinttpopen2treadtstrip(tn((sN/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/build_system.pytnumber_of_threadshs	!'cCsLxE|D]=\}}||�}|dkrd|GHtjd�qqWdS(s�
    INPUT:
        command_list -- a list of commands, each given as a pair
           of the form [command, argument].

    OUTPUT:
        the given list of commands are all executed in serial
    is-Error running command, failed with status %s.iN(R8R9(R:RtvR<((sN/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/build_system.pyt"execute_list_of_commands_in_serialzs
		cCsztg|D]}|j^q
g�}g|D]}tj|f^q,}t�}|dkrit|�n
t||�dS(Ni(tsumR$RtsystemRIRKR=(text_modulestER.R	RH((sN/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/build_system.pyt	cythonize�s%"	
(RR8R'RRR"R#R3R=RIRKRP(((sN/projects/68c8b2b8-03ba-44d4-a0d1-5d771c8cb465/code/alex/psage/build_system.pyt<module>s