Your IP : 3.15.18.73


Current Path : /usr/lib/python3.8/site-packages/setuptools/__pycache__/
Upload File :
Current File : //usr/lib/python3.8/site-packages/setuptools/__pycache__/monkey.cpython-38.pyc

U

�Qab��@s�dZddlZddlZddlZddlZddlZddlmZddl	Z	ddl
mZddlZgZ
dd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�ZdS)z
Monkey patching of distutils.
�N)�
import_module)�sixcCs"t��dkr|f|jSt�|�S)am
    Returns the bases classes for cls sorted by the MRO.

    Works around an issue on Jython where inspect.getmro will not return all
    base classes if multiple classes share the same name. Instead, this
    function will return a tuple containing the class itself, and the contents
    of cls.__bases__. See https://github.com/pypa/setuptools/issues/1024.
    ZJython)�platformZpython_implementation�	__bases__�inspectZgetmro)�cls�r�5/usr/lib/python3.8/site-packages/setuptools/monkey.py�_get_mros	r
cCs0t|tj�rtnt|tj�r tndd�}||�S)NcSsdS)Nr)�itemrrr	�<lambda>*�zget_unpatched.<locals>.<lambda>)�
isinstancerZclass_types�get_unpatched_class�types�FunctionType�get_unpatched_function)r�lookuprrr	�
get_unpatched&s
�rcCs:dd�t|�D�}t|�}|j�d�s6d|}t|��|S)z�Protect against re-patching the distutils if reloaded

    Also ensures that no other distutils extension monkeypatched the distutils
    first.
    css|]}|j�d�s|VqdS)�
setuptoolsN)�
__module__�
startswith)�.0rrrr	�	<genexpr>5s�z&get_unpatched_class.<locals>.<genexpr>�	distutilsz(distutils has already been patched by %r)r
�nextrr�AssertionError)rZexternal_bases�base�msgrrr	r/s�rcCs�tjtj_tjdk}|r"tjtj_tjdkp^dtjko@dknp^dtjkoZdkn}|rrd}|tjj	_
t�tjtjtj
fD]}tjj|_q�tjjtj_tjjtj_dtjkr�tjjtjd_t�dS)N)��r)���
)r�)rr$�)rr zhttps://upload.pypi.org/legacy/zdistutils.command.build_ext)rZCommandrZcore�sys�version_info�findallZfilelistZconfigZ
PyPIRCCommandZDEFAULT_REPOSITORY�_patch_distribution_metadata�dist�cmdZDistribution�	extensionZ	Extension�modules�#patch_for_msvc_specialized_compiler)Zhas_issue_12885Zneeds_warehouseZ	warehouse�modulerrr	�	patch_allAs*



��

�
r0cCs*dD] }ttj|�}ttjj||�qdS)zDPatch write_pkg_file and read_pkg_file for higher metadata standards)Zwrite_pkg_fileZ
read_pkg_fileZget_metadata_versionN)�getattrrr*�setattrrZDistributionMetadata)�attrZnew_valrrr	r)hsr)cCs*t||�}t|��d|�t|||�dS)z�
    Patch func_name in target_mod with replacement

    Important - original must be resolved by name to avoid
    patching an already patched function.
    �	unpatchedN)r1�vars�
setdefaultr2)ZreplacementZ
target_mod�	func_name�originalrrr	�
patch_funcos
r9cCs
t|d�S)Nr4)r1)�	candidaterrr	r�srcs�td��t��dkrdS�fdd�}t�|d�}t�|d�}zt|d��t|d	��Wntk
rlYnXzt|d
��Wntk
r�YnXzt|d��Wntk
r�YnXdS)z\
    Patch functions in distutils to use standalone Microsoft Visual C++
    compilers.
    zsetuptools.msvcZWindowsNcsLd|krdnd}||�d�}t�|�}t|�}t||�sBt|��|||fS)zT
        Prepare the parameters for patch_func to patch indicated function.
        �msvc9Zmsvc9_Zmsvc14_�_)�lstripr1r�hasattr�ImportError)Zmod_namer7Zrepl_prefixZ	repl_name�repl�mod�Zmsvcrr	�patch_params�s

z9patch_for_msvc_specialized_compiler.<locals>.patch_paramszdistutils.msvc9compilerzdistutils._msvccompilerZfind_vcvarsallZquery_vcvarsallZ_get_vc_envZgen_lib_options)rr�system�	functools�partialr9r?)rCr;Zmsvc14rrBr	r.�s&
r.)�__doc__r&Zdistutils.filelistrrrrE�	importlibrrZsetuptools.externrr�__all__r
rrr0r)r9rr.rrrr	�<module>s$	'

?>