3 \"@s.ddlZddlZddlZddlZddlmZmZddlmZddlm Z ddlm Z ddd d d d d gZ ej dkrzdZ dZn&ej dkoeeddZ ejjjdZerejjejdanejadd Zdd ZddZddZdd Zd&ddZddZddZdd ZgZ dd Z!d!d"Z"d#d$Z#d%d Z$dS)'N)get_start_methodset_start_method)process) reduction)util_mainfreeze_supportset_executableget_executableget_preparation_dataget_command_lineimport_main_pathwin32Ffrozenzpythonservice.exez python.execCs|adS)N) _python_exe)Zexer-/usr/lib64/python3.6/multiprocessing/spawn.pyr )scCstS)N)rrrrrr -scCs$t|dkr|ddkrdSdSdS)z= Return whether commandline indicates we are forking rz--multiprocessing-forkTFN)len)argvrrr is_forking4srcCshttjrdi}xBtjddD]0}|jd\}}|dkrBd||<qt|||<qWtf|tjdS)zE Run code for process object if this in not the main process rN=None)rsysrsplitint spawn_mainexit)kwdsargnamevaluerrrr >s   cKshttddr(tjdgdd|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 Tsz$get_command_line..zWsz#get_command_line..z-cN)getattrr executableitemsjoinrZ_args_from_interpreter_flagsr)rprogZoptsrrrr Ns cCsjttjsttjdkr         cCsd|kr|dtj_d|kr,|dtj_d|krD|drDtjd|kr^tjj|dd|krp|dt_ d|kr|dt_ d|krt j |dd|kr|dt_ d |krt|d d d d |krt|d nd |krt|d dS)zE Try to get current process ready to unpickle process object r!rAr@rBrCrDrFrErGT)ZforcerIrKN)rr7r!rArr@Z get_loggerZsetLevelrrMrr0chdirrQr_fixup_main_from_name_fixup_main_from_path)datarrrr;s,   r;cCs~tjd}|dks|jdr dSt|jdd|kr6dStj|tjd}t j |ddd}|j j ||tjd<tjd<dS)NrHz .__main__r! __mp_main__T)run_nameZ alter_sys) rrTendswithr'rUold_main_modulesappendtypes ModuleTyperunpyZ run_module__dict__rR)Zmod_name current_mainr\ main_contentrrrr_s    r_cCstjd}tjjtjj|d}|dkr.dSt|dd|krBdStj|t j d}t j |dd}|j j||tjd<tjd<dS)NrHrZipythonrJrb)rc)rrTr0rMsplitextbasenamer'rerfrgrhriZrun_pathrjrR)r]rkZ main_namer\rlrrrr`s    r`cCs t|dS)z< Set sys.modules['__main__'] to module at main_path N)r`)r]rrrrs)NN)%r0rrirgr2rrrcontextrr__all__r.rVrWr'r(lowerrdrMr* exec_prefixrr r rr r rrr?r rer;r_r`rrrrr s>        2&