3 öLÖjˆ) ã @ s d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl Z d dlmZ d dl mZmZ dadd„ ZG dd„ de jdd#ƒƒZdd„ Zd d„ Zdd„ Zdd„ Zejejdœdd„Zdd„ Zd$dd„Zd%dd„Zd&dd„Zd'd!d"„ZdS )(é N)Úsource_from_cache)Úmake_legacy_pycÚstrip_python_stderrc C sV t dkrRdtjkrda dS ytjtjdddgƒ W n tjk rL da Y nX da t S )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. NZ PYTHONHOMETz-Ez-czimport sys; sys.exit(0)F)Ú$__cached_interp_requires_environmentÚosÚenvironÚ subprocessZ check_callÚsysÚ executableZCalledProcessError© r r ú2/usr/lib64/python3.6/test/support/script_helper.pyÚ interpreter_requires_environment s r c @ s e Zd ZdZdd„ ZdS )Ú_PythonRunResultz2Helper for reporting Python subprocess run resultsc C sˆ d }| j | j }}t|ƒ|kr0d|| d… }t|ƒ|krNd|| d… }|jddƒjƒ }|jddƒjƒ }td| j|||f ƒ‚dS ) z4Provide helpful details about failed subcommand runséP éd s (... truncated stdout ...)Ns (... truncated stderr ...)ÚasciiÚreplacezRProcess return code is %d command line: %r stdout: --- %s --- stderr: --- %s ---i@ )ÚoutÚerrÚlenÚdecodeÚrstripÚAssertionErrorÚrc)ÚselfÚcmd_lineÚmaxlenr r r r r Úfail> s z_PythonRunResult.failN)Ú__name__Ú __module__Ú__qualname__Ú__doc__r r r r r r ; s r r r r c O s t ƒ }d|kr|jdƒ}n| o$| }tjddg}|rB|jdƒ n| rX| rX|jdƒ |jdd ƒr‚i }tjdkrŒtjd |d<