/usr/lib/python3.9/site-packages/setuptools/__pycache__
Edit: /usr/lib/python3.9/site-packages/setuptools/__pycache__/monkey.cpython-39.pyc (4579B)
a
ˆåÏha ã @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddl Z ddl
Z
g Zdd„ Zdd„ Z
dd „ Zd
d„ Zdd
„ Zdd„ Zdd„ Zdd„ ZdS )z
Monkey patching of distutils.
é N)Ú
import_modulec C s" t ¡ dkr| f| j S t | ¡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.9/site-packages/setuptools/monkey.pyÚ_get_mro s r c C s. t | tƒrtnt | tjƒrtndd„ }|| ƒS )Nc S s d S )Nr )Úitemr r r Ú
( ó zget_unpatched..)Ú
isinstanceÚtypeÚget_unpatched_classÚtypesÚFunctionTypeÚget_unpatched_function)r
Úlookupr r r Ú
get_unpatched$ s
ýr c C s: 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.
c s s | ]}|j d ¡s|V qdS )Ú
setuptoolsN)Ú
__module__Ú
startswith)Ú.0r r r r Ú 3 s þz&get_unpatched_class..Ú distutilsz(distutils has already been patched by %r)r Únextr r ÚAssertionError)r Zexternal_basesÚbaseÚmsgr r r r - s þr c C sÔ t jtj_tjdk} | r"t jtj_tjdk p^dtj k o@dk n p^dtj k oZdkn }|rrd}|tjj _
tƒ tjtjtj
fD ]}t jj|_qˆt jjtj_t jjtj_dtjv rÊt jjtjd _tƒ d S )N)é é r )é é é
)r é )r r$ é )r r zhttps://upload.pypi.org/legacy/zdistutils.command.build_ext)r ZCommandr ZcoreÚsysÚversion_infoÚfindallZfilelistZconfigZ
PyPIRCCommandZDEFAULT_REPOSITORYÚ_patch_distribution_metadataÚdistÚcmdZDistributionÚ extensionZ ExtensionÚmodulesÚ#patch_for_msvc_specialized_compiler)Zhas_issue_12885Zneeds_warehouseZ warehouseÚmoduler r r Ú patch_all? s*
þû
ÿ
r0 c C s* dD ] } t tj| ƒ}ttjj| |ƒ qdS )zDPatch write_pkg_file and read_pkg_file for higher metadata standards)Zwrite_pkg_fileZ
read_pkg_fileZget_metadata_versionN)Úgetattrr r* Úsetattrr ZDistributionMetadata)ÚattrÚnew_valr r r r) f s r) c C s* 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Úoriginalr r r Ú
patch_funcm s
r: c C s
t | dƒS )Nr5 )r1 )Ú candidater r r r ~ s r c s¸ t dƒ‰ t ¡ dkrdS ‡ fdd„} t | d¡}t | d¡}zt|dƒŽ t|d ƒŽ W n tyj Y n0 zt|d
ƒŽ W n tyŽ Y n0 zt|dƒŽ W n ty² Y n0 dS )z\
Patch functions in distutils to use standalone Microsoft Visual C++
compilers.
zsetuptools.msvcZWindowsNc sL d| v rdnd}|| d¡ }tˆ |ƒ}t| ƒ}t||ƒsBt|ƒ‚|||fS )zT
Prepare the parameters for patch_func to patch indicated function.
Úmsvc9Zmsvc9_Zmsvc14_Ú_)Úlstripr1 r ÚhasattrÚImportError)Úmod_namer8 Zrepl_prefixZ repl_nameÚreplÚmod©Zmsvcr r Úpatch_paramsŽ s
z9patch_for_msvc_specialized_compiler..patch_paramszdistutils.msvc9compilerzdistutils._msvccompilerZfind_vcvarsallZquery_vcvarsallZ_get_vc_envZgen_lib_options)r r ÚsystemÚ functoolsÚpartialr: r@ )rE r<