Viewing File: /usr/lib/python3.6/site-packages/setuptools/__pycache__/monkey.cpython-36.pyc

3

Xoh@sdZddlZddlZddlZddlZddlZddlmZddl	Z	ddl
mZddlZgZ
ddZddZd	d
ZddZd
dZddZddZddZdS)z
Monkey patching of distutils.
N)
import_module)sixcCs"tjdkr|f|jStj|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)clsr/usr/lib/python3.6/monkey.py_get_mros	r
cCs0t|tjrtnt|tjr tndd}||S)NcSsdS)Nr)itemrrr	<lambda>*szget_unpatched.<locals>.<lambda>)
isinstancerZclass_typesget_unpatched_classtypesFunctionTypeget_unpatched_function)rlookuprrr	
get_unpatched&srcCs:ddt|D}t|}|jjds6d|}t||S)zProtect against re-patching the distutils if reloaded

    Also ensures that no other distutils extension monkeypatched the distutils
    first.
    css|]}|jjds|VqdS)
setuptoolsN)
__module__
startswith).0rrrr		<genexpr>6sz&get_unpatched_class.<locals>.<genexpr>	distutilsz(distutils has already been patched by %r)r
nextrrAssertionError)rZexternal_basesbasemsgrrr	r/srcCstjtj_tjdk}|r"tjtj_tjdkpxd
tjko@dknpxdtjkoZdknpxdtjkotdkn}|rd	}|tjj	_
tx"tjtjtj
fD]}tjj|_qWtjjtj_tjjtj_d
tjkrtjjtjd
_tdS)N
rzhttps://upload.pypi.org/legacy/zdistutils.command.build_ext)rrr)r r!r")rr)rrr!)rr#)rr#r$)rr)rrr)rZCommandrZcoresysversion_infofindallZfilelistconfigZ
PyPIRCCommandZDEFAULT_REPOSITORY+_patch_distribution_metadata_write_pkg_filedistcmdZDistribution	extensionZ	Extensionmodules#patch_for_msvc_specialized_compiler)Zhas_issue_12885Zneeds_warehouseZ	warehousemodulerrr		patch_allAs&




r0cCstjjtjj_dS)zDPatch write_pkg_file to also write Requires-Python/Requires-ExternalN)rr*Zwrite_pkg_filerZDistributionMetadatarrrr	r)jsr)cCs*t||}t|jd|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)getattrvars
setdefaultsetattr)ZreplacementZ
target_mod	func_nameZoriginalrrr	
patch_funcqs
r7cCs
t|dS)Nr1)r2)	candidaterrr	rsrcstdtjdkrdSfdd}tj|d}tj|d}yt|dt|d	Wntk
rlYnXyt|d
Wntk
rYnXyt|dWntk
rYnXdS)z\
    Patch functions in distutils to use standalone Microsoft Visual C++
    compilers.
    zsetuptools.msvcZWindowsNcsLd|krdnd}||jd}t|}t|}t||sBt||||fS)zT
        Prepare the parameters for patch_func to patch indicated function.
        msvc9Zmsvc9_Zmsvc14__)lstripr2rhasattrImportError)Zmod_namer6Zrepl_prefixZ	repl_namereplmod)msvcrr	patch_paramss

z9patch_for_msvc_specialized_compiler.<locals>.patch_paramszdistutils.msvc9compilerzdistutils._msvccompilerZfind_vcvarsallZquery_vcvarsallZ_get_vc_envZgen_lib_options)rrsystem	functoolspartialr7r=)rAr9Zmsvc14r)r@r	r.s&
r.)__doc__r%Zdistutils.filelistrrrrC	importlibrrZsetuptools.externrr__all__r
rrr0r)r7rr.rrrr	<module>s$	)
Back to Directory File Manager