["@sddlZddlZddlZddlZddlZddlmZmZddlmZddlm Z dddd d d d gZ ej d krdZ dZ n9ej d koeeddZ ejjjdZ e rejjejdan ejaddZdd ZddZddZdd ZddddZddZddZdd ZgZddZ d d!Z!d"d#Z"d$d Z#dS)%N)get_start_methodset_start_method)process)util_mainfreeze_supportset_executableget_executableget_preparation_dataget_command_lineimport_main_pathwin32Ffrozenzpythonservice.exez python.execCs |adS)N) _python_exe)Zexer+/usr/lib/python3.4/multiprocessing/spawn.pyr )scCstS)N)rrrrrr -scCs.t|dkr&|ddkr&dSdSdS)z= Return whether commandline indicates we are forking rz--multiprocessing-forkTFN)len)argvrrr is_forking4s"rcCsttjri}xYtjddD]D}|jd\}}|dkr]d||s   cKsttddr6tjdgdd|jDSd}|djdd |jD;}tj}tg|d |dgSd S) zJ Returns prefix of command line used for spawning a child process rFz--multiprocessing-forkcSsg|]}d|qS)z%s=%rr).0itemrrr Ts z$get_command_line..zWsz#get_command_line..z-cN)getattrr executableitemsjoinrZ_args_from_interpreter_flagsr)rprogZoptsrrrr Ns & c Csttjsttjdkrgddl}ddlm}|||}|j|t j }n"ddl m }||j _|}t|}tj|dS)z6 Run code specifed by data received over pipe rrNr) steal_handle)semaphore_tracker)rrrAssertionErrorplatformmsvcrtZ reductionr+Zopen_osfhandleosO_RDONLYr,Z_semaphore_trackerZ_fdrr) Z pipe_handleZ parent_pidZ tracker_fdr/r+Z new_handlefdr,Zexitcoderrrr\s   rcCsvtj|dddR}dtj_z,tj|}t|tj|}Wdtj`XWdQX|jS)NrbclosefdT) r0fdopenrcurrent_process _inheritingpickleloadprepare _bootstrap)r3Z from_parentZpreparation_dataselfrrrrns cCs+ttjddr'tdndS)Nr8Fa An attempt has been made to start a new process before the current process has finished its bootstrapping phase. This probably means that you are not using fork to start your child processes and you have forgotten to use the proper idiom in the main module: if __name__ == '__main__': freeze_support() ... The "freeze_support()" line can be omitted if the program is not going to be frozen to produce an executable.)r&rr7 RuntimeErrorrrrr_check_not_importing_mainzs r?cCsttdtjdtjj}tjdk rMtjj|d            cCs\d|kr"|dtj_nd|krD|dtj_nd|krg|drgtjnd|krtjj|dnd|kr|dt_ nd|kr|dt_ nd|krt j |dnd|kr|dt_ nd |krt|d nd |kr;t|d nd |krXt|d nd S) zE Try to get current process ready to unpickle process object r rAr@rBrCrDrFrErGrIrKN)rr7r rArr@Z get_loggerZsetLevelrrMrr0chdirrQr_fixup_main_from_name_fixup_main_from_path)datarrrr;s,           r;cCstjd}|dks(|jdr,dSt|jdd|krKdStj|tjd}t j |dddd}|j j ||tjd s>       !       2 &