/usr/lib/python3.10/test/support/__pycache__
NameSizeModeActions
bytecode_helper.cpython-310.pyc17020644editdlrm
hashlib_helper.cpython-310.pyc18980644editdlrm
import_helper.cpython-310.pyc73180644editdlrm
interpreters.cpython-310.pyc71040644editdlrm
logging_helper.cpython-310.pyc11640644editdlrm
os_helper.cpython-310.pyc141540644editdlrm
script_helper.cpython-310.pyc78040644editdlrm
socket_helper.cpython-310.pyc96280644editdlrm
testresult.cpython-310.pyc67820644editdlrm
threading_helper.cpython-310.pyc63230644editdlrm
warnings_helper.cpython-310.pyc63520644editdlrm
__init__.cpython-310.pyc590400644editdlrm
Edit: /usr/lib/python3.10/test/support/__pycache__/script_helper.cpython-310.pyc (7804B)
o 9j,@sddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z daddZGdddedd Zd d Zd d ZddZddZejejdddZddZd$ddZd%ddZd&ddZ d'd d!Zd"d#ZdS)(N)source_from_cache)support)make_legacy_pyccCsVtdur)dtjvr dadSz ttjdddgWn tjy&daYtSwdatS)a  Returns True if our sys.executable interpreter requires environment variables in order to be able to run at all. This is designed to be used with @unittest.skipIf() to annotate tests that need to use an assert_python*() function to launch an isolated mode (-I) or no environment mode (-E) sub-interpreter process. A normal build & test does not run into this situation but it can happen when trying to run the standard library test suite from an interpreter that doesn't have an obvious home with Python's current home finding logic. Setting PYTHONHOME is one way to get most of the testsuite to run in that situation. PYTHONPATH or PYTHONUSERSITE are other common environment variables that might impact whether or not the interpreter can start. N PYTHONHOMET-Ez-czimport sys; sys.exit(0)F)$__cached_interp_requires_environmentosenviron subprocess check_callsys executableCalledProcessErrorrr1/usr/lib/python3.10/test/support/script_helper.py interpreter_requires_environments   rc@seZdZdZddZdS)_PythonRunResultz2Helper for reporting Python subprocess run resultscCsd}|j|j}}t||krd|| d}t||kr'd|| d}|dd}|dd}td|j|||f)z4Provide helpful details about failed subcommand runsi@s(... truncated stdout ...)Ns(... truncated stderr ...)asciireplacezRProcess return code is %d command line: %r stdout: --- %s --- stderr: --- %s ---)outerrlendecoderstripAssertionErrorrc)selfcmd_linemaxlenrrrrrfail=s   z_PythonRunResult.failN)__name__ __module__ __qualname____doc__rrrrrr:s r)rrrc OsBt}|dd}d|vr|d}n| o| }tjddg}|r'|dn |s0|s0|d|ddrEi}tjdkrDtjd |d <ntj}d |vrRd |d <| || |t j |t j t j t j ||d }|"z|\}} W|t n |t wWdn1swY|j} t| || |fS) N__cwd __isolated-X faulthandlerz-Ir __cleanenvwin32 SYSTEMROOTTERM)stdinstdoutstderrenvcwd)rpopr r appendplatformrr copyupdateextendr PopenPIPE communicatekill_cleanup returncoder) argsenv_vars env_requiredr1isolatedrr0procrrrrrrrun_python_until_endZsD              rCcOs4t|i|\}}|jr|s|js|s|||SN)rCrr)expected_successr>r?resrrrr_assert_pythons rGcOtdg|Ri|S)a| Assert that running the interpreter with `args` and optional environment variables `env_vars` succeeds (rc == 0) and return a (return code, stdout, stderr) tuple. If the __cleanenv keyword is set, env_vars is used as a fresh environment. Python is started in isolated mode (command line option -I), except if the __isolated keyword is set to False. TrGr>r?rrrassert_python_oks rKcOrH)z Assert that running the interpreter with `args` and optional environment variables `env_vars` fails (rc != 0) and return a (return code, stdout, stderr) tuple. See assert_python_ok() for more options. FrIrJrrrassert_python_failuresrL)r.r/cOsXtjg}ts |d|||dttj}d|d<t j |ft j ||d|S)zRun a Python subprocess with the given arguments. kw is extra keyword args to pass to subprocess.Popen. Returns a Popen object. rr0vt100r+)r-r.r/) r r rr3r7 setdefaultdictrr r r8r9)r.r/r>kwrr0rrr spawn_pythons   rQcCs2|j|j}|j|t|S)z?Run the given Popen process until completion and return stdout.)r-closer.readwaitr r<)pdatarrr kill_pythons   rWFcCsh|}|s |tjd7}tj||}t|ddd }||Wdn1s)wYt|S)Npywzutf-8)encoding)rextseppathjoinopenwrite importlibinvalidate_caches) script_dirscript_basenamesource omit_suffixscript_filename script_name script_filerrr make_scripts ric Cs|tjd}tj||}t|d9}|dur@|tj}t|dkr:|ddkr:t t |}tj |}|}ntj |}| ||Wdn1sPwY|tj||fS)NziprY __pycache__) rr[r\r]zipfileZipFilesplitseprrrbasenamer_) zip_dir zip_basenamerg name_in_zip zip_filenamezip_namezip_fileparts legacy_pycrrrmake_zip_scripts    r{r,cCst|t|d|dS)N__init__)rmkdirri)pkg_dir init_sourcerrrmake_pkgs rcs>g}t|dd}||tj|} t|||} || |r5tj|dd}tj| dd} ||| ffddtd|dD} tj | dtj| } |tj d } tj || }t |d  }| D]}tj || }| ||qg| | | Wdn1swY|D]}t|q|tj || fS) Nr|r,T)doraisecsg|] }tjg|qSr)rrqr]).0ipkg_namerr sz make_zip_pkg..rrjrY)rir3rr\rr py_compilecompiler7ranger]r[rnror_unlink)rsrtrrcrddepthcompiledr init_name init_basenamerg pkg_namesscript_name_in_ziprvrwrxnameinit_name_in_ziprrr make_zip_pkgs.      rcCstjrDdd}dtj|}tt||ddtjdddd |d g}t |}t||d |j dd|j rBt |d dSt d |d dS) NcSs d|dS)Nz===== z ======r)textrrrtitles zrun_test_script..titlezscript T)flushrr&r'z-uz-vz completed: exit code z failed) rverboserr\rrprintr r r runr=rrK)scriptrrr>rBrrrrun_test_scripts r)FrD)r,)rF) collectionsr`r ros.pathr rrnimportlib.utilrtestrtest.support.import_helperrrr namedtuplerrCrGrKrLr9STDOUTrQrWrir{rrrrrrrs8   $ 4